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
SheetJS/js-xlsx
xlsx.js
parse_FormulaValue
function parse_FormulaValue(blob) { var b; if(__readUInt16LE(blob,blob.l + 6) !== 0xFFFF) return [parse_Xnum(blob),'n']; switch(blob[blob.l]) { case 0x00: blob.l += 8; return ["String", 's']; case 0x01: b = blob[blob.l+2] === 0x1; blob.l += 8; return [b,'b']; case 0x02: b = blob[blob.l+2]; blob.l += 8; return [b,'e']; case 0x03: blob.l += 8; return ["",'s']; } return []; }
javascript
function parse_FormulaValue(blob) { var b; if(__readUInt16LE(blob,blob.l + 6) !== 0xFFFF) return [parse_Xnum(blob),'n']; switch(blob[blob.l]) { case 0x00: blob.l += 8; return ["String", 's']; case 0x01: b = blob[blob.l+2] === 0x1; blob.l += 8; return [b,'b']; case 0x02: b = blob[blob.l+2]; blob.l += 8; return [b,'e']; case 0x03: blob.l += 8; return ["",'s']; } return []; }
[ "function", "parse_FormulaValue", "(", "blob", ")", "{", "var", "b", ";", "if", "(", "__readUInt16LE", "(", "blob", ",", "blob", ".", "l", "+", "6", ")", "!==", "0xFFFF", ")", "return", "[", "parse_Xnum", "(", "blob", ")", ",", "'n'", "]", ";", "sw...
/* [MS-XLS] 2.5.133 TODO: how to emit empty strings?
[ "/", "*", "[", "MS", "-", "XLS", "]", "2", ".", "5", ".", "133", "TODO", ":", "how", "to", "emit", "empty", "strings?" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L11303-L11313
train
Parse an formula value
[ 30522, 3853, 11968, 3366, 1035, 5675, 10175, 5657, 1006, 1038, 4135, 2497, 1007, 1063, 13075, 1038, 1025, 2065, 1006, 1035, 1035, 3191, 20023, 2102, 16048, 2571, 1006, 1038, 4135, 2497, 1010, 1038, 4135, 2497, 1012, 1048, 1009, 1020, 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...
NetEase/pomelo
lib/connectors/siosocket.js
function(msgs){ var res = '[', msg; for(var i=0, l=msgs.length; i<l; i++) { if(i > 0) { res += ','; } msg = msgs[i]; if(typeof msg === 'string') { res += msg; } else { res += JSON.stringify(msg); } } res += ']'; return res; }
javascript
function(msgs){ var res = '[', msg; for(var i=0, l=msgs.length; i<l; i++) { if(i > 0) { res += ','; } msg = msgs[i]; if(typeof msg === 'string') { res += msg; } else { res += JSON.stringify(msg); } } res += ']'; return res; }
[ "function", "(", "msgs", ")", "{", "var", "res", "=", "'['", ",", "msg", ";", "for", "(", "var", "i", "=", "0", ",", "l", "=", "msgs", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "{", "res...
Encode batch msg to client
[ "Encode", "batch", "msg", "to", "client" ]
defcf019631ed399cc4dad932d3b028a04a039a4
https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/connectors/siosocket.js#L64-L79
train
Returns a string containing the msgs as an array of strings
[ 30522, 3853, 1006, 5796, 5620, 1007, 1063, 13075, 24501, 1027, 1005, 1031, 1005, 1010, 5796, 2290, 1025, 2005, 1006, 13075, 1045, 1027, 1014, 1010, 1048, 1027, 5796, 5620, 1012, 3091, 1025, 1045, 1026, 1048, 1025, 1045, 1009, 1009, 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...
google/material-design-lite
src/mdlComponentHandler.js
upgradeDomInternal
function upgradeDomInternal(optJsClass, optCssClass) { if (typeof optJsClass === 'undefined' && typeof optCssClass === 'undefined') { for (var i = 0; i < registeredComponents_.length; i++) { upgradeDomInternal(registeredComponents_[i].className, registeredComponents_[i].cssClass); } } else { var jsClass = /** @type {string} */ (optJsClass); if (typeof optCssClass === 'undefined') { var registeredClass = findRegisteredClass_(jsClass); if (registeredClass) { optCssClass = registeredClass.cssClass; } } var elements = document.querySelectorAll('.' + optCssClass); for (var n = 0; n < elements.length; n++) { upgradeElementInternal(elements[n], jsClass); } } }
javascript
function upgradeDomInternal(optJsClass, optCssClass) { if (typeof optJsClass === 'undefined' && typeof optCssClass === 'undefined') { for (var i = 0; i < registeredComponents_.length; i++) { upgradeDomInternal(registeredComponents_[i].className, registeredComponents_[i].cssClass); } } else { var jsClass = /** @type {string} */ (optJsClass); if (typeof optCssClass === 'undefined') { var registeredClass = findRegisteredClass_(jsClass); if (registeredClass) { optCssClass = registeredClass.cssClass; } } var elements = document.querySelectorAll('.' + optCssClass); for (var n = 0; n < elements.length; n++) { upgradeElementInternal(elements[n], jsClass); } } }
[ "function", "upgradeDomInternal", "(", "optJsClass", ",", "optCssClass", ")", "{", "if", "(", "typeof", "optJsClass", "===", "'undefined'", "&&", "typeof", "optCssClass", "===", "'undefined'", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "reg...
Searches existing DOM for elements of our component type and upgrades them if they have not already been upgraded. @param {string=} optJsClass the programatic name of the element class we need to create a new instance of. @param {string=} optCssClass the name of the CSS class elements of this type will have.
[ "Searches", "existing", "DOM", "for", "elements", "of", "our", "component", "type", "and", "upgrades", "them", "if", "they", "have", "not", "already", "been", "upgraded", "." ]
60f441a22ed98ed2c03f6179adf460d888bf459f
https://github.com/google/material-design-lite/blob/60f441a22ed98ed2c03f6179adf460d888bf459f/src/mdlComponentHandler.js#L173-L194
train
This function is called by the upgradeDom function. It is called by the upgradeDom function. It is called by the upgradeDom function. It is called by the upgradeDom function. It is called by the upgradeDom function. It is called by the upgradeDom function. It is called by the upgradeDom function. It is called by the upgradeDom function.
[ 30522, 3853, 9725, 20936, 10111, 12789, 2140, 1006, 23569, 22578, 26266, 1010, 23569, 6169, 11020, 27102, 1007, 1063, 2065, 1006, 2828, 11253, 23569, 22578, 26266, 1027, 1027, 1027, 1005, 6151, 28344, 1005, 1004, 1004, 2828, 11253, 23569, 616...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var aEventListenerTargets = ScrollingHelper.getEventListenerTargets(oTable); oScrollExtension._mMouseWheelEventListener = this.addMouseWheelEventListener(aEventListenerTargets, oTable, { scrollDirection: ScrollDirection.BOTH }); oScrollExtension._mTouchEventListener = this.addTouchEventListener(aEventListenerTargets, oTable, { scrollDirection: ScrollDirection.BOTH }); }
javascript
function(oTable) { var oScrollExtension = oTable._getScrollExtension(); var aEventListenerTargets = ScrollingHelper.getEventListenerTargets(oTable); oScrollExtension._mMouseWheelEventListener = this.addMouseWheelEventListener(aEventListenerTargets, oTable, { scrollDirection: ScrollDirection.BOTH }); oScrollExtension._mTouchEventListener = this.addTouchEventListener(aEventListenerTargets, oTable, { scrollDirection: ScrollDirection.BOTH }); }
[ "function", "(", "oTable", ")", "{", "var", "oScrollExtension", "=", "oTable", ".", "_getScrollExtension", "(", ")", ";", "var", "aEventListenerTargets", "=", "ScrollingHelper", ".", "getEventListenerTargets", "(", "oTable", ")", ";", "oScrollExtension", ".", "_mM...
Adds mouse wheel and touch event listeners. @param {sap.ui.table.Table} oTable Instance of the table.
[ "Adds", "mouse", "wheel", "and", "touch", "event", "listeners", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableScrollExtension.js#L1059-L1069
train
Adds mouse wheel and touch event listeners to the table.
[ 30522, 3853, 1006, 27178, 3085, 1007, 1063, 13075, 9808, 26775, 14511, 10288, 29048, 1027, 27178, 3085, 1012, 1035, 4152, 26775, 14511, 10288, 29048, 1006, 1007, 1025, 13075, 29347, 15338, 9863, 24454, 7559, 18150, 2015, 1027, 28903, 16001, 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...
caolan/async
lib/concatLimit.js
concatLimit
function concatLimit(coll, limit, iteratee, callback) { var _iteratee = wrapAsync(iteratee); return mapLimit(coll, limit, (val, iterCb) => { _iteratee(val, (err, ...args) => { if (err) return iterCb(err); return iterCb(err, args); }); }, (err, mapResults) => { var result = []; for (var i = 0; i < mapResults.length; i++) { if (mapResults[i]) { result = result.concat(...mapResults[i]); } } return callback(err, result); }); }
javascript
function concatLimit(coll, limit, iteratee, callback) { var _iteratee = wrapAsync(iteratee); return mapLimit(coll, limit, (val, iterCb) => { _iteratee(val, (err, ...args) => { if (err) return iterCb(err); return iterCb(err, args); }); }, (err, mapResults) => { var result = []; for (var i = 0; i < mapResults.length; i++) { if (mapResults[i]) { result = result.concat(...mapResults[i]); } } return callback(err, result); }); }
[ "function", "concatLimit", "(", "coll", ",", "limit", ",", "iteratee", ",", "callback", ")", "{", "var", "_iteratee", "=", "wrapAsync", "(", "iteratee", ")", ";", "return", "mapLimit", "(", "coll", ",", "limit", ",", "(", "val", ",", "iterCb", ")", "=>...
The same as [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async operations at a time. @name concatLimit @static @memberOf module:Collections @method @see [async.concat]{@link module:Collections.concat} @category Collection @alias flatMapLimit @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. @param {number} limit - The maximum number of async operations at a time. @param {AsyncFunction} iteratee - A function to apply to each item in `coll`, which should use an array as its result. Invoked with (item, callback). @param {Function} [callback] - A callback which is called after all the `iteratee` functions have finished, or an error occurs. Results is an array containing the concatenated results of the `iteratee` function. Invoked with (err, results). @returns A Promise, if no callback is passed
[ "The", "same", "as", "[", "concat", "]", "{", "@link", "module", ":", "Collections", ".", "concat", "}", "but", "runs", "a", "maximum", "of", "limit", "async", "operations", "at", "a", "time", "." ]
4330d536c106592139fa82062494c9dba0da1fdb
https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/lib/concatLimit.js#L25-L42
train
Concat a collection of tcube tables
[ 30522, 3853, 9530, 11266, 17960, 4183, 1006, 8902, 2140, 1010, 5787, 1010, 2009, 22139, 2063, 1010, 2655, 5963, 1007, 1063, 13075, 1035, 2009, 22139, 2063, 1027, 10236, 3022, 6038, 2278, 1006, 2009, 22139, 2063, 1007, 1025, 2709, 4949, 1796...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
TryGhost/Ghost
core/server/helpers/navigation.js
_isCurrentUrl
function _isCurrentUrl(href, currentUrl) { if (!currentUrl) { return false; } var strippedHref = href.replace(/\/+$/, ''), strippedCurrentUrl = currentUrl.replace(/\/+$/, ''); return strippedHref === strippedCurrentUrl; }
javascript
function _isCurrentUrl(href, currentUrl) { if (!currentUrl) { return false; } var strippedHref = href.replace(/\/+$/, ''), strippedCurrentUrl = currentUrl.replace(/\/+$/, ''); return strippedHref === strippedCurrentUrl; }
[ "function", "_isCurrentUrl", "(", "href", ",", "currentUrl", ")", "{", "if", "(", "!", "currentUrl", ")", "{", "return", "false", ";", "}", "var", "strippedHref", "=", "href", ".", "replace", "(", "/", "\\/+$", "/", ",", "''", ")", ",", "strippedCurren...
strips trailing slashes and compares urls
[ "strips", "trailing", "slashes", "and", "compares", "urls" ]
bb7bb55cf3e60af99ebbc56099928827b58461bc
https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/helpers/navigation.js#L53-L61
train
Check if the current url is the same as the href
[ 30522, 3853, 1035, 2003, 10841, 14343, 3372, 3126, 2140, 1006, 17850, 12879, 1010, 2783, 3126, 2140, 1007, 1063, 2065, 1006, 999, 2783, 3126, 2140, 1007, 1063, 2709, 6270, 1025, 1065, 13075, 10040, 28362, 2546, 1027, 17850, 12879, 1012, 567...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-echarts
src/component/tooltip/TooltipView.js
function (tooltipModel, ecModel, api, payload) { var seriesIndex = payload.seriesIndex; var dataIndex = payload.dataIndex; var coordSysAxesInfo = ecModel.getComponent('axisPointer').coordSysAxesInfo; if (seriesIndex == null || dataIndex == null || coordSysAxesInfo == null) { return; } var seriesModel = ecModel.getSeriesByIndex(seriesIndex); if (!seriesModel) { return; } var data = seriesModel.getData(); var tooltipModel = buildTooltipModel([ data.getItemModel(dataIndex), seriesModel, (seriesModel.coordinateSystem || {}).model, tooltipModel ]); if (tooltipModel.get('trigger') !== 'axis') { return; } api.dispatchAction({ type: 'updateAxisPointer', seriesIndex: seriesIndex, dataIndex: dataIndex, position: payload.position }); return true; }
javascript
function (tooltipModel, ecModel, api, payload) { var seriesIndex = payload.seriesIndex; var dataIndex = payload.dataIndex; var coordSysAxesInfo = ecModel.getComponent('axisPointer').coordSysAxesInfo; if (seriesIndex == null || dataIndex == null || coordSysAxesInfo == null) { return; } var seriesModel = ecModel.getSeriesByIndex(seriesIndex); if (!seriesModel) { return; } var data = seriesModel.getData(); var tooltipModel = buildTooltipModel([ data.getItemModel(dataIndex), seriesModel, (seriesModel.coordinateSystem || {}).model, tooltipModel ]); if (tooltipModel.get('trigger') !== 'axis') { return; } api.dispatchAction({ type: 'updateAxisPointer', seriesIndex: seriesIndex, dataIndex: dataIndex, position: payload.position }); return true; }
[ "function", "(", "tooltipModel", ",", "ecModel", ",", "api", ",", "payload", ")", "{", "var", "seriesIndex", "=", "payload", ".", "seriesIndex", ";", "var", "dataIndex", "=", "payload", ".", "dataIndex", ";", "var", "coordSysAxesInfo", "=", "ecModel", ".", ...
Be compatible with previous design, that is, when tooltip.type is 'axis' and dispatchAction 'showTip' with seriesIndex and dataIndex will trigger axis pointer and tooltip.
[ "Be", "compatible", "with", "previous", "design", "that", "is", "when", "tooltip", ".", "type", "is", "axis", "and", "dispatchAction", "showTip", "with", "seriesIndex", "and", "dataIndex", "will", "trigger", "axis", "pointer", "and", "tooltip", "." ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/tooltip/TooltipView.js#L272-L306
train
update axisPointer
[ 30522, 3853, 1006, 6994, 25101, 5302, 9247, 1010, 14925, 5302, 9247, 1010, 17928, 1010, 18093, 1007, 1063, 13075, 2186, 22254, 10288, 1027, 18093, 1012, 2186, 22254, 10288, 1025, 13075, 2951, 22254, 10288, 1027, 18093, 1012, 2951, 22254, 1028...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
firebase/firebase-js-sdk
packages/auth/demo/public/script.js
onReauthenticateWithEmailLink
function onReauthenticateWithEmailLink() { var email = $('#link-with-email-link-email').val(); var link = $('#link-with-email-link-link').val() || undefined; var credential = firebase.auth.EmailAuthProvider .credentialWithLink(email, link); activeUser().reauthenticateWithCredential(credential) .then(function(result) { logAdditionalUserInfo(result); refreshUserData(); alertSuccess('User reauthenticated!'); }, onAuthError); }
javascript
function onReauthenticateWithEmailLink() { var email = $('#link-with-email-link-email').val(); var link = $('#link-with-email-link-link').val() || undefined; var credential = firebase.auth.EmailAuthProvider .credentialWithLink(email, link); activeUser().reauthenticateWithCredential(credential) .then(function(result) { logAdditionalUserInfo(result); refreshUserData(); alertSuccess('User reauthenticated!'); }, onAuthError); }
[ "function", "onReauthenticateWithEmailLink", "(", ")", "{", "var", "email", "=", "$", "(", "'#link-with-email-link-email'", ")", ".", "val", "(", ")", ";", "var", "link", "=", "$", "(", "'#link-with-email-link-link'", ")", ".", "val", "(", ")", "||", "undefi...
Re-authenticate a user with email link credential.
[ "Re", "-", "authenticate", "a", "user", "with", "email", "link", "credential", "." ]
491598a499813dacc23724de5e237ec220cc560e
https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L355-L366
train
Reauthenticate with email link
[ 30522, 3853, 2006, 16416, 14317, 4765, 24695, 24415, 14545, 8591, 19839, 1006, 1007, 1063, 13075, 10373, 1027, 1002, 1006, 1005, 1001, 4957, 1011, 2007, 1011, 10373, 1011, 4957, 1011, 10373, 1005, 1007, 1012, 11748, 1006, 1007, 1025, 13075, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/editor/EditorStatusBar.js
_updateCursorInfo
function _updateCursorInfo(event, editor) { editor = editor || EditorManager.getActiveEditor(); // compute columns, account for tab size var cursor = editor.getCursorPos(true); var cursorStr = StringUtils.format(Strings.STATUSBAR_CURSOR_POSITION, cursor.line + 1, cursor.ch + 1); var sels = editor.getSelections(), selStr = ""; if (sels.length > 1) { //Send analytics data for multicursor use HealthLogger.sendAnalyticsData( "multiCursor", "usage", "multiCursor", "use" ); selStr = StringUtils.format(Strings.STATUSBAR_SELECTION_MULTIPLE, sels.length); } else if (editor.hasSelection()) { var sel = sels[0]; if (sel.start.line !== sel.end.line) { var lines = sel.end.line - sel.start.line + 1; if (sel.end.ch === 0) { lines--; // end line is exclusive if ch is 0, inclusive otherwise } selStr = _formatCountable(lines, Strings.STATUSBAR_SELECTION_LINE_SINGULAR, Strings.STATUSBAR_SELECTION_LINE_PLURAL); } else { var cols = editor.getColOffset(sel.end) - editor.getColOffset(sel.start); // end ch is exclusive always selStr = _formatCountable(cols, Strings.STATUSBAR_SELECTION_CH_SINGULAR, Strings.STATUSBAR_SELECTION_CH_PLURAL); } } $cursorInfo.text(cursorStr + selStr); }
javascript
function _updateCursorInfo(event, editor) { editor = editor || EditorManager.getActiveEditor(); // compute columns, account for tab size var cursor = editor.getCursorPos(true); var cursorStr = StringUtils.format(Strings.STATUSBAR_CURSOR_POSITION, cursor.line + 1, cursor.ch + 1); var sels = editor.getSelections(), selStr = ""; if (sels.length > 1) { //Send analytics data for multicursor use HealthLogger.sendAnalyticsData( "multiCursor", "usage", "multiCursor", "use" ); selStr = StringUtils.format(Strings.STATUSBAR_SELECTION_MULTIPLE, sels.length); } else if (editor.hasSelection()) { var sel = sels[0]; if (sel.start.line !== sel.end.line) { var lines = sel.end.line - sel.start.line + 1; if (sel.end.ch === 0) { lines--; // end line is exclusive if ch is 0, inclusive otherwise } selStr = _formatCountable(lines, Strings.STATUSBAR_SELECTION_LINE_SINGULAR, Strings.STATUSBAR_SELECTION_LINE_PLURAL); } else { var cols = editor.getColOffset(sel.end) - editor.getColOffset(sel.start); // end ch is exclusive always selStr = _formatCountable(cols, Strings.STATUSBAR_SELECTION_CH_SINGULAR, Strings.STATUSBAR_SELECTION_CH_PLURAL); } } $cursorInfo.text(cursorStr + selStr); }
[ "function", "_updateCursorInfo", "(", "event", ",", "editor", ")", "{", "editor", "=", "editor", "||", "EditorManager", ".", "getActiveEditor", "(", ")", ";", "// compute columns, account for tab size", "var", "cursor", "=", "editor", ".", "getCursorPos", "(", "tr...
Update cursor(s)/selection(s) information @param {Event} event (unused) @param {Editor} editor Current editor
[ "Update", "cursor", "(", "s", ")", "/", "selection", "(", "s", ")", "information" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/EditorStatusBar.js#L166-L200
train
Update cursor info
[ 30522, 3853, 1035, 10651, 10841, 25301, 6657, 14876, 1006, 2724, 1010, 3559, 1007, 1063, 3559, 1027, 3559, 1064, 1064, 3559, 24805, 4590, 1012, 2131, 19620, 2098, 15660, 1006, 1007, 1025, 1013, 1013, 24134, 7753, 1010, 4070, 2005, 21628, 29...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js
function (oImport) { var bIsFileValid = true; if (!oImport.hasOwnProperty("title")) { bIsFileValid = false; } if (!oImport.hasOwnProperty("selections")) { bIsFileValid = false; } else if (!Array.isArray(oImport.selections)) { bIsFileValid = false; } else { for (var i = 0; i < oImport.selections.length; i++) { var oRuleSelection = oImport.selections[i]; if (!oRuleSelection.hasOwnProperty("ruleId") || !oRuleSelection.hasOwnProperty("libName")) { bIsFileValid = false; break; } } } return bIsFileValid; }
javascript
function (oImport) { var bIsFileValid = true; if (!oImport.hasOwnProperty("title")) { bIsFileValid = false; } if (!oImport.hasOwnProperty("selections")) { bIsFileValid = false; } else if (!Array.isArray(oImport.selections)) { bIsFileValid = false; } else { for (var i = 0; i < oImport.selections.length; i++) { var oRuleSelection = oImport.selections[i]; if (!oRuleSelection.hasOwnProperty("ruleId") || !oRuleSelection.hasOwnProperty("libName")) { bIsFileValid = false; break; } } } return bIsFileValid; }
[ "function", "(", "oImport", ")", "{", "var", "bIsFileValid", "=", "true", ";", "if", "(", "!", "oImport", ".", "hasOwnProperty", "(", "\"title\"", ")", ")", "{", "bIsFileValid", "=", "false", ";", "}", "if", "(", "!", "oImport", ".", "hasOwnProperty", ...
Validates if the given import is in the correct format. @param {Object} oImport The preset object to import @return {boolean} Is the import data a valid rule preset file
[ "Validates", "if", "the", "given", "import", "is", "in", "the", "correct", "format", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/PresetsUtils.js#L139-L161
train
Checks if the import has a title and selections
[ 30522, 3853, 1006, 1051, 5714, 6442, 1007, 1063, 13075, 20377, 8873, 20414, 11475, 2094, 1027, 2995, 1025, 2065, 1006, 999, 1051, 5714, 6442, 1012, 2038, 12384, 21572, 4842, 3723, 1006, 1000, 2516, 1000, 1007, 1007, 1063, 20377, 8873, 20414...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
webpack/webpack
lib/node/NodeMainTemplateAsync.runtime.js
hotDownloadManifest
function hotDownloadManifest() { var filename = require("path").join(__dirname, $hotMainFilename$); return new Promise(function(resolve, reject) { require("fs").readFile(filename, "utf-8", function(err, content) { if (err) return resolve(); try { var update = JSON.parse(content); } catch (e) { return reject(e); } resolve(update); }); }); }
javascript
function hotDownloadManifest() { var filename = require("path").join(__dirname, $hotMainFilename$); return new Promise(function(resolve, reject) { require("fs").readFile(filename, "utf-8", function(err, content) { if (err) return resolve(); try { var update = JSON.parse(content); } catch (e) { return reject(e); } resolve(update); }); }); }
[ "function", "hotDownloadManifest", "(", ")", "{", "var", "filename", "=", "require", "(", "\"path\"", ")", ".", "join", "(", "__dirname", ",", "$hotMainFilename$", ")", ";", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "...
eslint-disable-next-line no-unused-vars
[ "eslint", "-", "disable", "-", "next", "-", "line", "no", "-", "unused", "-", "vars" ]
81cf088cd6a0231b94fa2399bd29294eccee1907
https://github.com/webpack/webpack/blob/81cf088cd6a0231b94fa2399bd29294eccee1907/lib/node/NodeMainTemplateAsync.runtime.js#L25-L38
train
Download the hot - main manifest
[ 30522, 3853, 2980, 7698, 11066, 20799, 14081, 1006, 1007, 1063, 13075, 5371, 18442, 1027, 5478, 1006, 1000, 4130, 1000, 1007, 1012, 3693, 1006, 1035, 1035, 16101, 18442, 1010, 1002, 2980, 24238, 8873, 20844, 4168, 1002, 1007, 1025, 2709, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
firebase/firebaseui-web
demo/public/app.js
handleConfigChange
function handleConfigChange() { var newRecaptchaValue = document.querySelector( 'input[name="recaptcha"]:checked').value; var newEmailSignInMethodValue = document.querySelector( 'input[name="emailSignInMethod"]:checked').value; location.replace( location.pathname + '#recaptcha=' + newRecaptchaValue + '&emailSignInMethod=' + newEmailSignInMethodValue); // Reset the inline widget so the config changes are reflected. ui.reset(); ui.start('#firebaseui-container', getUiConfig()); }
javascript
function handleConfigChange() { var newRecaptchaValue = document.querySelector( 'input[name="recaptcha"]:checked').value; var newEmailSignInMethodValue = document.querySelector( 'input[name="emailSignInMethod"]:checked').value; location.replace( location.pathname + '#recaptcha=' + newRecaptchaValue + '&emailSignInMethod=' + newEmailSignInMethodValue); // Reset the inline widget so the config changes are reflected. ui.reset(); ui.start('#firebaseui-container', getUiConfig()); }
[ "function", "handleConfigChange", "(", ")", "{", "var", "newRecaptchaValue", "=", "document", ".", "querySelector", "(", "'input[name=\"recaptcha\"]:checked'", ")", ".", "value", ";", "var", "newEmailSignInMethodValue", "=", "document", ".", "querySelector", "(", "'in...
Handles when the user changes the reCAPTCHA or email signInMethod config.
[ "Handles", "when", "the", "user", "changes", "the", "reCAPTCHA", "or", "email", "signInMethod", "config", "." ]
c10aa51e38aeb38dc63baa22b48cd6690c2be087
https://github.com/firebase/firebaseui-web/blob/c10aa51e38aeb38dc63baa22b48cd6690c2be087/demo/public/app.js#L190-L202
train
Handle the config change
[ 30522, 3853, 5047, 8663, 8873, 18195, 18003, 2063, 1006, 1007, 1063, 13075, 30524, 1012, 23032, 11246, 22471, 2953, 1006, 1005, 7953, 1031, 2171, 1027, 1000, 28667, 9331, 10649, 2050, 1000, 1033, 1024, 7039, 1005, 1007, 1012, 3643, 1025, 13...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
badges/shields
core/badge-urls/path-helpers.js
escapeFormat
function escapeFormat(t) { return ( t // Inline single underscore. .replace(/([^_])_([^_])/g, '$1 $2') // Leading or trailing underscore. .replace(/([^_])_$/, '$1 ') .replace(/^_([^_])/, ' $1') // Double underscore and double dash. .replace(/__/g, '_') .replace(/--/g, '-') ) }
javascript
function escapeFormat(t) { return ( t // Inline single underscore. .replace(/([^_])_([^_])/g, '$1 $2') // Leading or trailing underscore. .replace(/([^_])_$/, '$1 ') .replace(/^_([^_])/, ' $1') // Double underscore and double dash. .replace(/__/g, '_') .replace(/--/g, '-') ) }
[ "function", "escapeFormat", "(", "t", ")", "{", "return", "(", "t", "// Inline single underscore.", ".", "replace", "(", "/", "([^_])_([^_])", "/", "g", ",", "'$1 $2'", ")", "// Leading or trailing underscore.", ".", "replace", "(", "/", "([^_])_$", "/", ",", ...
Escapes `t` using the format specified in <https://github.com/espadrine/gh-badges/issues/12#issuecomment-31518129>
[ "Escapes", "t", "using", "the", "format", "specified", "in", "<https", ":", "//", "github", ".", "com", "/", "espadrine", "/", "gh", "-", "badges", "/", "issues", "/", "12#issuecomment", "-", "31518129", ">" ]
283601423f3d1a19aae83bf62032d40683948636
https://github.com/badges/shields/blob/283601423f3d1a19aae83bf62032d40683948636/core/badge-urls/path-helpers.js#L5-L17
train
Escape a format string
[ 30522, 3853, 4019, 14192, 4017, 1006, 1056, 1007, 1063, 2709, 1006, 1056, 1013, 1013, 23881, 2309, 2104, 9363, 2890, 1012, 1012, 5672, 1006, 1013, 1006, 1031, 1034, 1035, 1033, 1007, 1035, 1006, 1031, 1034, 1035, 1033, 1007, 1013, 1043, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
chartjs/Chart.js
src/core/core.tooltip.js
pushOrConcat
function pushOrConcat(base, toPush) { if (toPush) { if (helpers.isArray(toPush)) { // base = base.concat(toPush); Array.prototype.push.apply(base, toPush); } else { base.push(toPush); } } return base; }
javascript
function pushOrConcat(base, toPush) { if (toPush) { if (helpers.isArray(toPush)) { // base = base.concat(toPush); Array.prototype.push.apply(base, toPush); } else { base.push(toPush); } } return base; }
[ "function", "pushOrConcat", "(", "base", ",", "toPush", ")", "{", "if", "(", "toPush", ")", "{", "if", "(", "helpers", ".", "isArray", "(", "toPush", ")", ")", "{", "// base = base.concat(toPush);", "Array", ".", "prototype", ".", "push", ".", "apply", "...
Helper to push or concat based on if the 2nd parameter is an array or not
[ "Helper", "to", "push", "or", "concat", "based", "on", "if", "the", "2nd", "parameter", "is", "an", "array", "or", "not" ]
f093c36574d290330ed623e60fbd070421c730d5
https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/core/core.tooltip.js#L178-L189
train
push or concat to array
[ 30522, 3853, 5245, 2953, 8663, 11266, 1006, 2918, 1010, 2327, 20668, 1007, 1063, 2065, 1006, 2327, 20668, 1007, 1063, 2065, 1006, 2393, 2545, 1012, 18061, 11335, 2100, 1006, 2327, 20668, 1007, 1007, 1063, 1013, 1013, 2918, 1027, 2918, 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...
SeleniumHQ/selenium
javascript/node/selenium-webdriver/lib/error.js
throwDecodedError
function throwDecodedError(data) { if (isErrorResponse(data)) { let ctor = ERROR_CODE_TO_TYPE.get(data.error) || WebDriverError; let err = new ctor(data.message); // TODO(jleyba): remove whichever case is excluded from the final W3C spec. if (typeof data.stacktrace === 'string') { err.remoteStacktrace = data.stacktrace; } else if (typeof data.stackTrace === 'string') { err.remoteStacktrace = data.stackTrace; } throw err; } throw new WebDriverError('Unknown error: ' + JSON.stringify(data)); }
javascript
function throwDecodedError(data) { if (isErrorResponse(data)) { let ctor = ERROR_CODE_TO_TYPE.get(data.error) || WebDriverError; let err = new ctor(data.message); // TODO(jleyba): remove whichever case is excluded from the final W3C spec. if (typeof data.stacktrace === 'string') { err.remoteStacktrace = data.stacktrace; } else if (typeof data.stackTrace === 'string') { err.remoteStacktrace = data.stackTrace; } throw err; } throw new WebDriverError('Unknown error: ' + JSON.stringify(data)); }
[ "function", "throwDecodedError", "(", "data", ")", "{", "if", "(", "isErrorResponse", "(", "data", ")", ")", "{", "let", "ctor", "=", "ERROR_CODE_TO_TYPE", ".", "get", "(", "data", ".", "error", ")", "||", "WebDriverError", ";", "let", "err", "=", "new",...
Throws an error coded from the W3C protocol. A generic error will be thrown if the provided `data` is not a valid encoded error. @param {{error: string, message: string}} data The error data to decode. @throws {WebDriverError} the decoded error. @see https://w3c.github.io/webdriver/webdriver-spec.html#protocol
[ "Throws", "an", "error", "coded", "from", "the", "W3C", "protocol", ".", "A", "generic", "error", "will", "be", "thrown", "if", "the", "provided", "data", "is", "not", "a", "valid", "encoded", "error", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/error.js#L547-L560
train
Throw an error from the server
[ 30522, 3853, 5466, 3207, 16044, 4063, 29165, 1006, 2951, 1007, 1063, 2065, 1006, 2003, 2121, 29165, 6072, 26029, 3366, 1006, 2951, 1007, 1007, 1063, 2292, 14931, 2953, 1027, 7561, 1035, 3642, 1035, 2000, 1035, 2828, 1012, 2131, 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.demokit/src/sap/ui/demokit/demoapps/controller/App.controller.js
function (oEvent) { var oDownloadDialog = this.byId("downloadDialog"); this._oDownloadButton = oEvent.getSource(); oDownloadDialog.getBinding("items").filter([]); oDownloadDialog.open(); // hack: override of the SelectDialog's internal dialog height oDownloadDialog._oDialog.setContentHeight(""); }
javascript
function (oEvent) { var oDownloadDialog = this.byId("downloadDialog"); this._oDownloadButton = oEvent.getSource(); oDownloadDialog.getBinding("items").filter([]); oDownloadDialog.open(); // hack: override of the SelectDialog's internal dialog height oDownloadDialog._oDialog.setContentHeight(""); }
[ "function", "(", "oEvent", ")", "{", "var", "oDownloadDialog", "=", "this", ".", "byId", "(", "\"downloadDialog\"", ")", ";", "this", ".", "_oDownloadButton", "=", "oEvent", ".", "getSource", "(", ")", ";", "oDownloadDialog", ".", "getBinding", "(", "\"items...
/* =========================================================== /* event handlers /* =========================================================== Opens the download dialog @param {sap.ui.base.Event} oEvent the Button press event @public
[ "/", "*", "===========================================================", "/", "*", "event", "handlers", "/", "*", "===========================================================", "Opens", "the", "download", "dialog" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/demoapps/controller/App.controller.js#L32-L40
train
Opens the download dialog
[ 30522, 3853, 1006, 1051, 18697, 3372, 1007, 1063, 13075, 1051, 7698, 11066, 27184, 8649, 1027, 2023, 1012, 2011, 3593, 1006, 30524, 1025, 1051, 7698, 11066, 27184, 8649, 1012, 2330, 1006, 1007, 1025, 1013, 1013, 20578, 1024, 2058, 15637, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/search/FindBar.js
_handleKeydown
function _handleKeydown(e) { if (e.keyCode === KeyEvent.DOM_VK_ESCAPE) { e.stopPropagation(); e.preventDefault(); self.close(); } }
javascript
function _handleKeydown(e) { if (e.keyCode === KeyEvent.DOM_VK_ESCAPE) { e.stopPropagation(); e.preventDefault(); self.close(); } }
[ "function", "_handleKeydown", "(", "e", ")", "{", "if", "(", "e", ".", "keyCode", "===", "KeyEvent", ".", "DOM_VK_ESCAPE", ")", "{", "e", ".", "stopPropagation", "(", ")", ";", "e", ".", "preventDefault", "(", ")", ";", "self", ".", "close", "(", ")"...
Done this way because ModalBar.js seems to react unreliably when modifying it to handle the escape key - the findbar wasn't getting closed as it should, instead persisting in the background
[ "Done", "this", "way", "because", "ModalBar", ".", "js", "seems", "to", "react", "unreliably", "when", "modifying", "it", "to", "handle", "the", "escape", "key", "-", "the", "findbar", "wasn", "t", "getting", "closed", "as", "it", "should", "instead", "per...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindBar.js#L288-L294
train
handle keydown event
[ 30522, 3853, 1035, 5047, 14839, 7698, 1006, 1041, 1007, 1063, 2065, 1006, 1041, 1012, 3145, 16044, 1027, 1027, 1027, 3145, 18697, 3372, 1012, 14383, 1035, 1058, 2243, 1035, 4019, 1007, 1063, 1041, 1012, 2644, 21572, 4502, 12540, 1006, 1007,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
NG-ZORRO/ng-zorro-antd
scripts/publish/publish.js
changeVersion
function changeVersion() { log.info('Updating version number...'); const packageJsonPath = path.join(__dirname, '../../components/package.json'); const appComponentPath = path.join(__dirname, '../site/_site/doc/app/app.component.ts'); const codeBoxPath = path.join(__dirname, '../site/_site/doc/app/share/nz-codebox/stack-blitz.ts'); const zorroVersionPath = path.join(__dirname, '../../components/version.ts'); const packageJson = fs.readJsonSync(packageJsonPath); const currentVersion = packageJson.version; let versionNumberValid = false; let version; function parseVersion(version) { const matches = version.match(versionNameRegex); if (!matches) { return null; } return { major : Number(matches[1]), minor : Number(matches[2]), patch : Number(matches[3]), preTag: matches[4], pre : Number(matches[5]), } } function checkVersionNumber(cur, next) { // Must be numbers and dots. if (!versionNameRegex.test(next)) { return false; } const curVersion = parseVersion(cur); const nextVersion = parseVersion(next); for (const k of ['major', 'minor', 'patch']) { if (curVersion[k] < nextVersion[k]) { return true; } if (curVersion[k] > nextVersion[k]) { return false; } } if (curVersion.preTag !== nextVersion.preTag) { return true; } return curVersion.pre < nextVersion.pre } while (!versionNumberValid) { version = read.question(chalk.bgYellow.black('Please input the new version:') + ' '); if (checkVersionNumber(currentVersion, version)) { versionNumberValid = true; nextVersion = version; } else { log.error(`Your input ${version} is not after the current version ${currentVersion} or is unvalid. Please check it.`); } } fs.writeJsonSync(packageJsonPath, {...packageJson, version: version}, {spaces: 2}); fs.writeFileSync(appComponentPath, fs.readFileSync(appComponentPath, 'utf-8') .replace(/currentVersion = '.+';/g, `currentVersion = '${version}';`) ); fs.writeFileSync(codeBoxPath, fs.readFileSync(codeBoxPath, 'utf-8').replace(/'ng-zorro-antd'\s*: '.+'/g, `'ng-zorro-antd': '^${version}'`) ); fs.writeFileSync(zorroVersionPath, fs.readFileSync(zorroVersionPath, 'utf-8') .replace(/Version\('.+'\);/g, `Version('${version}');`) ); log.success('Version updated!'); }
javascript
function changeVersion() { log.info('Updating version number...'); const packageJsonPath = path.join(__dirname, '../../components/package.json'); const appComponentPath = path.join(__dirname, '../site/_site/doc/app/app.component.ts'); const codeBoxPath = path.join(__dirname, '../site/_site/doc/app/share/nz-codebox/stack-blitz.ts'); const zorroVersionPath = path.join(__dirname, '../../components/version.ts'); const packageJson = fs.readJsonSync(packageJsonPath); const currentVersion = packageJson.version; let versionNumberValid = false; let version; function parseVersion(version) { const matches = version.match(versionNameRegex); if (!matches) { return null; } return { major : Number(matches[1]), minor : Number(matches[2]), patch : Number(matches[3]), preTag: matches[4], pre : Number(matches[5]), } } function checkVersionNumber(cur, next) { // Must be numbers and dots. if (!versionNameRegex.test(next)) { return false; } const curVersion = parseVersion(cur); const nextVersion = parseVersion(next); for (const k of ['major', 'minor', 'patch']) { if (curVersion[k] < nextVersion[k]) { return true; } if (curVersion[k] > nextVersion[k]) { return false; } } if (curVersion.preTag !== nextVersion.preTag) { return true; } return curVersion.pre < nextVersion.pre } while (!versionNumberValid) { version = read.question(chalk.bgYellow.black('Please input the new version:') + ' '); if (checkVersionNumber(currentVersion, version)) { versionNumberValid = true; nextVersion = version; } else { log.error(`Your input ${version} is not after the current version ${currentVersion} or is unvalid. Please check it.`); } } fs.writeJsonSync(packageJsonPath, {...packageJson, version: version}, {spaces: 2}); fs.writeFileSync(appComponentPath, fs.readFileSync(appComponentPath, 'utf-8') .replace(/currentVersion = '.+';/g, `currentVersion = '${version}';`) ); fs.writeFileSync(codeBoxPath, fs.readFileSync(codeBoxPath, 'utf-8').replace(/'ng-zorro-antd'\s*: '.+'/g, `'ng-zorro-antd': '^${version}'`) ); fs.writeFileSync(zorroVersionPath, fs.readFileSync(zorroVersionPath, 'utf-8') .replace(/Version\('.+'\);/g, `Version('${version}');`) ); log.success('Version updated!'); }
[ "function", "changeVersion", "(", ")", "{", "log", ".", "info", "(", "'Updating version number...'", ")", ";", "const", "packageJsonPath", "=", "path", ".", "join", "(", "__dirname", ",", "'../../components/package.json'", ")", ";", "const", "appComponentPath", "=...
publish(); Publisher should input the new version number. This script would check if the input is valid.
[ "publish", "()", ";", "Publisher", "should", "input", "the", "new", "version", "number", ".", "This", "script", "would", "check", "if", "the", "input", "is", "valid", "." ]
b0f353cbf15682b437a819a8721b34aacaa9e3e1
https://github.com/NG-ZORRO/ng-zorro-antd/blob/b0f353cbf15682b437a819a8721b34aacaa9e3e1/scripts/publish/publish.js#L42-L120
train
Updates the version number of the current package. json file.
[ 30522, 3853, 2689, 27774, 1006, 1007, 1063, 8833, 1012, 18558, 1006, 1005, 2039, 16616, 2544, 2193, 1012, 1012, 1012, 1005, 1007, 1025, 9530, 3367, 7427, 22578, 2239, 15069, 1027, 4130, 1012, 3693, 1006, 1035, 1035, 16101, 18442, 1010, 1005...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
openlayers/openlayers
src/ol/control/FullScreen.js
requestFullScreen
function requestFullScreen(element) { if (element.requestFullscreen) { element.requestFullscreen(); } else if (element.msRequestFullscreen) { element.msRequestFullscreen(); } else if (element.webkitRequestFullscreen) { element.webkitRequestFullscreen(); } }
javascript
function requestFullScreen(element) { if (element.requestFullscreen) { element.requestFullscreen(); } else if (element.msRequestFullscreen) { element.msRequestFullscreen(); } else if (element.webkitRequestFullscreen) { element.webkitRequestFullscreen(); } }
[ "function", "requestFullScreen", "(", "element", ")", "{", "if", "(", "element", ".", "requestFullscreen", ")", "{", "element", ".", "requestFullscreen", "(", ")", ";", "}", "else", "if", "(", "element", ".", "msRequestFullscreen", ")", "{", "element", ".", ...
Request to fullscreen an element. @param {HTMLElement} element Element to request fullscreen
[ "Request", "to", "fullscreen", "an", "element", "." ]
f366eaea522388fb575b11010e69d309164baca7
https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/control/FullScreen.js#L230-L238
train
Request fullscreen of an element
[ 30522, 3853, 5227, 3993, 4877, 24410, 1006, 5783, 1007, 1063, 2065, 1006, 5783, 1012, 5227, 3993, 4877, 24410, 1007, 1063, 5783, 1012, 5227, 3993, 4877, 24410, 1006, 1007, 1025, 1065, 2842, 2065, 1006, 5783, 1012, 5796, 2890, 15500, 3993, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jhipster/generator-jhipster
generators/cleanup.js
cleanupOldServerFiles
function cleanupOldServerFiles(generator, javaDir, testDir, mainResourceDir, testResourceDir) { if (generator.isJhipsterVersionLessThan('3.5.0')) { generator.removeFile(`${javaDir}domain/util/JSR310DateTimeSerializer.java`); generator.removeFile(`${javaDir}domain/util/JSR310LocalDateDeserializer.java`); } if (generator.isJhipsterVersionLessThan('3.6.0')) { generator.removeFile(`${javaDir}config/HerokuDatabaseConfiguration.java`); } if (generator.isJhipsterVersionLessThan('3.10.0')) { generator.removeFile(`${javaDir}config/CloudMongoDbConfiguration.java`); generator.removeFile(`${javaDir}security/CustomAccessDeniedHandler.java`); generator.removeFile(`${javaDir}web/filter/CsrfCookieGeneratorFilter.java`); } if (generator.isJhipsterVersionLessThan('3.11.0')) { generator.removeFile(`${CLIENT_MAIN_SRC_DIR}app/layouts/navbar/active-link.directive.js`); } if (generator.isJhipsterVersionLessThan('3.12.0')) { generator.removeFile(`${javaDir}config/hazelcast/HazelcastCacheRegionFactory.java`); generator.removeFile(`${javaDir}config/hazelcast/package-info.java`); } if (generator.isJhipsterVersionLessThan('4.0.0')) { generator.removeFile(`${javaDir}async/ExceptionHandlingAsyncTaskExecutor.java`); generator.removeFile(`${javaDir}async/package-info.java`); generator.removeFile(`${javaDir}config/jHipsterProperties.java`); generator.removeFile(`${javaDir}config/LoadBalancedResourceDetails.java`); generator.removeFile(`${javaDir}config/ElasticSearchConfiguration.java`); generator.removeFile(`${javaDir}config/apidoc/package-info.java`); generator.removeFile(`${javaDir}config/apidoc/PageableParameterBuilderPlugin.java`); generator.removeFile(`${javaDir}config/apidoc/SwaggerConfiguration.java`); generator.removeFile(`${javaDir}config/jcache/SpringCacheRegionFactory.java`); generator.removeFile(`${javaDir}config/jcache/SpringCacheRegionFactory.java`); generator.removeFile(`${javaDir}config/liquibase/AsyncSpringLiquibase.java`); generator.removeFile(`${javaDir}config/liquibase/package-info.java`); generator.removeFile(`${javaDir}config/locale/AngularCookieLocaleResolver.java`); generator.removeFile(`${javaDir}config/locale/package-info.java`); generator.removeFile(`${javaDir}domain/util/FixedH2Dialect.java`); generator.removeFile(`${javaDir}domain/util/FixedPostgreSQL82Dialect`); generator.removeFile(`${javaDir}domain/util/JSR310DateConverters.java`); generator.removeFile(`${javaDir}domain/util/JSR310PersistenceConverters.java`); generator.removeFile(`${javaDir}security/AjaxAuthenticationFailureHandler.java`); generator.removeFile(`${javaDir}security/AjaxAuthenticationSuccessHandler.java`); generator.removeFile(`${javaDir}security/AjaxLogoutSuccessHandler.java`); generator.removeFile(`${javaDir}security/CustomPersistentRememberMeServices.java`); generator.removeFile(`${javaDir}security/Http401UnauthorizedEntryPoint.java`); generator.removeFile(`${javaDir}security/UserDetailsService.java`); generator.removeFile(`${javaDir}web/filter/CachingHttpHeadersFilter.java`); generator.removeFile(`${javaDir}web/filter/package-info.java`); } if (generator.isJhipsterVersionLessThan('4.3.0')) { generator.removeFile(`${javaDir}gateway/ratelimiting/RateLimitingRepository.java`); generator.removeFile(`${javaDir}config/cassandra/CustomZonedDateTimeCodec.java`); } if (generator.isJhipsterVersionLessThan('4.7.1')) { generator.removeFile(`${javaDir}web/rest/errors/ErrorVM.java`); generator.removeFile(`${javaDir}web/rest/errors/ParameterizedErrorVM.java`); } if (generator.isJhipsterVersionLessThan('4.11.1')) { generator.removeFile(`${CLIENT_MAIN_SRC_DIR}app/app.main-aot.ts`); } if (generator.isJhipsterVersionLessThan('4.13.1')) { generator.config.delete('hibernateCache'); } if (generator.isJhipsterVersionLessThan('5.0.0')) { generator.removeFile(`${javaDir}config/ThymeleafConfiguration.java`); generator.removeFile(`${javaDir}web/rest/ProfileInfoResource.java`); generator.removeFile(`${mainResourceDir}mails/activationEmail.html`); generator.removeFile(`${mainResourceDir}mails/creationEmail.html`); generator.removeFile(`${mainResourceDir}mails/passwordResetEmail.html`); generator.removeFile(`${mainResourceDir}mails/socialRegistrationValidationEmail.html`); generator.removeFile(`${testResourceDir}mail/testEmail.html`); generator.removeFile(`${testDir}web/rest/ProfileInfoResourceIT.java`); generator.removeFile('gradle/mapstruct.gradle'); } if (generator.isJhipsterVersionLessThan('5.2.2')) { generator.removeFile(`${javaDir}config/ElasticsearchConfiguration.java`); generator.removeFile('gradle/liquibase.gradle'); if (generator.authenticationType === 'oauth2' && generator.applicationType === 'microservice') { generator.removeFolder(`${constants.DOCKER_DIR}realm-config`); generator.removeFile(`${constants.DOCKER_DIR}keycloak.yml`); } } if (generator.isJhipsterVersionLessThan('5.8.0')) { generator.removeFile(`${javaDir}config/MetricsConfiguration.java`); if (generator.databaseType === 'cassandra') { generator.removeFile(`${testResourceDir}cassandra-random-port.yml`); } } if (generator.isJhipsterVersionLessThan('6.0.0')) { generator.removeFile(`${javaDir}web/rest/errors/CustomParameterizedException.java`); generator.removeFile(`${javaDir}web/rest/errors/InternalServerErrorException.java`); generator.removeFile(`${javaDir}web/rest/util/PaginationUtil.java`); generator.removeFile(`${javaDir}web/rest/util/HeaderUtil.java`); generator.removeFile(`${testDir}web/rest/util/PaginationUtilUnitTest.java`); generator.removeFile(`${javaDir}web/rest/vm/LoggerVM.java`); generator.removeFile(`${javaDir}web/rest/LogsResource.java`); generator.removeFile(`${testDir}web/rest/LogsResourceIT.java`); generator.removeFile(`${javaDir}config/OAuth2Configuration.java`); generator.removeFile(`${javaDir}security/OAuth2AuthenticationSuccessHandler.java`); generator.removeFolder(`${CLIENT_MAIN_SRC_DIR}app/shared/layout/header/menus`); generator.removeFolder(`${CLIENT_TEST_SRC_DIR}spec/app/shared/layout/header/menus`); } }
javascript
function cleanupOldServerFiles(generator, javaDir, testDir, mainResourceDir, testResourceDir) { if (generator.isJhipsterVersionLessThan('3.5.0')) { generator.removeFile(`${javaDir}domain/util/JSR310DateTimeSerializer.java`); generator.removeFile(`${javaDir}domain/util/JSR310LocalDateDeserializer.java`); } if (generator.isJhipsterVersionLessThan('3.6.0')) { generator.removeFile(`${javaDir}config/HerokuDatabaseConfiguration.java`); } if (generator.isJhipsterVersionLessThan('3.10.0')) { generator.removeFile(`${javaDir}config/CloudMongoDbConfiguration.java`); generator.removeFile(`${javaDir}security/CustomAccessDeniedHandler.java`); generator.removeFile(`${javaDir}web/filter/CsrfCookieGeneratorFilter.java`); } if (generator.isJhipsterVersionLessThan('3.11.0')) { generator.removeFile(`${CLIENT_MAIN_SRC_DIR}app/layouts/navbar/active-link.directive.js`); } if (generator.isJhipsterVersionLessThan('3.12.0')) { generator.removeFile(`${javaDir}config/hazelcast/HazelcastCacheRegionFactory.java`); generator.removeFile(`${javaDir}config/hazelcast/package-info.java`); } if (generator.isJhipsterVersionLessThan('4.0.0')) { generator.removeFile(`${javaDir}async/ExceptionHandlingAsyncTaskExecutor.java`); generator.removeFile(`${javaDir}async/package-info.java`); generator.removeFile(`${javaDir}config/jHipsterProperties.java`); generator.removeFile(`${javaDir}config/LoadBalancedResourceDetails.java`); generator.removeFile(`${javaDir}config/ElasticSearchConfiguration.java`); generator.removeFile(`${javaDir}config/apidoc/package-info.java`); generator.removeFile(`${javaDir}config/apidoc/PageableParameterBuilderPlugin.java`); generator.removeFile(`${javaDir}config/apidoc/SwaggerConfiguration.java`); generator.removeFile(`${javaDir}config/jcache/SpringCacheRegionFactory.java`); generator.removeFile(`${javaDir}config/jcache/SpringCacheRegionFactory.java`); generator.removeFile(`${javaDir}config/liquibase/AsyncSpringLiquibase.java`); generator.removeFile(`${javaDir}config/liquibase/package-info.java`); generator.removeFile(`${javaDir}config/locale/AngularCookieLocaleResolver.java`); generator.removeFile(`${javaDir}config/locale/package-info.java`); generator.removeFile(`${javaDir}domain/util/FixedH2Dialect.java`); generator.removeFile(`${javaDir}domain/util/FixedPostgreSQL82Dialect`); generator.removeFile(`${javaDir}domain/util/JSR310DateConverters.java`); generator.removeFile(`${javaDir}domain/util/JSR310PersistenceConverters.java`); generator.removeFile(`${javaDir}security/AjaxAuthenticationFailureHandler.java`); generator.removeFile(`${javaDir}security/AjaxAuthenticationSuccessHandler.java`); generator.removeFile(`${javaDir}security/AjaxLogoutSuccessHandler.java`); generator.removeFile(`${javaDir}security/CustomPersistentRememberMeServices.java`); generator.removeFile(`${javaDir}security/Http401UnauthorizedEntryPoint.java`); generator.removeFile(`${javaDir}security/UserDetailsService.java`); generator.removeFile(`${javaDir}web/filter/CachingHttpHeadersFilter.java`); generator.removeFile(`${javaDir}web/filter/package-info.java`); } if (generator.isJhipsterVersionLessThan('4.3.0')) { generator.removeFile(`${javaDir}gateway/ratelimiting/RateLimitingRepository.java`); generator.removeFile(`${javaDir}config/cassandra/CustomZonedDateTimeCodec.java`); } if (generator.isJhipsterVersionLessThan('4.7.1')) { generator.removeFile(`${javaDir}web/rest/errors/ErrorVM.java`); generator.removeFile(`${javaDir}web/rest/errors/ParameterizedErrorVM.java`); } if (generator.isJhipsterVersionLessThan('4.11.1')) { generator.removeFile(`${CLIENT_MAIN_SRC_DIR}app/app.main-aot.ts`); } if (generator.isJhipsterVersionLessThan('4.13.1')) { generator.config.delete('hibernateCache'); } if (generator.isJhipsterVersionLessThan('5.0.0')) { generator.removeFile(`${javaDir}config/ThymeleafConfiguration.java`); generator.removeFile(`${javaDir}web/rest/ProfileInfoResource.java`); generator.removeFile(`${mainResourceDir}mails/activationEmail.html`); generator.removeFile(`${mainResourceDir}mails/creationEmail.html`); generator.removeFile(`${mainResourceDir}mails/passwordResetEmail.html`); generator.removeFile(`${mainResourceDir}mails/socialRegistrationValidationEmail.html`); generator.removeFile(`${testResourceDir}mail/testEmail.html`); generator.removeFile(`${testDir}web/rest/ProfileInfoResourceIT.java`); generator.removeFile('gradle/mapstruct.gradle'); } if (generator.isJhipsterVersionLessThan('5.2.2')) { generator.removeFile(`${javaDir}config/ElasticsearchConfiguration.java`); generator.removeFile('gradle/liquibase.gradle'); if (generator.authenticationType === 'oauth2' && generator.applicationType === 'microservice') { generator.removeFolder(`${constants.DOCKER_DIR}realm-config`); generator.removeFile(`${constants.DOCKER_DIR}keycloak.yml`); } } if (generator.isJhipsterVersionLessThan('5.8.0')) { generator.removeFile(`${javaDir}config/MetricsConfiguration.java`); if (generator.databaseType === 'cassandra') { generator.removeFile(`${testResourceDir}cassandra-random-port.yml`); } } if (generator.isJhipsterVersionLessThan('6.0.0')) { generator.removeFile(`${javaDir}web/rest/errors/CustomParameterizedException.java`); generator.removeFile(`${javaDir}web/rest/errors/InternalServerErrorException.java`); generator.removeFile(`${javaDir}web/rest/util/PaginationUtil.java`); generator.removeFile(`${javaDir}web/rest/util/HeaderUtil.java`); generator.removeFile(`${testDir}web/rest/util/PaginationUtilUnitTest.java`); generator.removeFile(`${javaDir}web/rest/vm/LoggerVM.java`); generator.removeFile(`${javaDir}web/rest/LogsResource.java`); generator.removeFile(`${testDir}web/rest/LogsResourceIT.java`); generator.removeFile(`${javaDir}config/OAuth2Configuration.java`); generator.removeFile(`${javaDir}security/OAuth2AuthenticationSuccessHandler.java`); generator.removeFolder(`${CLIENT_MAIN_SRC_DIR}app/shared/layout/header/menus`); generator.removeFolder(`${CLIENT_TEST_SRC_DIR}spec/app/shared/layout/header/menus`); } }
[ "function", "cleanupOldServerFiles", "(", "generator", ",", "javaDir", ",", "testDir", ",", "mainResourceDir", ",", "testResourceDir", ")", "{", "if", "(", "generator", ".", "isJhipsterVersionLessThan", "(", "'3.5.0'", ")", ")", "{", "generator", ".", "removeFile"...
Removes server files that where generated in previous JHipster versions and therefore need to be removed. @param {any} generator - reference to generator @param {string} javaDir - Java directory @param {string} testDir - Java tests directory @param {string} mainResourceDir - Main resources directory @param {string} testResourceDir - Test resources directory
[ "Removes", "server", "files", "that", "where", "generated", "in", "previous", "JHipster", "versions", "and", "therefore", "need", "to", "be", "removed", "." ]
f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff
https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/cleanup.js#L90-L193
train
Removes old server files
[ 30522, 3853, 27686, 11614, 8043, 6299, 8873, 4244, 1006, 13103, 1010, 9262, 4305, 2099, 1010, 3231, 4305, 2099, 1010, 2364, 6072, 8162, 11788, 4313, 1010, 3231, 6072, 8162, 11788, 4313, 1007, 1063, 2065, 1006, 13103, 1012, 2003, 3501, 19801...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
function (elem, elemName, func) { var i, childNode; for (i = 0; i < elem.childNodes.length; i++) { childNode = elem.childNodes[i]; if (childNode.nodeType == Strophe.ElementType.NORMAL && (!elemName || this.isTagEqual(childNode, elemName))) { func(childNode); } } }
javascript
function (elem, elemName, func) { var i, childNode; for (i = 0; i < elem.childNodes.length; i++) { childNode = elem.childNodes[i]; if (childNode.nodeType == Strophe.ElementType.NORMAL && (!elemName || this.isTagEqual(childNode, elemName))) { func(childNode); } } }
[ "function", "(", "elem", ",", "elemName", ",", "func", ")", "{", "var", "i", ",", "childNode", ";", "for", "(", "i", "=", "0", ";", "i", "<", "elem", ".", "childNodes", ".", "length", ";", "i", "++", ")", "{", "childNode", "=", "elem", ".", "ch...
Function: forEachChild Map a function over some or all child elements of a given element. This is a small convenience function for mapping a function over some or all of the children of an element. If elemName is null, all children will be passed to the function, otherwise only children whose tag names match elemName will be passed. Parameters: (XMLElement) elem - The element to operate on. (String) elemName - The child element tag name filter. (Function) func - The function to apply to each child. This function should take a single argument, a DOM element.
[ "Function", ":", "forEachChild", "Map", "a", "function", "over", "some", "or", "all", "child", "elements", "of", "a", "given", "element", "." ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L871-L882
train
Private function to call func for each node in the tree
[ 30522, 3853, 1006, 3449, 6633, 1010, 3449, 6633, 18442, 1010, 4569, 2278, 1007, 1063, 13075, 1045, 1010, 2775, 3630, 3207, 1025, 2005, 1006, 1045, 1027, 1014, 1025, 1045, 1026, 3449, 6633, 1012, 2775, 3630, 6155, 1012, 3091, 1025, 1045, 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/key-spacing.js
getPropertyWhitespace
function getPropertyWhitespace(property) { const whitespace = /(\s*):(\s*)/u.exec(sourceCode.getText().slice( property.key.range[1], property.value.range[0] )); if (whitespace) { return { beforeColon: whitespace[1], afterColon: whitespace[2] }; } return null; }
javascript
function getPropertyWhitespace(property) { const whitespace = /(\s*):(\s*)/u.exec(sourceCode.getText().slice( property.key.range[1], property.value.range[0] )); if (whitespace) { return { beforeColon: whitespace[1], afterColon: whitespace[2] }; } return null; }
[ "function", "getPropertyWhitespace", "(", "property", ")", "{", "const", "whitespace", "=", "/", "(\\s*):(\\s*)", "/", "u", ".", "exec", "(", "sourceCode", ".", "getText", "(", ")", ".", "slice", "(", "property", ".", "key", ".", "range", "[", "1", "]", ...
Gets the whitespace around the colon in an object literal property. @param {ASTNode} property Property node from an object literal. @returns {Object} Whitespace before and after the property's colon.
[ "Gets", "the", "whitespace", "around", "the", "colon", "in", "an", "object", "literal", "property", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/key-spacing.js#L503-L515
train
Get whitespace from property
[ 30522, 3853, 2131, 21572, 4842, 3723, 2860, 16584, 2229, 15327, 1006, 3200, 1007, 1063, 9530, 3367, 12461, 15327, 1027, 1013, 1006, 1032, 1055, 1008, 1007, 1024, 1006, 1032, 1055, 1008, 1007, 1013, 1057, 1012, 4654, 8586, 1006, 3120, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/qunit/utils/MemoryLeakCheck.js
function(oControl) { var mProperties = oControl.getMetadata().getAllProperties(); for (var sPropertyName in mProperties) { if (oControl.isPropertyInitial(sPropertyName)) { // if no value has been set yet by the control factory var oProperty = mProperties[sPropertyName]; try { oControl[oProperty._sMutator]("dummyValueForMemLeakTest"); // just try a string for everything now, TODO: check type } catch (e) { // type check error, ignore (we stupidly always try with a string, even if the property has a different type) } } } if (!oControl.getTooltip()) { oControl.setTooltip("test"); // seems not to be a property... } }
javascript
function(oControl) { var mProperties = oControl.getMetadata().getAllProperties(); for (var sPropertyName in mProperties) { if (oControl.isPropertyInitial(sPropertyName)) { // if no value has been set yet by the control factory var oProperty = mProperties[sPropertyName]; try { oControl[oProperty._sMutator]("dummyValueForMemLeakTest"); // just try a string for everything now, TODO: check type } catch (e) { // type check error, ignore (we stupidly always try with a string, even if the property has a different type) } } } if (!oControl.getTooltip()) { oControl.setTooltip("test"); // seems not to be a property... } }
[ "function", "(", "oControl", ")", "{", "var", "mProperties", "=", "oControl", ".", "getMetadata", "(", ")", ".", "getAllProperties", "(", ")", ";", "for", "(", "var", "sPropertyName", "in", "mProperties", ")", "{", "if", "(", "oControl", ".", "isPropertyIn...
tries to fill all control properties with string values (hoping this might trigger more leaks)
[ "tries", "to", "fill", "all", "control", "properties", "with", "string", "values", "(", "hoping", "this", "might", "trigger", "more", "leaks", ")" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/qunit/utils/MemoryLeakCheck.js#L57-L73
train
sets the tooltip of the control
[ 30522, 3853, 1006, 1051, 8663, 13181, 2140, 1007, 1063, 30524, 1006, 1051, 8663, 13181, 2140, 1012, 2003, 21572, 4842, 3723, 5498, 20925, 1006, 11867, 18981, 15010, 18442, 1007, 1007, 1063, 1013, 1013, 2065, 2053, 3643, 2038, 2042, 2275, 26...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
Makefile.js
generateFormatterExamples
function generateFormatterExamples(formatterInfo, prereleaseVersion) { const output = ejs.render(cat("./templates/formatter-examples.md.ejs"), formatterInfo); let filename = "../eslint.github.io/docs/user-guide/formatters/index.md", htmlFilename = "../eslint.github.io/docs/user-guide/formatters/html-formatter-example.html"; if (prereleaseVersion) { filename = filename.replace("/docs", `/docs/${prereleaseVersion}`); htmlFilename = htmlFilename.replace("/docs", `/docs/${prereleaseVersion}`); if (!test("-d", path.dirname(filename))) { mkdir(path.dirname(filename)); } } output.to(filename); formatterInfo.formatterResults.html.result.to(htmlFilename); }
javascript
function generateFormatterExamples(formatterInfo, prereleaseVersion) { const output = ejs.render(cat("./templates/formatter-examples.md.ejs"), formatterInfo); let filename = "../eslint.github.io/docs/user-guide/formatters/index.md", htmlFilename = "../eslint.github.io/docs/user-guide/formatters/html-formatter-example.html"; if (prereleaseVersion) { filename = filename.replace("/docs", `/docs/${prereleaseVersion}`); htmlFilename = htmlFilename.replace("/docs", `/docs/${prereleaseVersion}`); if (!test("-d", path.dirname(filename))) { mkdir(path.dirname(filename)); } } output.to(filename); formatterInfo.formatterResults.html.result.to(htmlFilename); }
[ "function", "generateFormatterExamples", "(", "formatterInfo", ",", "prereleaseVersion", ")", "{", "const", "output", "=", "ejs", ".", "render", "(", "cat", "(", "\"./templates/formatter-examples.md.ejs\"", ")", ",", "formatterInfo", ")", ";", "let", "filename", "="...
Generates a doc page with formatter result examples @param {Object} formatterInfo Linting results from each formatter @param {string} [prereleaseVersion] The version used for a prerelease. This changes where the output is stored. @returns {void}
[ "Generates", "a", "doc", "page", "with", "formatter", "result", "examples" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/Makefile.js#L155-L170
train
Generates formatter examples
[ 30522, 3853, 9699, 14192, 20097, 10288, 16613, 4244, 1006, 4289, 3334, 2378, 14876, 1010, 3653, 16570, 19500, 27774, 1007, 1063, 9530, 3367, 6434, 1027, 1041, 22578, 1012, 17552, 1006, 30524, 9686, 4115, 2102, 1012, 21025, 2705, 12083, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nhn/tui.editor
src/js/wysiwygCommands/tableAddRow.js
getNewRow
function getNewRow($tr) { const cloned = $tr.clone(); const htmlString = util.browser.msie ? '' : '<br />'; cloned.find('td').html(htmlString); return cloned; }
javascript
function getNewRow($tr) { const cloned = $tr.clone(); const htmlString = util.browser.msie ? '' : '<br />'; cloned.find('td').html(htmlString); return cloned; }
[ "function", "getNewRow", "(", "$tr", ")", "{", "const", "cloned", "=", "$tr", ".", "clone", "(", ")", ";", "const", "htmlString", "=", "util", ".", "browser", ".", "msie", "?", "''", ":", "'<br />'", ";", "cloned", ".", "find", "(", "'td'", ")", "....
Get new row of given row @param {jQuery} $tr - jQuery wrapped table row @returns {jQuery} - new cloned jquery element @ignore
[ "Get", "new", "row", "of", "given", "row" ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableAddRow.js#L80-L87
train
Get a new row
[ 30522, 3853, 2131, 2638, 13088, 5004, 1006, 1002, 19817, 1007, 1063, 9530, 3367, 17598, 2094, 1027, 1002, 19817, 1012, 17598, 1006, 1007, 1025, 9530, 3367, 16129, 3367, 4892, 1027, 21183, 4014, 1012, 16602, 1012, 5796, 2666, 1029, 1005, 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...
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
function () { var bodyWrap = $build('body', { rid: this.rid++, xmlns: Strophe.NS.HTTPBIND }); if (this.sid !== null) { bodyWrap.attrs({sid: this.sid}); } return bodyWrap; }
javascript
function () { var bodyWrap = $build('body', { rid: this.rid++, xmlns: Strophe.NS.HTTPBIND }); if (this.sid !== null) { bodyWrap.attrs({sid: this.sid}); } return bodyWrap; }
[ "function", "(", ")", "{", "var", "bodyWrap", "=", "$build", "(", "'body'", ",", "{", "rid", ":", "this", ".", "rid", "++", ",", "xmlns", ":", "Strophe", ".", "NS", ".", "HTTPBIND", "}", ")", ";", "if", "(", "this", ".", "sid", "!==", "null", "...
PrivateFunction: _buildBody _Private_ helper function to generate the <body/> wrapper for BOSH. Returns: A Strophe.Builder with a <body/> element.
[ "PrivateFunction", ":", "_buildBody", "_Private_", "helper", "function", "to", "generate", "the", "<body", "/", ">", "wrapper", "for", "BOSH", "." ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L4036-L4048
train
Creates a body wrapper for the
[ 30522, 3853, 1006, 1007, 1063, 13075, 2303, 13088, 9331, 1027, 1002, 3857, 1006, 1005, 2303, 1005, 1010, 1063, 9436, 1024, 2023, 1012, 9436, 1009, 1009, 1010, 20950, 3619, 1024, 2358, 18981, 5369, 1012, 24978, 1012, 8299, 8428, 2094, 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...
fex-team/webuploader
dist/webuploader.withoutimage.js
function() { var orders = this.options.runtimeOrder || Runtime.orders, type = this.type, i, len; if ( !type ) { orders = orders.split( /\s*,\s*/g ); for ( i = 0, len = orders.length; i < len; i++ ) { if ( Runtime.hasRuntime( orders[ i ] ) ) { this.type = type = orders[ i ]; break; } } } return type; }
javascript
function() { var orders = this.options.runtimeOrder || Runtime.orders, type = this.type, i, len; if ( !type ) { orders = orders.split( /\s*,\s*/g ); for ( i = 0, len = orders.length; i < len; i++ ) { if ( Runtime.hasRuntime( orders[ i ] ) ) { this.type = type = orders[ i ]; break; } } } return type; }
[ "function", "(", ")", "{", "var", "orders", "=", "this", ".", "options", ".", "runtimeOrder", "||", "Runtime", ".", "orders", ",", "type", "=", "this", ".", "type", ",", "i", ",", "len", ";", "if", "(", "!", "type", ")", "{", "orders", "=", "orde...
预测Uploader将采用哪个`Runtime` @grammar predictRuntimeType() => String @method predictRuntimeType @for Uploader
[ "预测Uploader将采用哪个", "Runtime" ]
7094e4476c5af3b06993d91dde2d223200b9feb7
https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/dist/webuploader.withoutimage.js#L2716-L2733
train
Get the runtime type
[ 30522, 3853, 1006, 1007, 1063, 13075, 4449, 1027, 2023, 1012, 7047, 1012, 2448, 7292, 8551, 2121, 1064, 1064, 2448, 7292, 1012, 4449, 1010, 2828, 1027, 2023, 1012, 2828, 1010, 1045, 1010, 18798, 1025, 2065, 1006, 999, 2828, 1007, 1063, 44...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/mvc/Controller.js
loadControllerClass
function loadControllerClass(sName, bAsync) { if (!sName) { throw new Error("Controller name ('sName' parameter) is required"); } var sControllerName = sName.replace(/\./g, "/") + ".controller", ControllerClass = resolveClass(sap.ui.require(sControllerName)); function resolveClass(ControllerClass) { if (ControllerClass) { return ControllerClass; } else if (mRegistry[sName]) { return Controller; } else { //legacy controller return ObjectPath.get(sName); } } if (bAsync) { return new Promise(function(resolve, reject) { if (!ControllerClass) { sap.ui.require([sControllerName], function (ControllerClass) { resolve(resolveClass(ControllerClass)); }); } else { resolve(ControllerClass); } }); } else if (!ControllerClass) { ControllerClass = sap.ui.requireSync(sControllerName); return resolveClass(ControllerClass); } else { return ControllerClass; } }
javascript
function loadControllerClass(sName, bAsync) { if (!sName) { throw new Error("Controller name ('sName' parameter) is required"); } var sControllerName = sName.replace(/\./g, "/") + ".controller", ControllerClass = resolveClass(sap.ui.require(sControllerName)); function resolveClass(ControllerClass) { if (ControllerClass) { return ControllerClass; } else if (mRegistry[sName]) { return Controller; } else { //legacy controller return ObjectPath.get(sName); } } if (bAsync) { return new Promise(function(resolve, reject) { if (!ControllerClass) { sap.ui.require([sControllerName], function (ControllerClass) { resolve(resolveClass(ControllerClass)); }); } else { resolve(ControllerClass); } }); } else if (!ControllerClass) { ControllerClass = sap.ui.requireSync(sControllerName); return resolveClass(ControllerClass); } else { return ControllerClass; } }
[ "function", "loadControllerClass", "(", "sName", ",", "bAsync", ")", "{", "if", "(", "!", "sName", ")", "{", "throw", "new", "Error", "(", "\"Controller name ('sName' parameter) is required\"", ")", ";", "}", "var", "sControllerName", "=", "sName", ".", "replace...
/* load controller class @param {string} sName the controller name @param {boolean} bAsync Load async or not @return {{sap.ui.core.mvc.Controller | Promise} oController <code>Promise</code> in case of asynchronous loading or <code>undefined</code> in case of synchronous loading
[ "/", "*", "load", "controller", "class" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/mvc/Controller.js#L259-L294
train
Loads a controller class
[ 30522, 3853, 7170, 8663, 13181, 10820, 26266, 1006, 1055, 18442, 1010, 19021, 6038, 2278, 1007, 1063, 2065, 1006, 999, 1055, 18442, 1007, 1063, 5466, 2047, 7561, 1006, 1000, 11486, 2171, 1006, 1005, 1055, 18442, 1005, 16381, 1007, 2003, 322...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/_AnnotationHelperExpression.js
function (oPathValue) { if (oPathValue.value === undefined) { return undefined; } Measurement.average(sPerformanceGetExpression, "", aPerformanceCategories); if (!bSimpleParserWarningLogged && ManagedObject.bindingParser === BindingParser.simpleParser) { Log.warning("Complex binding syntax not active", null, sAnnotationHelper); bSimpleParserWarningLogged = true; } return Expression.expression(oPathValue).then(function (oResult) { return Basics.resultToString(oResult, false, oPathValue.complexBinding); }, function (e) { if (e instanceof SyntaxError) { return "Unsupported: " + BindingParser.complexParser.escape( Basics.toErrorString(oPathValue.value)); } throw e; }).finally(function () { Measurement.end(sPerformanceGetExpression); }).unwrap(); }
javascript
function (oPathValue) { if (oPathValue.value === undefined) { return undefined; } Measurement.average(sPerformanceGetExpression, "", aPerformanceCategories); if (!bSimpleParserWarningLogged && ManagedObject.bindingParser === BindingParser.simpleParser) { Log.warning("Complex binding syntax not active", null, sAnnotationHelper); bSimpleParserWarningLogged = true; } return Expression.expression(oPathValue).then(function (oResult) { return Basics.resultToString(oResult, false, oPathValue.complexBinding); }, function (e) { if (e instanceof SyntaxError) { return "Unsupported: " + BindingParser.complexParser.escape( Basics.toErrorString(oPathValue.value)); } throw e; }).finally(function () { Measurement.end(sPerformanceGetExpression); }).unwrap(); }
[ "function", "(", "oPathValue", ")", "{", "if", "(", "oPathValue", ".", "value", "===", "undefined", ")", "{", "return", "undefined", ";", "}", "Measurement", ".", "average", "(", "sPerformanceGetExpression", ",", "\"\"", ",", "aPerformanceCategories", ")", ";"...
Calculates an expression. Ensures that errors that are thrown while processing are handled accordingly. @param {object} oPathValue path and value information pointing to the expression (see Expression object) @returns {Promise|string} the expression value or "Unsupported: oRawValue" in case of an error or <code>undefined</code> in case the raw value is undefined; may instead return a <code>Promise</code> resolving with that result.
[ "Calculates", "an", "expression", ".", "Ensures", "that", "errors", "that", "are", "thrown", "while", "processing", "are", "handled", "accordingly", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/_AnnotationHelperExpression.js#L566-L590
train
Returns the value of the expression at the given path.
[ 30522, 3853, 1006, 6728, 8988, 10175, 5657, 1007, 1063, 2065, 1006, 6728, 8988, 10175, 5657, 1012, 3643, 1027, 1027, 1027, 6151, 28344, 1007, 1063, 2709, 6151, 28344, 1025, 1065, 10903, 1012, 2779, 1006, 11867, 2121, 14192, 6651, 18150, 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...
radare/radare2
shlr/www/graph/js-graph-it.js
DocumentScanner
function DocumentScanner(visitor, scanElementsOnly) { this.visitor = visitor; this.scanElementsOnly = scanElementsOnly; /** * Scans the element */ this.scan = function(element) { if (this.visitor.visit(element)) { // visit child elements var children = element.childNodes; for(var i = 0; i < children.length; i++) { if(!this.scanElementsOnly || children[i].nodeType == 1) this.scan(children[i]); } } } }
javascript
function DocumentScanner(visitor, scanElementsOnly) { this.visitor = visitor; this.scanElementsOnly = scanElementsOnly; /** * Scans the element */ this.scan = function(element) { if (this.visitor.visit(element)) { // visit child elements var children = element.childNodes; for(var i = 0; i < children.length; i++) { if(!this.scanElementsOnly || children[i].nodeType == 1) this.scan(children[i]); } } } }
[ "function", "DocumentScanner", "(", "visitor", ",", "scanElementsOnly", ")", "{", "this", ".", "visitor", "=", "visitor", ";", "this", ".", "scanElementsOnly", "=", "scanElementsOnly", ";", "/**\n\t * Scans the element\n\t */", "this", ".", "scan", "=", "function", ...
************************************************** This class is a scanner for the visitor pattern. * ************************************************** Constructor, parameters are: visitor: the visitor implementation, it must be a class with a visit(element) method. scanElementsOnly: a flag telling whether to scan html elements only or all html nodes.
[ "**************************************************", "This", "class", "is", "a", "scanner", "for", "the", "visitor", "pattern", ".", "*", "**************************************************", "Constructor", "parameters", "are", ":", "visitor", ":", "the", "visitor", "imple...
bf5e3028810a0ec7c267c6fe4bfad639b4819e35
https://github.com/radare/radare2/blob/bf5e3028810a0ec7c267c6fe4bfad639b4819e35/shlr/www/graph/js-graph-it.js#L17-L34
train
The DocumentScanner class
[ 30522, 3853, 5491, 9336, 3678, 1006, 10367, 1010, 13594, 12260, 8163, 2239, 2135, 1007, 1063, 2023, 1012, 10367, 1027, 10367, 1025, 2023, 1012, 13594, 12260, 8163, 2239, 2135, 1027, 13594, 12260, 8163, 2239, 2135, 1025, 1013, 1008, 1008, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/indent-legacy.js
isOuterIIFE
function isOuterIIFE(node) { const parent = node.parent; let stmt = parent.parent; /* * Verify that the node is an IIEF */ if ( parent.type !== "CallExpression" || parent.callee !== node) { return false; } /* * Navigate legal ancestors to determine whether this IIEF is outer */ while ( stmt.type === "UnaryExpression" && ( stmt.operator === "!" || stmt.operator === "~" || stmt.operator === "+" || stmt.operator === "-") || stmt.type === "AssignmentExpression" || stmt.type === "LogicalExpression" || stmt.type === "SequenceExpression" || stmt.type === "VariableDeclarator") { stmt = stmt.parent; } return (( stmt.type === "ExpressionStatement" || stmt.type === "VariableDeclaration") && stmt.parent && stmt.parent.type === "Program" ); }
javascript
function isOuterIIFE(node) { const parent = node.parent; let stmt = parent.parent; /* * Verify that the node is an IIEF */ if ( parent.type !== "CallExpression" || parent.callee !== node) { return false; } /* * Navigate legal ancestors to determine whether this IIEF is outer */ while ( stmt.type === "UnaryExpression" && ( stmt.operator === "!" || stmt.operator === "~" || stmt.operator === "+" || stmt.operator === "-") || stmt.type === "AssignmentExpression" || stmt.type === "LogicalExpression" || stmt.type === "SequenceExpression" || stmt.type === "VariableDeclarator") { stmt = stmt.parent; } return (( stmt.type === "ExpressionStatement" || stmt.type === "VariableDeclaration") && stmt.parent && stmt.parent.type === "Program" ); }
[ "function", "isOuterIIFE", "(", "node", ")", "{", "const", "parent", "=", "node", ".", "parent", ";", "let", "stmt", "=", "parent", ".", "parent", ";", "/*\n * Verify that the node is an IIEF\n */", "if", "(", "parent", ".", "type", "!==", ...
Check to see if the node is a file level IIFE @param {ASTNode} node The function node to check. @returns {boolean} True if the node is the outer IIFE
[ "Check", "to", "see", "if", "the", "node", "is", "a", "file", "level", "IIFE" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/indent-legacy.js#L567-L603
train
Determines whether or not a node is an outer IIEF.
[ 30522, 3853, 11163, 19901, 6137, 7959, 1006, 13045, 1007, 1063, 9530, 3367, 6687, 1027, 13045, 1012, 6687, 1025, 2292, 2358, 20492, 1027, 6687, 1012, 6687, 1025, 1013, 1008, 1008, 20410, 2008, 1996, 13045, 2003, 2019, 2462, 12879, 1008, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SheetJS/js-xlsx
bits/75_xlml.js
write_sty_xlml
function write_sty_xlml(wb, opts)/*:string*/ { /* Styles */ var styles/*:Array<string>*/ = ['<Style ss:ID="Default" ss:Name="Normal"><NumberFormat/></Style>']; opts.cellXfs.forEach(function(xf, id) { var payload/*:Array<string>*/ = []; payload.push(writextag('NumberFormat', null, {"ss:Format": escapexml(SSF._table[xf.numFmtId])})); styles.push(writextag('Style', payload.join(""), {"ss:ID": "s" + (21+id)})); }); return writextag("Styles", styles.join("")); }
javascript
function write_sty_xlml(wb, opts)/*:string*/ { /* Styles */ var styles/*:Array<string>*/ = ['<Style ss:ID="Default" ss:Name="Normal"><NumberFormat/></Style>']; opts.cellXfs.forEach(function(xf, id) { var payload/*:Array<string>*/ = []; payload.push(writextag('NumberFormat', null, {"ss:Format": escapexml(SSF._table[xf.numFmtId])})); styles.push(writextag('Style', payload.join(""), {"ss:ID": "s" + (21+id)})); }); return writextag("Styles", styles.join("")); }
[ "function", "write_sty_xlml", "(", "wb", ",", "opts", ")", "/*:string*/", "{", "/* Styles */", "var", "styles", "/*:Array<string>*/", "=", "[", "'<Style ss:ID=\"Default\" ss:Name=\"Normal\"><NumberFormat/></Style>'", "]", ";", "opts", ".", "cellXfs", ".", "forEach", "("...
/* TODO
[ "/", "*", "TODO" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/75_xlml.js#L866-L875
train
Write the stylus xlml
[ 30522, 3853, 4339, 1035, 2358, 2100, 1035, 28712, 19968, 1006, 25610, 1010, 23569, 2015, 1007, 1013, 1008, 1024, 5164, 1008, 1013, 1063, 1013, 1008, 6782, 1008, 1013, 13075, 6782, 1013, 1008, 1024, 9140, 1026, 5164, 1028, 1008, 1013, 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...
eslint/eslint
lib/linter.js
getDirectiveComments
function getDirectiveComments(filename, ast, ruleMapper) { const configuredRules = {}; const enabledGlobals = {}; const exportedVariables = {}; const problems = []; const disableDirectives = []; ast.comments.filter(token => token.type !== "Shebang").forEach(comment => { const trimmedCommentText = comment.value.trim(); const match = /^(eslint(-\w+){0,3}|exported|globals?)(\s|$)/u.exec(trimmedCommentText); if (!match) { return; } const directiveValue = trimmedCommentText.slice(match.index + match[1].length); if (/^eslint-disable-(next-)?line$/u.test(match[1])) { if (comment.loc.start.line === comment.loc.end.line) { const directiveType = match[1].slice("eslint-".length); disableDirectives.push(...createDisableDirectives(directiveType, comment.loc.start, directiveValue)); } else { problems.push({ ruleId: null, severity: 2, message: `${match[1]} comment should not span multiple lines.`, line: comment.loc.start.line, column: comment.loc.start.column + 1, endLine: comment.loc.end.line, endColumn: comment.loc.end.column + 1, nodeType: null }); } } else if (comment.type === "Block") { switch (match[1]) { case "exported": Object.assign(exportedVariables, commentParser.parseStringConfig(directiveValue, comment)); break; case "globals": case "global": for (const [id, { value }] of Object.entries(commentParser.parseStringConfig(directiveValue, comment))) { let normalizedValue; try { normalizedValue = ConfigOps.normalizeConfigGlobal(value); } catch (err) { problems.push({ ruleId: null, severity: 2, message: err.message, line: comment.loc.start.line, column: comment.loc.start.column + 1, endLine: comment.loc.end.line, endColumn: comment.loc.end.column + 1, nodeType: null }); continue; } if (enabledGlobals[id]) { enabledGlobals[id].comments.push(comment); enabledGlobals[id].value = normalizedValue; } else { enabledGlobals[id] = { comments: [comment], value: normalizedValue }; } } break; case "eslint-disable": disableDirectives.push(...createDisableDirectives("disable", comment.loc.start, directiveValue)); break; case "eslint-enable": disableDirectives.push(...createDisableDirectives("enable", comment.loc.start, directiveValue)); break; case "eslint": { const parseResult = commentParser.parseJsonConfig(directiveValue, comment.loc); if (parseResult.success) { Object.keys(parseResult.config).forEach(name => { const ruleValue = parseResult.config[name]; try { validator.validateRuleOptions(ruleMapper(name), name, ruleValue); } catch (err) { problems.push({ ruleId: name, severity: 2, message: err.message, line: comment.loc.start.line, column: comment.loc.start.column + 1, endLine: comment.loc.end.line, endColumn: comment.loc.end.column + 1, nodeType: null }); } configuredRules[name] = ruleValue; }); } else { problems.push(parseResult.error); } break; } // no default } } }); return { configuredRules, enabledGlobals, exportedVariables, problems, disableDirectives }; }
javascript
function getDirectiveComments(filename, ast, ruleMapper) { const configuredRules = {}; const enabledGlobals = {}; const exportedVariables = {}; const problems = []; const disableDirectives = []; ast.comments.filter(token => token.type !== "Shebang").forEach(comment => { const trimmedCommentText = comment.value.trim(); const match = /^(eslint(-\w+){0,3}|exported|globals?)(\s|$)/u.exec(trimmedCommentText); if (!match) { return; } const directiveValue = trimmedCommentText.slice(match.index + match[1].length); if (/^eslint-disable-(next-)?line$/u.test(match[1])) { if (comment.loc.start.line === comment.loc.end.line) { const directiveType = match[1].slice("eslint-".length); disableDirectives.push(...createDisableDirectives(directiveType, comment.loc.start, directiveValue)); } else { problems.push({ ruleId: null, severity: 2, message: `${match[1]} comment should not span multiple lines.`, line: comment.loc.start.line, column: comment.loc.start.column + 1, endLine: comment.loc.end.line, endColumn: comment.loc.end.column + 1, nodeType: null }); } } else if (comment.type === "Block") { switch (match[1]) { case "exported": Object.assign(exportedVariables, commentParser.parseStringConfig(directiveValue, comment)); break; case "globals": case "global": for (const [id, { value }] of Object.entries(commentParser.parseStringConfig(directiveValue, comment))) { let normalizedValue; try { normalizedValue = ConfigOps.normalizeConfigGlobal(value); } catch (err) { problems.push({ ruleId: null, severity: 2, message: err.message, line: comment.loc.start.line, column: comment.loc.start.column + 1, endLine: comment.loc.end.line, endColumn: comment.loc.end.column + 1, nodeType: null }); continue; } if (enabledGlobals[id]) { enabledGlobals[id].comments.push(comment); enabledGlobals[id].value = normalizedValue; } else { enabledGlobals[id] = { comments: [comment], value: normalizedValue }; } } break; case "eslint-disable": disableDirectives.push(...createDisableDirectives("disable", comment.loc.start, directiveValue)); break; case "eslint-enable": disableDirectives.push(...createDisableDirectives("enable", comment.loc.start, directiveValue)); break; case "eslint": { const parseResult = commentParser.parseJsonConfig(directiveValue, comment.loc); if (parseResult.success) { Object.keys(parseResult.config).forEach(name => { const ruleValue = parseResult.config[name]; try { validator.validateRuleOptions(ruleMapper(name), name, ruleValue); } catch (err) { problems.push({ ruleId: name, severity: 2, message: err.message, line: comment.loc.start.line, column: comment.loc.start.column + 1, endLine: comment.loc.end.line, endColumn: comment.loc.end.column + 1, nodeType: null }); } configuredRules[name] = ruleValue; }); } else { problems.push(parseResult.error); } break; } // no default } } }); return { configuredRules, enabledGlobals, exportedVariables, problems, disableDirectives }; }
[ "function", "getDirectiveComments", "(", "filename", ",", "ast", ",", "ruleMapper", ")", "{", "const", "configuredRules", "=", "{", "}", ";", "const", "enabledGlobals", "=", "{", "}", ";", "const", "exportedVariables", "=", "{", "}", ";", "const", "problems"...
Parses comments in file to extract file-specific config of rules, globals and environments and merges them with global config; also code blocks where reporting is disabled or enabled and merges them with reporting config. @param {string} filename The file being checked. @param {ASTNode} ast The top node of the AST. @param {function(string): {create: Function}} ruleMapper A map from rule IDs to defined rules @returns {{configuredRules: Object, enabledGlobals: {value:string,comment:Token}[], exportedVariables: Object, problems: Problem[], disableDirectives: DisableDirective[]}} A collection of the directive comments that were found, along with any problems that occurred when parsing
[ "Parses", "comments", "in", "file", "to", "extract", "file", "-", "specific", "config", "of", "rules", "globals", "and", "environments", "and", "merges", "them", "with", "global", "config", ";", "also", "code", "blocks", "where", "reporting", "is", "disabled",...
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/linter.js#L165-L288
train
Get all directives from the given file
[ 30522, 3853, 2131, 4305, 2890, 15277, 9006, 8163, 1006, 5371, 18442, 1010, 2004, 2102, 1010, 3627, 2863, 18620, 1007, 1063, 9530, 3367, 26928, 6820, 4244, 1027, 1063, 1065, 1025, 9530, 3367, 9124, 23296, 16429, 9777, 1027, 1063, 1065, 1025,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/routing/Router.js
function (sViewName, sViewType, sViewId) { Log.warning("Deprecated API Router#getView called - use Router#getViews instead.", this); var oView = this._oViews._getViewWithGlobalId({ viewName: sViewName, type: sViewType, id: sViewId }); this.fireViewCreated({ view: oView, viewName: sViewName, type: sViewType }); return oView; }
javascript
function (sViewName, sViewType, sViewId) { Log.warning("Deprecated API Router#getView called - use Router#getViews instead.", this); var oView = this._oViews._getViewWithGlobalId({ viewName: sViewName, type: sViewType, id: sViewId }); this.fireViewCreated({ view: oView, viewName: sViewName, type: sViewType }); return oView; }
[ "function", "(", "sViewName", ",", "sViewType", ",", "sViewId", ")", "{", "Log", ".", "warning", "(", "\"Deprecated API Router#getView called - use Router#getViews instead.\"", ",", "this", ")", ";", "var", "oView", "=", "this", ".", "_oViews", ".", "_getViewWithGlo...
Returns a cached view for a given name or creates it if it does not yet exists @deprecated Since 1.28.1 use {@link #getViews} instead. @param {string} sViewName Name of the view @param {string} sViewType Type of the view @param {string} sViewId Optional view id @return {sap.ui.core.mvc.View} the view instance @public
[ "Returns", "a", "cached", "view", "for", "a", "given", "name", "or", "creates", "it", "if", "it", "does", "not", "yet", "exists" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/routing/Router.js#L586-L602
train
Returns the view with the given name and type
[ 30522, 3853, 1006, 17917, 2666, 7962, 14074, 1010, 17917, 2666, 26677, 18863, 1010, 17917, 2666, 9148, 2094, 1007, 1063, 8833, 1012, 5432, 1006, 1000, 2139, 28139, 12921, 17928, 2799, 2099, 1001, 2131, 8584, 2170, 1011, 2224, 2799, 2099, 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...
aws/aws-sdk-js
features/extra/cleanup.js
function(bucket, callback) { var s3 = new AWS.S3({maxRetries: 100}); var params = { Bucket: bucket }; s3.listObjects(params, function (err, data) { if (err) return callback(err); if (data.Contents.length > 0) { params.Delete = { Objects: [] }; data.Contents.forEach(function (item) { params.Delete.Objects.push({Key: item.Key}); }); s3.deleteObjects(params, callback); } else { callback(); } }); }
javascript
function(bucket, callback) { var s3 = new AWS.S3({maxRetries: 100}); var params = { Bucket: bucket }; s3.listObjects(params, function (err, data) { if (err) return callback(err); if (data.Contents.length > 0) { params.Delete = { Objects: [] }; data.Contents.forEach(function (item) { params.Delete.Objects.push({Key: item.Key}); }); s3.deleteObjects(params, callback); } else { callback(); } }); }
[ "function", "(", "bucket", ",", "callback", ")", "{", "var", "s3", "=", "new", "AWS", ".", "S3", "(", "{", "maxRetries", ":", "100", "}", ")", ";", "var", "params", "=", "{", "Bucket", ":", "bucket", "}", ";", "s3", ".", "listObjects", "(", "para...
Delete objects.
[ "Delete", "objects", "." ]
c23e5f0edd150f8885267e5f7c8a564f8e6e8562
https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/features/extra/cleanup.js#L83-L101
train
Delete all the objects in the bucket
[ 30522, 3853, 1006, 13610, 1010, 2655, 5963, 1007, 1063, 13075, 1055, 2509, 1027, 2047, 22091, 2015, 1012, 1055, 2509, 1006, 1063, 4098, 13465, 5134, 1024, 2531, 1065, 1007, 1025, 13075, 11498, 5244, 1027, 1063, 13610, 1024, 13610, 1065, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/dialog/dialog.js
lockScreenReader
function lockScreenReader(element, options) { var isHidden = true; // get raw DOM node walkDOM(element[0]); options.unlockScreenReader = function () { isHidden = false; walkDOM(element[0]); options.unlockScreenReader = null; }; /** * Get all of an element's parent elements up the DOM tree * @return {Array} The parent elements */ function getParents(element) { var parents = []; while (element.parentNode) { if (element === document.body) { return parents; } var children = element.parentNode.children; for (var i = 0; i < children.length; i++) { // skip over child if it is an ascendant of the dialog // a script or style tag, or a live region. if (element !== children[i] && !isNodeOneOf(children[i], ['SCRIPT', 'STYLE']) && !children[i].hasAttribute('aria-live')) { parents.push(children[i]); } } element = element.parentNode; } return parents; } /** * Walk DOM to apply or remove aria-hidden on sibling nodes * and parent sibling nodes */ function walkDOM(element) { var elements = getParents(element); for (var i = 0; i < elements.length; i++) { elements[i].setAttribute('aria-hidden', isHidden); } } }
javascript
function lockScreenReader(element, options) { var isHidden = true; // get raw DOM node walkDOM(element[0]); options.unlockScreenReader = function () { isHidden = false; walkDOM(element[0]); options.unlockScreenReader = null; }; /** * Get all of an element's parent elements up the DOM tree * @return {Array} The parent elements */ function getParents(element) { var parents = []; while (element.parentNode) { if (element === document.body) { return parents; } var children = element.parentNode.children; for (var i = 0; i < children.length; i++) { // skip over child if it is an ascendant of the dialog // a script or style tag, or a live region. if (element !== children[i] && !isNodeOneOf(children[i], ['SCRIPT', 'STYLE']) && !children[i].hasAttribute('aria-live')) { parents.push(children[i]); } } element = element.parentNode; } return parents; } /** * Walk DOM to apply or remove aria-hidden on sibling nodes * and parent sibling nodes */ function walkDOM(element) { var elements = getParents(element); for (var i = 0; i < elements.length; i++) { elements[i].setAttribute('aria-hidden', isHidden); } } }
[ "function", "lockScreenReader", "(", "element", ",", "options", ")", "{", "var", "isHidden", "=", "true", ";", "// get raw DOM node", "walkDOM", "(", "element", "[", "0", "]", ")", ";", "options", ".", "unlockScreenReader", "=", "function", "(", ")", "{", ...
Prevents screen reader interaction behind modal window on swipe interfaces
[ "Prevents", "screen", "reader", "interaction", "behind", "modal", "window", "on", "swipe", "interfaces" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L1142-L1190
train
Lock screen reader
[ 30522, 3853, 11223, 24410, 16416, 4063, 1006, 5783, 1010, 7047, 1007, 1063, 13075, 2003, 27511, 4181, 1027, 2995, 1025, 1013, 1013, 2131, 6315, 14383, 13045, 3328, 9527, 1006, 5783, 1031, 1014, 1033, 1007, 1025, 7047, 1012, 19829, 18182, 16...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
are_equal
function are_equal(a1, a2) { if (typeof(a1) != typeof(a2)) return false; switch(typeof(a1)) { case 'object': // arrays if (a1.length) { if (a1.length != a2.length) return false; for (var i = 0; i < a1.length; ++i) { if (!are_equal(a1[i], a2[i])) return false } } // associative arrays else { var keys = {}; for (var key in a1) { keys[key] = true; } for (var key in a2) { keys[key] = true; } for (var key in keys) { if (!are_equal(a1[key], a2[key])) return false; } } return true; default: return a1 == a2; } }
javascript
function are_equal(a1, a2) { if (typeof(a1) != typeof(a2)) return false; switch(typeof(a1)) { case 'object': // arrays if (a1.length) { if (a1.length != a2.length) return false; for (var i = 0; i < a1.length; ++i) { if (!are_equal(a1[i], a2[i])) return false } } // associative arrays else { var keys = {}; for (var key in a1) { keys[key] = true; } for (var key in a2) { keys[key] = true; } for (var key in keys) { if (!are_equal(a1[key], a2[key])) return false; } } return true; default: return a1 == a2; } }
[ "function", "are_equal", "(", "a1", ",", "a2", ")", "{", "if", "(", "typeof", "(", "a1", ")", "!=", "typeof", "(", "a2", ")", ")", "return", "false", ";", "switch", "(", "typeof", "(", "a1", ")", ")", "{", "case", "'object'", ":", "// arrays", "i...
Returns true if two arrays are identical, and false otherwise. @param a1 the first array, may only contain simple values (strings or numbers) @param a2 the second array, same restricts on data as for a1 @return true if the arrays are equivalent, false otherwise.
[ "Returns", "true", "if", "two", "arrays", "are", "identical", "and", "false", "otherwise", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L2292-L2327
train
returns true if a1 and a2 are equal
[ 30522, 3853, 2024, 1035, 5020, 1006, 17350, 1010, 22441, 1007, 1063, 2065, 1006, 2828, 11253, 1006, 17350, 1007, 999, 1027, 2828, 11253, 1006, 22441, 1007, 1007, 2709, 6270, 1025, 6942, 1006, 2828, 11253, 1006, 17350, 1007, 1007, 1063, 2553...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
_closeRelatedDocument
function _closeRelatedDocument(liveDoc) { if (_relatedDocuments[liveDoc.doc.url]) { delete _relatedDocuments[liveDoc.doc.url]; } if (_server) { _server.remove(liveDoc); } _closeDocument(liveDoc); }
javascript
function _closeRelatedDocument(liveDoc) { if (_relatedDocuments[liveDoc.doc.url]) { delete _relatedDocuments[liveDoc.doc.url]; } if (_server) { _server.remove(liveDoc); } _closeDocument(liveDoc); }
[ "function", "_closeRelatedDocument", "(", "liveDoc", ")", "{", "if", "(", "_relatedDocuments", "[", "liveDoc", ".", "doc", ".", "url", "]", ")", "{", "delete", "_relatedDocuments", "[", "liveDoc", ".", "doc", ".", "url", "]", ";", "}", "if", "(", "_serve...
Removes the given CSS/JSDocument from _relatedDocuments. Signals that the given file is no longer associated with the HTML document that is live (e.g. if the related file has been deleted on disk).
[ "Removes", "the", "given", "CSS", "/", "JSDocument", "from", "_relatedDocuments", ".", "Signals", "that", "the", "given", "file", "is", "no", "longer", "associated", "with", "the", "HTML", "document", "that", "is", "live", "(", "e", ".", "g", ".", "if", ...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/LiveDevelopment.js#L315-L325
train
Close a related document
[ 30522, 3853, 1035, 3553, 10581, 3064, 3527, 24894, 4765, 1006, 2973, 10085, 1007, 1063, 2065, 1006, 1035, 3141, 3527, 24894, 11187, 1031, 2973, 10085, 1012, 9986, 1012, 24471, 2140, 1033, 1007, 1063, 3972, 12870, 1035, 3141, 3527, 24894, 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...
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js
function (aElements, fnFilter, fnFormat) { var i, iLength = aElements.length, aNewElements = [], oElement; for (i = 0; i < iLength; i++) { oElement = aElements[i]; if (fnFilter && !fnFilter(oElement)) { continue; } if (fnFormat) { fnFormat(oElement); } aNewElements.push(oElement); } return aNewElements; }
javascript
function (aElements, fnFilter, fnFormat) { var i, iLength = aElements.length, aNewElements = [], oElement; for (i = 0; i < iLength; i++) { oElement = aElements[i]; if (fnFilter && !fnFilter(oElement)) { continue; } if (fnFormat) { fnFormat(oElement); } aNewElements.push(oElement); } return aNewElements; }
[ "function", "(", "aElements", ",", "fnFilter", ",", "fnFormat", ")", "{", "var", "i", ",", "iLength", "=", "aElements", ".", "length", ",", "aNewElements", "=", "[", "]", ",", "oElement", ";", "for", "(", "i", "=", "0", ";", "i", "<", "iLength", ";...
Filter and format elements @param {array} aElements list of elements @param {function} fnFilter filtering function @param {function} fnFormat formatting function @returns {array} transformed elements list
[ "Filter", "and", "format", "elements" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js#L603-L621
train
Returns an array of elements that match the filter function
[ 30522, 3853, 1006, 29347, 16930, 11187, 1010, 1042, 2078, 8873, 21928, 1010, 1042, 2078, 14192, 4017, 1007, 1063, 13075, 1045, 1010, 17869, 3070, 2705, 1027, 29347, 16930, 11187, 1012, 3091, 1010, 2019, 7974, 12260, 8163, 1027, 1031, 1033, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
to_kwargs
function to_kwargs(args, sortedKeys) { var s = ''; if (!sortedKeys) { var sortedKeys = keys(args).sort(); } for (var i = 0; i < sortedKeys.length; ++i) { var k = sortedKeys[i]; if (args[k] != undefined) { if (s) { s += ', '; } s += k + '=' + args[k]; } } return s; }
javascript
function to_kwargs(args, sortedKeys) { var s = ''; if (!sortedKeys) { var sortedKeys = keys(args).sort(); } for (var i = 0; i < sortedKeys.length; ++i) { var k = sortedKeys[i]; if (args[k] != undefined) { if (s) { s += ', '; } s += k + '=' + args[k]; } } return s; }
[ "function", "to_kwargs", "(", "args", ",", "sortedKeys", ")", "{", "var", "s", "=", "''", ";", "if", "(", "!", "sortedKeys", ")", "{", "var", "sortedKeys", "=", "keys", "(", "args", ")", ".", "sort", "(", ")", ";", "}", "for", "(", "var", "i", ...
Creates a python-style keyword arguments string from an object. @param args an associative array mapping strings to strings @param sortedKeys (optional) a list of keys of the args parameter that specifies the order in which the arguments will appear in the returned kwargs string @return a kwarg string representation of args
[ "Creates", "a", "python", "-", "style", "keyword", "arguments", "string", "from", "an", "object", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L2517-L2533
train
to_kwargs - returns a string
[ 30522, 3853, 2000, 1035, 6448, 2906, 5620, 1006, 12098, 5620, 1010, 19616, 14839, 2015, 1007, 1063, 13075, 1055, 1027, 1005, 1005, 1025, 2065, 1006, 999, 19616, 14839, 2015, 1007, 1063, 13075, 19616, 14839, 2015, 1027, 6309, 1006, 12098, 56...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
chartjs/Chart.js
src/core/core.datasetController.js
unlistenArrayEvents
function unlistenArrayEvents(array, listener) { var stub = array._chartjs; if (!stub) { return; } var listeners = stub.listeners; var index = listeners.indexOf(listener); if (index !== -1) { listeners.splice(index, 1); } if (listeners.length > 0) { return; } arrayEvents.forEach(function(key) { delete array[key]; }); delete array._chartjs; }
javascript
function unlistenArrayEvents(array, listener) { var stub = array._chartjs; if (!stub) { return; } var listeners = stub.listeners; var index = listeners.indexOf(listener); if (index !== -1) { listeners.splice(index, 1); } if (listeners.length > 0) { return; } arrayEvents.forEach(function(key) { delete array[key]; }); delete array._chartjs; }
[ "function", "unlistenArrayEvents", "(", "array", ",", "listener", ")", "{", "var", "stub", "=", "array", ".", "_chartjs", ";", "if", "(", "!", "stub", ")", "{", "return", ";", "}", "var", "listeners", "=", "stub", ".", "listeners", ";", "var", "index",...
Removes the given array event listener and cleanup extra attached properties (such as the _chartjs stub and overridden methods) if array doesn't have any more listeners.
[ "Removes", "the", "given", "array", "event", "listener", "and", "cleanup", "extra", "attached", "properties", "(", "such", "as", "the", "_chartjs", "stub", "and", "overridden", "methods", ")", "if", "array", "doesn", "t", "have", "any", "more", "listeners", ...
f093c36574d290330ed623e60fbd070421c730d5
https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/core/core.datasetController.js#L55-L76
train
Unlisten an array event listener
[ 30522, 3853, 4895, 9863, 8189, 11335, 17240, 11187, 1006, 9140, 1010, 19373, 1007, 1063, 13075, 24646, 2497, 1027, 9140, 1012, 1035, 3673, 22578, 1025, 2065, 1006, 999, 24646, 2497, 1007, 1063, 2709, 1025, 1065, 13075, 13810, 1027, 24646, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nhn/tui.editor
src/js/extensions/table/tableRangeHandler.js
_expandRowMergedRange
function _expandRowMergedRange(tableData, tableRange, rangeType) { const {rowIndex} = tableRange[rangeType]; const rowData = tableData[rowIndex]; util.range(tableRange.start.colIndex, tableRange.end.colIndex + 1).forEach(colIndex => { const cellData = rowData[colIndex]; const {rowMergeWith} = cellData; let lastRowMergedIndex = -1; if (util.isExisty(rowMergeWith)) { if (rowMergeWith < tableRange.start.rowIndex) { tableRange.start.rowIndex = rowMergeWith; } lastRowMergedIndex = rowMergeWith + tableData[rowMergeWith][colIndex].rowspan - 1; } else if (cellData.rowspan > 1) { lastRowMergedIndex = rowIndex + cellData.rowspan - 1; } if (lastRowMergedIndex > tableRange.end.rowIndex) { tableRange.end.rowIndex = lastRowMergedIndex; } }); }
javascript
function _expandRowMergedRange(tableData, tableRange, rangeType) { const {rowIndex} = tableRange[rangeType]; const rowData = tableData[rowIndex]; util.range(tableRange.start.colIndex, tableRange.end.colIndex + 1).forEach(colIndex => { const cellData = rowData[colIndex]; const {rowMergeWith} = cellData; let lastRowMergedIndex = -1; if (util.isExisty(rowMergeWith)) { if (rowMergeWith < tableRange.start.rowIndex) { tableRange.start.rowIndex = rowMergeWith; } lastRowMergedIndex = rowMergeWith + tableData[rowMergeWith][colIndex].rowspan - 1; } else if (cellData.rowspan > 1) { lastRowMergedIndex = rowIndex + cellData.rowspan - 1; } if (lastRowMergedIndex > tableRange.end.rowIndex) { tableRange.end.rowIndex = lastRowMergedIndex; } }); }
[ "function", "_expandRowMergedRange", "(", "tableData", ",", "tableRange", ",", "rangeType", ")", "{", "const", "{", "rowIndex", "}", "=", "tableRange", "[", "rangeType", "]", ";", "const", "rowData", "=", "tableData", "[", "rowIndex", "]", ";", "util", ".", ...
Expand table range by row merge properties like rowspan, rowMergeWith. @param {Array.<Array.<object>>} tableData - table data @param {{ start: {rowIndex: number, colIndex: number}, end: {rowIndex: number, colIndex: number} }} tableRange - table range @param {string} rangeType - range type like start, end @private
[ "Expand", "table", "range", "by", "row", "merge", "properties", "like", "rowspan", "rowMergeWith", "." ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableRangeHandler.js#L65-L88
train
Expand row merged range
[ 30522, 3853, 1035, 7818, 10524, 5017, 5999, 24388, 2063, 1006, 2795, 2850, 2696, 1010, 2795, 24388, 2063, 1010, 2846, 13874, 1007, 1063, 9530, 3367, 1063, 5216, 22254, 10288, 1065, 1027, 2795, 24388, 2063, 1031, 2846, 13874, 1033, 1025, 953...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
processHtml
function processHtml(demo) { var allContent = demo.files.index.contents; var processors = [ applyAngularAttributesToParentElement, insertTemplatesAsScriptTags, htmlEscapeAmpersand ]; processors.forEach(function(processor) { allContent = processor(allContent, demo); }); return allContent; }
javascript
function processHtml(demo) { var allContent = demo.files.index.contents; var processors = [ applyAngularAttributesToParentElement, insertTemplatesAsScriptTags, htmlEscapeAmpersand ]; processors.forEach(function(processor) { allContent = processor(allContent, demo); }); return allContent; }
[ "function", "processHtml", "(", "demo", ")", "{", "var", "allContent", "=", "demo", ".", "files", ".", "index", ".", "contents", ";", "var", "processors", "=", "[", "applyAngularAttributesToParentElement", ",", "insertTemplatesAsScriptTags", ",", "htmlEscapeAmpersan...
Modifies index.html with necessary changes in order to display correctly in codepen See each processor to determine how each modifies the html
[ "Modifies", "index", ".", "html", "with", "necessary", "changes", "in", "order", "to", "display", "correctly", "in", "codepen", "See", "each", "processor", "to", "determine", "how", "each", "modifies", "the", "html" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/docs/app/js/codepen.js#L98-L113
train
Process HTML files
[ 30522, 3853, 2832, 11039, 19968, 30524, 1033, 1025, 18017, 1012, 18921, 6776, 1006, 3853, 1006, 13151, 1007, 1063, 2035, 8663, 6528, 2102, 1027, 13151, 1006, 2035, 8663, 6528, 2102, 1010, 9703, 1007, 1025, 1065, 1007, 1025, 2709, 2035, 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...
goldfire/howler.js
examples/sprite/sprite.js
function() { var self = this; // Loop through all active sounds and update their progress bar. for (var i=0; i<self.sounds.length; i++) { var id = parseInt(self.sounds[i].id, 10); var offset = self._sprite[self.sounds[i].dataset.sprite][0]; var seek = (self.sound.seek(id) || 0) - (offset / 1000); self.sounds[i].style.width = (((seek / self.sound.duration(id)) * 100) || 0) + '%'; } requestAnimationFrame(self.step.bind(self)); }
javascript
function() { var self = this; // Loop through all active sounds and update their progress bar. for (var i=0; i<self.sounds.length; i++) { var id = parseInt(self.sounds[i].id, 10); var offset = self._sprite[self.sounds[i].dataset.sprite][0]; var seek = (self.sound.seek(id) || 0) - (offset / 1000); self.sounds[i].style.width = (((seek / self.sound.duration(id)) * 100) || 0) + '%'; } requestAnimationFrame(self.step.bind(self)); }
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "// Loop through all active sounds and update their progress bar.", "for", "(", "var", "i", "=", "0", ";", "i", "<", "self", ".", "sounds", ".", "length", ";", "i", "++", ")", "{", "var", "id", ...
The step called within requestAnimationFrame to update the playback positions.
[ "The", "step", "called", "within", "requestAnimationFrame", "to", "update", "the", "playback", "positions", "." ]
030db918dd8ce640afd57e172418472497e8f113
https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/examples/sprite/sprite.js#L115-L127
train
Update the progress bar
[ 30522, 3853, 1006, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 1013, 1013, 7077, 2083, 2035, 3161, 4165, 1998, 10651, 2037, 5082, 3347, 1012, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 1026, 2969, 1012, 4165, 1012, 3091, 1025, 1045, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jgraph/mxgraph
javascript/mxClient.js
function(parent, text, funct, pad) { var a = document.createElement('span'); a.style.color = 'blue'; a.style.textDecoration = 'underline'; a.style.cursor = 'pointer'; if (pad != null) { a.style.paddingLeft = pad+'px'; } mxEvent.addListener(a, 'click', funct); mxUtils.write(a, text); if (parent != null) { parent.appendChild(a); } return a; }
javascript
function(parent, text, funct, pad) { var a = document.createElement('span'); a.style.color = 'blue'; a.style.textDecoration = 'underline'; a.style.cursor = 'pointer'; if (pad != null) { a.style.paddingLeft = pad+'px'; } mxEvent.addListener(a, 'click', funct); mxUtils.write(a, text); if (parent != null) { parent.appendChild(a); } return a; }
[ "function", "(", "parent", ",", "text", ",", "funct", ",", "pad", ")", "{", "var", "a", "=", "document", ".", "createElement", "(", "'span'", ")", ";", "a", ".", "style", ".", "color", "=", "'blue'", ";", "a", ".", "style", ".", "textDecoration", "...
Function: link Adds a hyperlink to the specified parent and invokes the given function when the link is clicked. Parameters: parent - DOM node to contain the new link. text - String that is used as the link label. funct - Function to execute when the link is clicked. pad - Optional left-padding for the link. Default is 0.
[ "Function", ":", "link" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L3449-L3471
train
Creates a span element and adds it to the parent
[ 30522, 3853, 1006, 6687, 1010, 3793, 1010, 4569, 6593, 1010, 11687, 1007, 1063, 13075, 1037, 1027, 6254, 1012, 3443, 12260, 3672, 1006, 1005, 8487, 1005, 1007, 1025, 1037, 1012, 2806, 1012, 3609, 1027, 1005, 2630, 1005, 1025, 1037, 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...
catapult-project/catapult
netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js
getSVGElement
function getSVGElement(id) { var el = document.getElementById(id); return el ? assertInstanceof(el, Element) : null; }
javascript
function getSVGElement(id) { var el = document.getElementById(id); return el ? assertInstanceof(el, Element) : null; }
[ "function", "getSVGElement", "(", "id", ")", "{", "var", "el", "=", "document", ".", "getElementById", "(", "id", ")", ";", "return", "el", "?", "assertInstanceof", "(", "el", ",", "Element", ")", ":", "null", ";", "}" ]
TODO(devlin): This should return SVGElement, but closure compiler is missing those externs. Alias for document.getElementById. Found elements must be SVGElements. @param {string} id The ID of the element to find. @return {Element} The found element or null if not found.
[ "TODO", "(", "devlin", ")", ":", "This", "should", "return", "SVGElement", "but", "closure", "compiler", "is", "missing", "those", "externs", ".", "Alias", "for", "document", ".", "getElementById", ".", "Found", "elements", "must", "be", "SVGElements", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L24-L27
train
Get SVG element by id
[ 30522, 3853, 4152, 2615, 12439, 13665, 1006, 8909, 1007, 1063, 13075, 3449, 1027, 6254, 1012, 2131, 12260, 3672, 3762, 3593, 1006, 8909, 1007, 1025, 2709, 3449, 1029, 20865, 7076, 26897, 11253, 1006, 3449, 1010, 5783, 1007, 1024, 19701, 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...
aframevr/aframe
src/components/hand-controls.js
function (gesture) { var clip; var i; for (i = 0; i < this.clips.length; i++) { clip = this.clips[i]; if (clip.name !== gesture) { continue; } return clip; } }
javascript
function (gesture) { var clip; var i; for (i = 0; i < this.clips.length; i++) { clip = this.clips[i]; if (clip.name !== gesture) { continue; } return clip; } }
[ "function", "(", "gesture", ")", "{", "var", "clip", ";", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "clips", ".", "length", ";", "i", "++", ")", "{", "clip", "=", "this", ".", "clips", "[", "i", "]", ";", "if",...
Play corresponding clip to a gesture
[ "Play", "corresponding", "clip", "to", "a", "gesture" ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/hand-controls.js#L275-L283
train
Returns the last clip of the given gesture
[ 30522, 3853, 1006, 9218, 1007, 1063, 13075, 12528, 1025, 13075, 1045, 1025, 2005, 1006, 1045, 1027, 1014, 1025, 1045, 1026, 2023, 1012, 15281, 1012, 3091, 1025, 1045, 1009, 1009, 1007, 1063, 12528, 1027, 2023, 1012, 15281, 1031, 1045, 1033,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/Measurement.js
Measurement
function Measurement(sId, sInfo, iStart, iEnd, aCategories) { this.id = sId; this.info = sInfo; this.start = iStart; this.end = iEnd; this.pause = 0; this.resume = 0; this.duration = 0; // used time this.time = 0; // time from start to end this.categories = aCategories; this.average = false; //average duration enabled this.count = 0; //average count this.completeDuration = 0; //complete duration }
javascript
function Measurement(sId, sInfo, iStart, iEnd, aCategories) { this.id = sId; this.info = sInfo; this.start = iStart; this.end = iEnd; this.pause = 0; this.resume = 0; this.duration = 0; // used time this.time = 0; // time from start to end this.categories = aCategories; this.average = false; //average duration enabled this.count = 0; //average count this.completeDuration = 0; //complete duration }
[ "function", "Measurement", "(", "sId", ",", "sInfo", ",", "iStart", ",", "iEnd", ",", "aCategories", ")", "{", "this", ".", "id", "=", "sId", ";", "this", ".", "info", "=", "sInfo", ";", "this", ".", "start", "=", "iStart", ";", "this", ".", "end",...
Single Measurement Entry @public @typedef {object} module:sap/ui/performance/Measurement.Entry @property {string} sId ID of the measurement @property {string} sInfo Info for the measurement @property {int} iStart Start time @property {int} iEnd End time @property {string | string[]} [aCategories="javascript"] An optional list of categories for the measure
[ "Single", "Measurement", "Entry" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/Measurement.js#L37-L50
train
A measurement object
[ 30522, 3853, 10903, 1006, 15765, 1010, 8254, 14876, 1010, 21541, 8445, 1010, 29464, 4859, 1010, 9353, 3686, 20255, 3111, 1007, 1063, 2023, 1012, 8909, 1027, 15765, 1025, 2023, 1012, 18558, 1027, 8254, 14876, 1025, 2023, 1012, 2707, 1027, 21...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
goldfire/howler.js
dist/howler.js
function(id) { var self = this; if (self._endTimers[id]) { // Clear the timeout or remove the ended listener. if (typeof self._endTimers[id] !== 'function') { clearTimeout(self._endTimers[id]); } else { var sound = self._soundById(id); if (sound && sound._node) { sound._node.removeEventListener('ended', self._endTimers[id], false); } } delete self._endTimers[id]; } return self; }
javascript
function(id) { var self = this; if (self._endTimers[id]) { // Clear the timeout or remove the ended listener. if (typeof self._endTimers[id] !== 'function') { clearTimeout(self._endTimers[id]); } else { var sound = self._soundById(id); if (sound && sound._node) { sound._node.removeEventListener('ended', self._endTimers[id], false); } } delete self._endTimers[id]; } return self; }
[ "function", "(", "id", ")", "{", "var", "self", "=", "this", ";", "if", "(", "self", ".", "_endTimers", "[", "id", "]", ")", "{", "// Clear the timeout or remove the ended listener.", "if", "(", "typeof", "self", ".", "_endTimers", "[", "id", "]", "!==", ...
Clear the end timer for a sound playback. @param {Number} id The sound ID. @return {Howl}
[ "Clear", "the", "end", "timer", "for", "a", "sound", "playback", "." ]
030db918dd8ce640afd57e172418472497e8f113
https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L1967-L1985
train
Removes a timeout or a listener for a specific sound
[ 30522, 3853, 1006, 8909, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 2065, 1006, 2969, 1012, 1035, 2203, 7292, 2869, 1031, 8909, 1033, 1007, 1063, 1013, 1013, 3154, 1996, 2051, 5833, 2030, 6366, 1996, 3092, 19373, 1012, 2065, 1006, 2828, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
Microsoft/vscode
build/lib/bundle.js
bundle
function bundle(entryPoints, config, callback) { const entryPointsMap = {}; entryPoints.forEach((module) => { entryPointsMap[module.name] = module; }); const allMentionedModulesMap = {}; entryPoints.forEach((module) => { allMentionedModulesMap[module.name] = true; (module.include || []).forEach(function (includedModule) { allMentionedModulesMap[includedModule] = true; }); (module.exclude || []).forEach(function (excludedModule) { allMentionedModulesMap[excludedModule] = true; }); }); const code = require('fs').readFileSync(path.join(__dirname, '../../src/vs/loader.js')); const r = vm.runInThisContext('(function(require, module, exports) { ' + code + '\n});'); const loaderModule = { exports: {} }; r.call({}, require, loaderModule, loaderModule.exports); const loader = loaderModule.exports; config.isBuild = true; config.paths = config.paths || {}; if (!config.paths['vs/nls']) { config.paths['vs/nls'] = 'out-build/vs/nls.build'; } if (!config.paths['vs/css']) { config.paths['vs/css'] = 'out-build/vs/css.build'; } loader.config(config); loader(['require'], (localRequire) => { const resolvePath = (path) => { const r = localRequire.toUrl(path); if (!/\.js/.test(r)) { return r + '.js'; } return r; }; for (const moduleId in entryPointsMap) { const entryPoint = entryPointsMap[moduleId]; if (entryPoint.append) { entryPoint.append = entryPoint.append.map(resolvePath); } if (entryPoint.prepend) { entryPoint.prepend = entryPoint.prepend.map(resolvePath); } } }); loader(Object.keys(allMentionedModulesMap), () => { const modules = loader.getBuildInfo(); const partialResult = emitEntryPoints(modules, entryPointsMap); const cssInlinedResources = loader('vs/css').getInlinedResources(); callback(null, { files: partialResult.files, cssInlinedResources: cssInlinedResources, bundleData: partialResult.bundleData }); }, (err) => callback(err, null)); }
javascript
function bundle(entryPoints, config, callback) { const entryPointsMap = {}; entryPoints.forEach((module) => { entryPointsMap[module.name] = module; }); const allMentionedModulesMap = {}; entryPoints.forEach((module) => { allMentionedModulesMap[module.name] = true; (module.include || []).forEach(function (includedModule) { allMentionedModulesMap[includedModule] = true; }); (module.exclude || []).forEach(function (excludedModule) { allMentionedModulesMap[excludedModule] = true; }); }); const code = require('fs').readFileSync(path.join(__dirname, '../../src/vs/loader.js')); const r = vm.runInThisContext('(function(require, module, exports) { ' + code + '\n});'); const loaderModule = { exports: {} }; r.call({}, require, loaderModule, loaderModule.exports); const loader = loaderModule.exports; config.isBuild = true; config.paths = config.paths || {}; if (!config.paths['vs/nls']) { config.paths['vs/nls'] = 'out-build/vs/nls.build'; } if (!config.paths['vs/css']) { config.paths['vs/css'] = 'out-build/vs/css.build'; } loader.config(config); loader(['require'], (localRequire) => { const resolvePath = (path) => { const r = localRequire.toUrl(path); if (!/\.js/.test(r)) { return r + '.js'; } return r; }; for (const moduleId in entryPointsMap) { const entryPoint = entryPointsMap[moduleId]; if (entryPoint.append) { entryPoint.append = entryPoint.append.map(resolvePath); } if (entryPoint.prepend) { entryPoint.prepend = entryPoint.prepend.map(resolvePath); } } }); loader(Object.keys(allMentionedModulesMap), () => { const modules = loader.getBuildInfo(); const partialResult = emitEntryPoints(modules, entryPointsMap); const cssInlinedResources = loader('vs/css').getInlinedResources(); callback(null, { files: partialResult.files, cssInlinedResources: cssInlinedResources, bundleData: partialResult.bundleData }); }, (err) => callback(err, null)); }
[ "function", "bundle", "(", "entryPoints", ",", "config", ",", "callback", ")", "{", "const", "entryPointsMap", "=", "{", "}", ";", "entryPoints", ".", "forEach", "(", "(", "module", ")", "=>", "{", "entryPointsMap", "[", "module", ".", "name", "]", "=", ...
Bundle `entryPoints` given config `config`.
[ "Bundle", "entryPoints", "given", "config", "config", "." ]
693a13cd32c5be798051edc0cb43e1e39fc456d9
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/bundle.js#L13-L70
train
Bundle the modules
[ 30522, 3853, 14012, 1006, 4443, 26521, 1010, 9530, 8873, 2290, 1010, 2655, 5963, 1007, 1063, 9530, 3367, 4443, 26521, 2863, 2361, 1027, 1063, 1065, 1025, 4443, 26521, 1012, 18921, 6776, 1006, 1006, 11336, 1007, 1027, 1028, 1063, 4443, 26521...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
TryGhost/Ghost
core/server/services/routing/helpers/fetch-data.js
fetchData
function fetchData(pathOptions, routerOptions, locals) { pathOptions = pathOptions || {}; routerOptions = routerOptions || {}; let postQuery = _.cloneDeep(defaultPostQuery), props = {}; if (routerOptions.filter) { postQuery.options.filter = routerOptions.filter; } if (routerOptions.order) { postQuery.options.order = routerOptions.order; } if (pathOptions.hasOwnProperty('page')) { postQuery.options.page = pathOptions.page; } if (pathOptions.hasOwnProperty('limit')) { postQuery.options.limit = pathOptions.limit; } // CASE: always fetch post entries // The filter can in theory contain a "%s" e.g. filter="primary_tag:%s" props.posts = processQuery(postQuery, pathOptions.slug, locals); // CASE: fetch more data defined by the router e.g. tags, authors - see TaxonomyRouter _.each(routerOptions.data, function (query, name) { const dataQueryOptions = _.merge(query, defaultDataQueryOptions[name]); props[name] = processQuery(dataQueryOptions, pathOptions.slug, locals); }); return Promise.props(props) .then(function formatResponse(results) { const response = _.cloneDeep(results.posts); if (routerOptions.data) { response.data = {}; _.each(routerOptions.data, function (config, name) { response.data[name] = results[name][config.resource]; if (config.type === 'browse') { response.data[name].meta = results[name].meta; // @TODO remove in v3 response.data[name][config.resource] = results[name][config.resource]; } }); } return response; }); }
javascript
function fetchData(pathOptions, routerOptions, locals) { pathOptions = pathOptions || {}; routerOptions = routerOptions || {}; let postQuery = _.cloneDeep(defaultPostQuery), props = {}; if (routerOptions.filter) { postQuery.options.filter = routerOptions.filter; } if (routerOptions.order) { postQuery.options.order = routerOptions.order; } if (pathOptions.hasOwnProperty('page')) { postQuery.options.page = pathOptions.page; } if (pathOptions.hasOwnProperty('limit')) { postQuery.options.limit = pathOptions.limit; } // CASE: always fetch post entries // The filter can in theory contain a "%s" e.g. filter="primary_tag:%s" props.posts = processQuery(postQuery, pathOptions.slug, locals); // CASE: fetch more data defined by the router e.g. tags, authors - see TaxonomyRouter _.each(routerOptions.data, function (query, name) { const dataQueryOptions = _.merge(query, defaultDataQueryOptions[name]); props[name] = processQuery(dataQueryOptions, pathOptions.slug, locals); }); return Promise.props(props) .then(function formatResponse(results) { const response = _.cloneDeep(results.posts); if (routerOptions.data) { response.data = {}; _.each(routerOptions.data, function (config, name) { response.data[name] = results[name][config.resource]; if (config.type === 'browse') { response.data[name].meta = results[name].meta; // @TODO remove in v3 response.data[name][config.resource] = results[name][config.resource]; } }); } return response; }); }
[ "function", "fetchData", "(", "pathOptions", ",", "routerOptions", ",", "locals", ")", "{", "pathOptions", "=", "pathOptions", "||", "{", "}", ";", "routerOptions", "=", "routerOptions", "||", "{", "}", ";", "let", "postQuery", "=", "_", ".", "cloneDeep", ...
@description Fetch data from API helper for controllers. Calls out to get posts per page, builds the final posts query & builds any additional queries Wraps the queries using Promise.props to ensure it gets named responses Does a first round of formatting on the response, and returns
[ "@description", "Fetch", "data", "from", "API", "helper", "for", "controllers", "." ]
bb7bb55cf3e60af99ebbc56099928827b58461bc
https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/services/routing/helpers/fetch-data.js#L78-L131
train
Fetch data from the database
[ 30522, 3853, 18584, 2850, 2696, 1006, 4130, 7361, 9285, 1010, 2799, 18981, 9285, 1010, 10575, 1007, 1063, 4130, 7361, 9285, 1027, 4130, 7361, 9285, 1064, 1064, 1063, 1065, 1025, 2799, 18981, 9285, 1027, 2799, 18981, 9285, 1064, 1064, 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...
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
function (jid, sid, rid, callback, wait, hold, wind) { this._proto._attach(jid, sid, rid, callback, wait, hold, wind); }
javascript
function (jid, sid, rid, callback, wait, hold, wind) { this._proto._attach(jid, sid, rid, callback, wait, hold, wind); }
[ "function", "(", "jid", ",", "sid", ",", "rid", ",", "callback", ",", "wait", ",", "hold", ",", "wind", ")", "{", "this", ".", "_proto", ".", "_attach", "(", "jid", ",", "sid", ",", "rid", ",", "callback", ",", "wait", ",", "hold", ",", "wind", ...
Function: attach Attach to an already created and authenticated BOSH session. This function is provided to allow Strophe to attach to BOSH sessions which have been created externally, perhaps by a Web application. This is often used to support auto-login type features without putting user credentials into the page. Parameters: (String) jid - The full JID that is bound by the session. (String) sid - The SID of the BOSH session. (String) rid - The current RID of the BOSH session. This RID will be used by the next request. (Function) callback The connect callback function. (Integer) wait - The optional HTTPBIND wait value. This is the time the server will wait before returning an empty result for a request. The default setting of 60 seconds is recommended. Other settings will require tweaks to the Strophe.TIMEOUT value. (Integer) hold - The optional HTTPBIND hold value. This is the number of connections the server will hold at one time. This should almost always be set to 1 (the default). (Integer) wind - The optional HTTBIND window value. This is the allowed range of request ids that are valid. The default is 5.
[ "Function", ":", "attach", "Attach", "to", "an", "already", "created", "and", "authenticated", "BOSH", "session", "." ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L2309-L2312
train
Attach a new node to the cluster
[ 30522, 3853, 1006, 10147, 2094, 1010, 15765, 1010, 9436, 1010, 2655, 5963, 1010, 3524, 1010, 2907, 1010, 3612, 1007, 1063, 2023, 1012, 1035, 15053, 1012, 1035, 22476, 1006, 10147, 2094, 1010, 15765, 1010, 9436, 1010, 2655, 5963, 1010, 3524,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_getElements
function addonsManager_getElements(aSpec) { var spec = aSpec || { }; var type = spec.type; var subtype = spec.subtype; var value = spec.value; var parent = spec.parent; var root = parent ? parent.getNode() : this._controller.tabs.activeTab; var nodeCollector = new domUtils.nodeCollector(root); switch (type) { // Add-ons case "addons": nodeCollector.queryNodes(".addon").filterByDOMProperty(subtype, value); break; case "addonsList": nodeCollector.queryNodes("#addon-list"); break; // Categories case "categoriesList": nodeCollector.queryNodes("#categories"); break; case "categories": nodeCollector.queryNodes(".category").filterByDOMProperty(subtype, value); break; // Detail view case "detailView_element": nodeCollector.queryNodes(value); break; case "detailView_disableButton": nodeCollector.queryNodes("#detail-disable"); break; case "detailView_enableButton": nodeCollector.queryNodes("#detail-enable"); break; case "detailView_installButton": nodeCollector.queryNodes("#detail-install"); break; case "detailView_preferencesButton": nodeCollector.queryNodes("#detail-prefs"); break; case "detailView_removeButton": nodeCollector.queryNodes("#detail-uninstall"); break; case "detailView_findUpdatesLink": nodeCollector.queryNodes("#detail-findUpdates"); break; // Bug 599771 - button-link's are missing id or anonid //case "detailView_restartLink": // nodeCollector.queryNodes("#detail-restart"); // break; case "detailView_undoLink": nodeCollector.queryNodes("#detail-undo"); break; case "detailView_findUpdatesRadiogroup": nodeCollector.queryNodes("#detail-findUpdates"); break; // List view case "listView_element": nodeCollector.queryAnonymousNodes(subtype, value); break; case "listView_disableButton": nodeCollector.queryAnonymousNodes("anonid", "disable-btn"); break; case "listView_enableButton": nodeCollector.queryAnonymousNodes("anonid", "enable-btn"); break; case "listView_installButton": // There is another binding we will have to skip nodeCollector.queryAnonymousNodes("anonid", "install-status"); nodeCollector.root = nodeCollector.nodes[0]; nodeCollector.queryAnonymousNodes("anonid", "install-remote"); break; case "listView_preferencesButton": nodeCollector.queryAnonymousNodes("anonid", "preferences-btn"); break; case "listView_removeButton": nodeCollector.queryAnonymousNodes("anonid", "remove-btn"); break; case "listView_moreLink": // Bug 599771 - button-link's are missing id or anonid nodeCollector.queryAnonymousNodes("class", "details button-link"); break; // Bug 599771 - button-link's are missing id or anonid //case "listView_restartLink": // nodeCollector.queryAnonymousNodes("anonid", "restart"); // break; case "listView_undoLink": nodeCollector.queryAnonymousNodes("anonid", "undo"); break; case "listView_cancelDownload": // There is another binding we will have to skip nodeCollector.queryAnonymousNodes("anonid", "install-status"); nodeCollector.root = nodeCollector.nodes[0]; nodeCollector.queryAnonymousNodes("anonid", "cancel"); break; case "listView_pauseDownload": // There is another binding we will have to skip nodeCollector.queryAnonymousNodes("anonid", "install-status"); nodeCollector.root = nodeCollector.nodes[0]; nodeCollector.queryAnonymousNodes("anonid", "pause"); break; case "listView_progressDownload": // There is another binding we will have to skip nodeCollector.queryAnonymousNodes("anonid", "install-status"); nodeCollector.root = nodeCollector.nodes[0]; nodeCollector.queryAnonymousNodes("anonid", "progress"); break; // Search // Bug 599775 - Controller needs to handle radio groups correctly // Means for now we have to use the radio buttons case "search_filterRadioButtons": nodeCollector.queryNodes(".search-filter-radio").filterByDOMProperty(subtype, value); break; case "search_filterRadioGroup": nodeCollector.queryNodes("#search-filter-radiogroup"); break; case "search_textbox": nodeCollector.queryNodes("#header-search"); break; case "search_throbber": nodeCollector.queryNodes("#header-searching"); break; // Utils case "utilsButton": nodeCollector.queryNodes("#header-utils-btn"); break; case "utilsButton_menu": nodeCollector.queryNodes("#utils-menu"); break; case "utilsButton_menuItem": nodeCollector.queryNodes(value); break; // Views case "viewDeck": nodeCollector.queryNodes("#view-port"); break; case "views": nodeCollector.queryNodes(".view-pane").filterByDOMProperty(subtype, value); break; default: throw new Error(arguments.callee.name + ": Unknown element type - " + spec.type); } return nodeCollector.elements; }
javascript
function addonsManager_getElements(aSpec) { var spec = aSpec || { }; var type = spec.type; var subtype = spec.subtype; var value = spec.value; var parent = spec.parent; var root = parent ? parent.getNode() : this._controller.tabs.activeTab; var nodeCollector = new domUtils.nodeCollector(root); switch (type) { // Add-ons case "addons": nodeCollector.queryNodes(".addon").filterByDOMProperty(subtype, value); break; case "addonsList": nodeCollector.queryNodes("#addon-list"); break; // Categories case "categoriesList": nodeCollector.queryNodes("#categories"); break; case "categories": nodeCollector.queryNodes(".category").filterByDOMProperty(subtype, value); break; // Detail view case "detailView_element": nodeCollector.queryNodes(value); break; case "detailView_disableButton": nodeCollector.queryNodes("#detail-disable"); break; case "detailView_enableButton": nodeCollector.queryNodes("#detail-enable"); break; case "detailView_installButton": nodeCollector.queryNodes("#detail-install"); break; case "detailView_preferencesButton": nodeCollector.queryNodes("#detail-prefs"); break; case "detailView_removeButton": nodeCollector.queryNodes("#detail-uninstall"); break; case "detailView_findUpdatesLink": nodeCollector.queryNodes("#detail-findUpdates"); break; // Bug 599771 - button-link's are missing id or anonid //case "detailView_restartLink": // nodeCollector.queryNodes("#detail-restart"); // break; case "detailView_undoLink": nodeCollector.queryNodes("#detail-undo"); break; case "detailView_findUpdatesRadiogroup": nodeCollector.queryNodes("#detail-findUpdates"); break; // List view case "listView_element": nodeCollector.queryAnonymousNodes(subtype, value); break; case "listView_disableButton": nodeCollector.queryAnonymousNodes("anonid", "disable-btn"); break; case "listView_enableButton": nodeCollector.queryAnonymousNodes("anonid", "enable-btn"); break; case "listView_installButton": // There is another binding we will have to skip nodeCollector.queryAnonymousNodes("anonid", "install-status"); nodeCollector.root = nodeCollector.nodes[0]; nodeCollector.queryAnonymousNodes("anonid", "install-remote"); break; case "listView_preferencesButton": nodeCollector.queryAnonymousNodes("anonid", "preferences-btn"); break; case "listView_removeButton": nodeCollector.queryAnonymousNodes("anonid", "remove-btn"); break; case "listView_moreLink": // Bug 599771 - button-link's are missing id or anonid nodeCollector.queryAnonymousNodes("class", "details button-link"); break; // Bug 599771 - button-link's are missing id or anonid //case "listView_restartLink": // nodeCollector.queryAnonymousNodes("anonid", "restart"); // break; case "listView_undoLink": nodeCollector.queryAnonymousNodes("anonid", "undo"); break; case "listView_cancelDownload": // There is another binding we will have to skip nodeCollector.queryAnonymousNodes("anonid", "install-status"); nodeCollector.root = nodeCollector.nodes[0]; nodeCollector.queryAnonymousNodes("anonid", "cancel"); break; case "listView_pauseDownload": // There is another binding we will have to skip nodeCollector.queryAnonymousNodes("anonid", "install-status"); nodeCollector.root = nodeCollector.nodes[0]; nodeCollector.queryAnonymousNodes("anonid", "pause"); break; case "listView_progressDownload": // There is another binding we will have to skip nodeCollector.queryAnonymousNodes("anonid", "install-status"); nodeCollector.root = nodeCollector.nodes[0]; nodeCollector.queryAnonymousNodes("anonid", "progress"); break; // Search // Bug 599775 - Controller needs to handle radio groups correctly // Means for now we have to use the radio buttons case "search_filterRadioButtons": nodeCollector.queryNodes(".search-filter-radio").filterByDOMProperty(subtype, value); break; case "search_filterRadioGroup": nodeCollector.queryNodes("#search-filter-radiogroup"); break; case "search_textbox": nodeCollector.queryNodes("#header-search"); break; case "search_throbber": nodeCollector.queryNodes("#header-searching"); break; // Utils case "utilsButton": nodeCollector.queryNodes("#header-utils-btn"); break; case "utilsButton_menu": nodeCollector.queryNodes("#utils-menu"); break; case "utilsButton_menuItem": nodeCollector.queryNodes(value); break; // Views case "viewDeck": nodeCollector.queryNodes("#view-port"); break; case "views": nodeCollector.queryNodes(".view-pane").filterByDOMProperty(subtype, value); break; default: throw new Error(arguments.callee.name + ": Unknown element type - " + spec.type); } return nodeCollector.elements; }
[ "function", "addonsManager_getElements", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "type", "=", "spec", ".", "type", ";", "var", "subtype", "=", "spec", ".", "subtype", ";", "var", "value", "=", "spec", ".", "va...
Retrieve list of UI elements based on the given specification @param {object} aSpec Information of the UI elements which should be retrieved Elements: type - Identifier of the element subtype - Attribute of the element to filter [optional - default: ""] value - Value of the attribute to filter [optional - default: ""] parent - Parent of the to find element [optional - default: document] @returns Elements which have been found @type {array of ElemBase}
[ "Retrieve", "list", "of", "UI", "elements", "based", "on", "the", "given", "specification" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L1081-L1226
train
Returns the elements of the add - ons
[ 30522, 3853, 5587, 5644, 24805, 4590, 1035, 2131, 12260, 8163, 1006, 2004, 5051, 2278, 1007, 1063, 13075, 28699, 1027, 2004, 5051, 2278, 1064, 1064, 1063, 1065, 1025, 13075, 2828, 1027, 28699, 1012, 2828, 1025, 13075, 4942, 13874, 1027, 286...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/padding-line-between-statements.js
getPaddingLineSequences
function getPaddingLineSequences(prevNode, nextNode) { const pairs = []; let prevToken = getActualLastToken(sourceCode, prevNode); if (nextNode.loc.start.line - prevToken.loc.end.line >= 2) { do { const token = sourceCode.getTokenAfter( prevToken, { includeComments: true } ); if (token.loc.start.line - prevToken.loc.end.line >= 2) { pairs.push([prevToken, token]); } prevToken = token; } while (prevToken.range[0] < nextNode.range[0]); } return pairs; }
javascript
function getPaddingLineSequences(prevNode, nextNode) { const pairs = []; let prevToken = getActualLastToken(sourceCode, prevNode); if (nextNode.loc.start.line - prevToken.loc.end.line >= 2) { do { const token = sourceCode.getTokenAfter( prevToken, { includeComments: true } ); if (token.loc.start.line - prevToken.loc.end.line >= 2) { pairs.push([prevToken, token]); } prevToken = token; } while (prevToken.range[0] < nextNode.range[0]); } return pairs; }
[ "function", "getPaddingLineSequences", "(", "prevNode", ",", "nextNode", ")", "{", "const", "pairs", "=", "[", "]", ";", "let", "prevToken", "=", "getActualLastToken", "(", "sourceCode", ",", "prevNode", ")", ";", "if", "(", "nextNode", ".", "loc", ".", "s...
Gets padding line sequences between the given 2 statements. Comments are separators of the padding line sequences. @param {ASTNode} prevNode The previous statement to count. @param {ASTNode} nextNode The current statement to count. @returns {Array<Token[]>} The array of token pairs. @private
[ "Gets", "padding", "line", "sequences", "between", "the", "given", "2", "statements", ".", "Comments", "are", "separators", "of", "the", "padding", "line", "sequences", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/padding-line-between-statements.js#L563-L583
train
get padding line sequences
[ 30522, 3853, 2131, 15455, 4667, 12735, 2063, 4226, 5897, 2015, 1006, 3653, 16022, 10244, 1010, 2279, 3630, 3207, 1007, 1063, 9530, 3367, 7689, 1027, 1031, 1033, 1025, 2292, 3653, 2615, 18715, 2368, 1027, 2131, 18908, 8787, 8523, 9284, 7520,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/view/MainViewManager.js
_doSplit
function _doSplit(orientation) { var firstPane, newPane; if (orientation === _orientation) { return; } firstPane = _panes[FIRST_PANE]; Resizer.removeSizable(firstPane.$el); if (_orientation) { _$el.removeClass("split-" + _orientation.toLowerCase()); } _$el.addClass("split-" + orientation.toLowerCase()); _orientation = orientation; newPane = _createPaneIfNecessary(SECOND_PANE); _makeFirstPaneResizable(); // reset the layout to 50/50 split // if we changed orientation then // the percentages are reset as well _initialLayout(); exports.trigger("paneLayoutChange", _orientation); // if new pane was created, and original pane is not empty, make new pane the active pane if (newPane && getCurrentlyViewedFile(firstPane.id)) { setActivePaneId(newPane.id); } }
javascript
function _doSplit(orientation) { var firstPane, newPane; if (orientation === _orientation) { return; } firstPane = _panes[FIRST_PANE]; Resizer.removeSizable(firstPane.$el); if (_orientation) { _$el.removeClass("split-" + _orientation.toLowerCase()); } _$el.addClass("split-" + orientation.toLowerCase()); _orientation = orientation; newPane = _createPaneIfNecessary(SECOND_PANE); _makeFirstPaneResizable(); // reset the layout to 50/50 split // if we changed orientation then // the percentages are reset as well _initialLayout(); exports.trigger("paneLayoutChange", _orientation); // if new pane was created, and original pane is not empty, make new pane the active pane if (newPane && getCurrentlyViewedFile(firstPane.id)) { setActivePaneId(newPane.id); } }
[ "function", "_doSplit", "(", "orientation", ")", "{", "var", "firstPane", ",", "newPane", ";", "if", "(", "orientation", "===", "_orientation", ")", "{", "return", ";", "}", "firstPane", "=", "_panes", "[", "FIRST_PANE", "]", ";", "Resizer", ".", "removeSi...
Creates a split for the specified orientation @private @param {!string} orientation (VERTICAL|HORIZONTAL)
[ "Creates", "a", "split", "for", "the", "specified", "orientation" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L1154-L1184
train
Split the pane in the specified orientation
[ 30522, 3853, 1035, 9998, 24759, 4183, 1006, 10296, 1007, 1063, 13075, 2034, 9739, 2063, 1010, 2047, 9739, 2063, 1025, 2065, 1006, 10296, 1027, 1027, 1027, 1035, 10296, 1007, 1063, 2709, 1025, 1065, 2034, 9739, 2063, 1027, 1035, 6090, 2229, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
wuchangming/spy-debugger
buildin_modules/weinre/web/index.js
replaceText
function replaceText(id, text) { var element = document.getElementById(id) if (null == element) { // alert("error: can't find element with id '" + id + "'") return } element.innerHTML = text }
javascript
function replaceText(id, text) { var element = document.getElementById(id) if (null == element) { // alert("error: can't find element with id '" + id + "'") return } element.innerHTML = text }
[ "function", "replaceText", "(", "id", ",", "text", ")", "{", "var", "element", "=", "document", ".", "getElementById", "(", "id", ")", "if", "(", "null", "==", "element", ")", "{", "// alert(\"error: can't find element with id '\" + id + \"'\")", "return", "}...
---------------------------------------------------------------------
[ "---------------------------------------------------------------------" ]
55c1dda0dff0c44920673711656ddfd7ff03c307
https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/index.js#L101-L109
train
replace text with id
[ 30522, 3853, 5672, 18209, 1006, 8909, 1010, 3793, 1007, 1063, 13075, 5783, 1027, 6254, 1012, 2131, 12260, 3672, 3762, 3593, 1006, 8909, 1007, 2065, 1006, 19701, 1027, 1027, 5783, 1007, 1063, 1013, 1013, 9499, 1006, 1000, 7561, 1024, 2064, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/date/Persian.js
toPersian
function toPersian(oGregorian) { var iJulianDayNumber = g2d(oGregorian.year, oGregorian.month + 1, oGregorian.day); return d2j(iJulianDayNumber); }
javascript
function toPersian(oGregorian) { var iJulianDayNumber = g2d(oGregorian.year, oGregorian.month + 1, oGregorian.day); return d2j(iJulianDayNumber); }
[ "function", "toPersian", "(", "oGregorian", ")", "{", "var", "iJulianDayNumber", "=", "g2d", "(", "oGregorian", ".", "year", ",", "oGregorian", ".", "month", "+", "1", ",", "oGregorian", ".", "day", ")", ";", "return", "d2j", "(", "iJulianDayNumber", ")", ...
Calculate Persian date from gregorian @param {object} oGregorian a JS object containing day, month and year in the gregorian calendar @private
[ "Calculate", "Persian", "date", "from", "gregorian" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/date/Persian.js#L50-L53
train
Converts a gregorian date to Persian
[ 30522, 3853, 2327, 2545, 2937, 1006, 13958, 2890, 20255, 2937, 1007, 1063, 13075, 1045, 9103, 15204, 10259, 19172, 5677, 1027, 1043, 2475, 2094, 30524, 1012, 2154, 1007, 1025, 2709, 1040, 2475, 3501, 1006, 1045, 9103, 15204, 10259, 19172, 5...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/controls/ObjectViewer.js
RenderContext
function RenderContext() { this._aBuffer = []; var that = this; this.add = function() { that._aBuffer.push.apply(that._aBuffer, arguments); }; this.addWithParam = function(s, o) { for (var n in o) { var reg = new RegExp("\{" + n + "\}","g"); s = s.replace(reg,o[n]); } that.add(s); }; this.toString = function() { return that._aBuffer.join(""); }; }
javascript
function RenderContext() { this._aBuffer = []; var that = this; this.add = function() { that._aBuffer.push.apply(that._aBuffer, arguments); }; this.addWithParam = function(s, o) { for (var n in o) { var reg = new RegExp("\{" + n + "\}","g"); s = s.replace(reg,o[n]); } that.add(s); }; this.toString = function() { return that._aBuffer.join(""); }; }
[ "function", "RenderContext", "(", ")", "{", "this", ".", "_aBuffer", "=", "[", "]", ";", "var", "that", "=", "this", ";", "this", ".", "add", "=", "function", "(", ")", "{", "that", ".", "_aBuffer", ".", "push", ".", "apply", "(", "that", ".", "_...
function _visitObject(oObject, oRenderContext) { //not implemented };
[ "function", "_visitObject", "(", "oObject", "oRenderContext", ")", "{", "//", "not", "implemented", "}", ";" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/controls/ObjectViewer.js#L148-L164
train
The RenderContext class
[ 30522, 3853, 17552, 8663, 18209, 1006, 1007, 1063, 2023, 1012, 1035, 8273, 12494, 1027, 1031, 1033, 1025, 13075, 2008, 1027, 2023, 1025, 2023, 1012, 5587, 1027, 3853, 1006, 1007, 1063, 2008, 1012, 1035, 8273, 12494, 1012, 5245, 1012, 6611, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/command/KeyBindingManager.js
_readUserKeyMap
function _readUserKeyMap() { var file = FileSystem.getFileForPath(_getUserKeyMapFilePath()), result = new $.Deferred(); file.exists(function (err, doesExist) { if (doesExist) { FileUtils.readAsText(file) .done(function (text) { var keyMap = {}; try { if (text) { var json = JSON.parse(text); // If no overrides, return an empty key map. result.resolve((json && json.overrides) || keyMap); } else { // The file is empty, so return an empty key map. result.resolve(keyMap); } } catch (err) { // Cannot parse the text read from the key map file. result.reject(err); } }) .fail(function (err) { // Key map file cannot be loaded. result.reject(err); }); } else { // Just resolve if no user key map file result.resolve(); } }); return result.promise(); }
javascript
function _readUserKeyMap() { var file = FileSystem.getFileForPath(_getUserKeyMapFilePath()), result = new $.Deferred(); file.exists(function (err, doesExist) { if (doesExist) { FileUtils.readAsText(file) .done(function (text) { var keyMap = {}; try { if (text) { var json = JSON.parse(text); // If no overrides, return an empty key map. result.resolve((json && json.overrides) || keyMap); } else { // The file is empty, so return an empty key map. result.resolve(keyMap); } } catch (err) { // Cannot parse the text read from the key map file. result.reject(err); } }) .fail(function (err) { // Key map file cannot be loaded. result.reject(err); }); } else { // Just resolve if no user key map file result.resolve(); } }); return result.promise(); }
[ "function", "_readUserKeyMap", "(", ")", "{", "var", "file", "=", "FileSystem", ".", "getFileForPath", "(", "_getUserKeyMapFilePath", "(", ")", ")", ",", "result", "=", "new", "$", ".", "Deferred", "(", ")", ";", "file", ".", "exists", "(", "function", "...
@private Reads in the user key map file and parses its content into JSON. Returns the user key bindings if JSON has "overrides". Otherwise, returns an empty object or an error if the file cannot be parsed or loaded. @return {$.Promise} a jQuery promise that will be resolved with the JSON object if the user key map file has "overrides" property or an empty JSON. If the key map file cannot be read or cannot be parsed by the JSON parser, then the promise is rejected with an error.
[ "@private" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/KeyBindingManager.js#L1305-L1338
train
Reads the user key map file
[ 30522, 3853, 1035, 3191, 20330, 14839, 2863, 2361, 1006, 1007, 1063, 13075, 5371, 1027, 6764, 27268, 6633, 1012, 2131, 8873, 2571, 29278, 15069, 1006, 1035, 2131, 20330, 14839, 2863, 14376, 9463, 15069, 1006, 1007, 1007, 1010, 2765, 1027, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/view/MainViewManager.js
_edit
function _edit(paneId, doc, optionsIn) { var options = optionsIn || {}; var pane = _getPane(paneId); // If file is untitled or otherwise not within project tree, add it to // working set right now (don't wait for it to become dirty) if (doc.isUntitled() || !ProjectManager.isWithinProject(doc.file.fullPath)) { addToWorkingSet(paneId, doc.file); } // open document will show the editor if there is one already EditorManager.openDocument(doc, pane, options); _makeFileMostRecent(paneId, doc.file); if (!options.noPaneActivate) { setActivePaneId(paneId); } }
javascript
function _edit(paneId, doc, optionsIn) { var options = optionsIn || {}; var pane = _getPane(paneId); // If file is untitled or otherwise not within project tree, add it to // working set right now (don't wait for it to become dirty) if (doc.isUntitled() || !ProjectManager.isWithinProject(doc.file.fullPath)) { addToWorkingSet(paneId, doc.file); } // open document will show the editor if there is one already EditorManager.openDocument(doc, pane, options); _makeFileMostRecent(paneId, doc.file); if (!options.noPaneActivate) { setActivePaneId(paneId); } }
[ "function", "_edit", "(", "paneId", ",", "doc", ",", "optionsIn", ")", "{", "var", "options", "=", "optionsIn", "||", "{", "}", ";", "var", "pane", "=", "_getPane", "(", "paneId", ")", ";", "// If file is untitled or otherwise not within project tree, add it to", ...
Edits a document in the specified pane. This function is only used by: - Unit Tests (which construct Mock Document objects), - by File > New because there is yet to be an established File object - by Find In Files which needs to open documents synchronously in some cases Do not use this API it is for internal use only @param {!string} paneId - id of the pane in which to open the document @param {!Document} doc - document to edit @param {{noPaneActivate:boolean=}=} optionsIn - options @private
[ "Edits", "a", "document", "in", "the", "specified", "pane", ".", "This", "function", "is", "only", "used", "by", ":", "-", "Unit", "Tests", "(", "which", "construct", "Mock", "Document", "objects", ")", "-", "by", "File", ">", "New", "because", "there", ...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L1198-L1216
train
Edit a document
[ 30522, 3853, 1035, 10086, 1006, 6090, 7416, 2094, 1010, 9986, 1010, 7047, 2378, 1007, 1063, 13075, 7047, 1027, 7047, 2378, 1064, 1064, 1063, 1065, 1025, 13075, 6090, 2063, 1027, 1035, 2131, 9739, 2063, 1006, 6090, 7416, 2094, 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...
SAP/openui5
src/sap.ui.demokit/src/sap/ui/demokit/demoapps/controller/App.controller.js
function (oEvent) { var oSelectedItem = oEvent.getParameters().selectedItem, oListItem = oSelectedItem ? oSelectedItem : oEvent.getSource().getParent(); this._oDownloadButton.setBusy(true); sap.ui.require([ "sap/ui/core/util/File", "sap/ui/thirdparty/jszip" ], function (oFile) { var oZipFile = new JSZip(); // load the config file from the custom data attached to the list item $.getJSON(oListItem.data("config"), function (oConfig) { var aFiles = oConfig.files, aPromises = [], aFails = []; // add extra download files aFiles.forEach(function(sFilePath) { var oPromise = sourceFileDownloader(oConfig.cwd + sFilePath); oPromise.then(function (oContent) { if (oContent.errorMessage) { // promise gets resolved in error case since Promise.all will not wait for all fails aFails.push(oContent.errorMessage); } else { // exclude relative paths outside of the app root (e.g. commong helpers, images, ...) if (!sFilePath.startsWith("../")) { oZipFile.file(sFilePath, oContent, {base64: false, binary: true}); } } }); aPromises.push(oPromise); }); Promise.all(aPromises).then(function () { // collect errors and show them if (aFails.length) { var sCompleteErrorMessage = aFails.reduce(function (sErrorMessage, sError) { return sErrorMessage + sError + "\n"; }, "Could not locate the following download files:\n"); this._handleError(sCompleteErrorMessage); } // show success message this._oDownloadButton.setBusy(false); MessageToast.show("Downloading for app \"" + oListItem.getLabel() + "\" has been started"); // still make the available files ready for download var oContent = oZipFile.generate({type:"blob"}); this._createArchive(oFile, oContent, oListItem.getLabel()); }.bind(this)); }.bind(this)); }.bind(this)); }
javascript
function (oEvent) { var oSelectedItem = oEvent.getParameters().selectedItem, oListItem = oSelectedItem ? oSelectedItem : oEvent.getSource().getParent(); this._oDownloadButton.setBusy(true); sap.ui.require([ "sap/ui/core/util/File", "sap/ui/thirdparty/jszip" ], function (oFile) { var oZipFile = new JSZip(); // load the config file from the custom data attached to the list item $.getJSON(oListItem.data("config"), function (oConfig) { var aFiles = oConfig.files, aPromises = [], aFails = []; // add extra download files aFiles.forEach(function(sFilePath) { var oPromise = sourceFileDownloader(oConfig.cwd + sFilePath); oPromise.then(function (oContent) { if (oContent.errorMessage) { // promise gets resolved in error case since Promise.all will not wait for all fails aFails.push(oContent.errorMessage); } else { // exclude relative paths outside of the app root (e.g. commong helpers, images, ...) if (!sFilePath.startsWith("../")) { oZipFile.file(sFilePath, oContent, {base64: false, binary: true}); } } }); aPromises.push(oPromise); }); Promise.all(aPromises).then(function () { // collect errors and show them if (aFails.length) { var sCompleteErrorMessage = aFails.reduce(function (sErrorMessage, sError) { return sErrorMessage + sError + "\n"; }, "Could not locate the following download files:\n"); this._handleError(sCompleteErrorMessage); } // show success message this._oDownloadButton.setBusy(false); MessageToast.show("Downloading for app \"" + oListItem.getLabel() + "\" has been started"); // still make the available files ready for download var oContent = oZipFile.generate({type:"blob"}); this._createArchive(oFile, oContent, oListItem.getLabel()); }.bind(this)); }.bind(this)); }.bind(this)); }
[ "function", "(", "oEvent", ")", "{", "var", "oSelectedItem", "=", "oEvent", ".", "getParameters", "(", ")", ".", "selectedItem", ",", "oListItem", "=", "oSelectedItem", "?", "oSelectedItem", ":", "oEvent", ".", "getSource", "(", ")", ".", "getParent", "(", ...
Downloads a demo app @param {sap.ui.base.Event} oEvent the Button press event @public
[ "Downloads", "a", "demo", "app" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/demoapps/controller/App.controller.js#L58-L112
train
Downloads the files from the selected item
[ 30522, 3853, 1006, 1051, 18697, 3372, 1007, 1063, 13075, 9808, 12260, 10985, 4221, 2213, 1027, 1051, 18697, 3372, 1012, 2131, 28689, 22828, 2015, 1006, 1007, 1012, 3479, 4221, 2213, 1010, 19330, 2923, 4221, 2213, 1027, 9808, 12260, 10985, 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...
SAP/openui5
src/sap.ui.commons/src/sap/ui/commons/RoadMapRenderer.js
function(oStep, sLabel){ var bIsExpandable = oStep.getParent() instanceof sap.ui.commons.RoadMap && oStep.getSubSteps().length > 0; var sResult = sLabel || ""; if (oStep.getEnabled()) { sResult = getText(bIsExpandable ? "RDMP_ARIA_EXPANDABLE_STEP" : "RDMP_ARIA_STANDARD_STEP", [sResult]); } return sResult; }
javascript
function(oStep, sLabel){ var bIsExpandable = oStep.getParent() instanceof sap.ui.commons.RoadMap && oStep.getSubSteps().length > 0; var sResult = sLabel || ""; if (oStep.getEnabled()) { sResult = getText(bIsExpandable ? "RDMP_ARIA_EXPANDABLE_STEP" : "RDMP_ARIA_STANDARD_STEP", [sResult]); } return sResult; }
[ "function", "(", "oStep", ",", "sLabel", ")", "{", "var", "bIsExpandable", "=", "oStep", ".", "getParent", "(", ")", "instanceof", "sap", ".", "ui", ".", "commons", ".", "RoadMap", "&&", "oStep", ".", "getSubSteps", "(", ")", ".", "length", ">", "0", ...
Computes how the aria-label property should be set for the given step
[ "Computes", "how", "the", "aria", "-", "label", "property", "should", "be", "set", "for", "the", "given", "step" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/RoadMapRenderer.js#L676-L685
train
Returns the label for the given step
[ 30522, 3853, 1006, 9808, 2618, 2361, 1010, 17584, 2884, 1007, 1063, 13075, 20377, 10288, 9739, 20782, 1027, 9808, 2618, 2361, 1012, 2131, 19362, 4765, 1006, 1007, 6013, 11253, 20066, 1012, 21318, 1012, 7674, 1012, 2346, 2863, 2361, 1004, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/InlineTimingFunctionEditor/BezierCurveEditor.js
function (element) { var p = this.padding, w = this.canvas.width, h = this.canvas.height * 0.5; // Convert padding percentage to actual padding p = p.map(function (a, i) { return a * ((i % 2) ? w : h); }); return [ this.prettify((parseInt($(element).css("left"), 10) - p[3]) / (w + p[1] + p[3])), this.prettify((h - parseInt($(element).css("top"), 10) - p[2]) / (h - p[0] - p[2])) ]; }
javascript
function (element) { var p = this.padding, w = this.canvas.width, h = this.canvas.height * 0.5; // Convert padding percentage to actual padding p = p.map(function (a, i) { return a * ((i % 2) ? w : h); }); return [ this.prettify((parseInt($(element).css("left"), 10) - p[3]) / (w + p[1] + p[3])), this.prettify((h - parseInt($(element).css("top"), 10) - p[2]) / (h - p[0] - p[2])) ]; }
[ "function", "(", "element", ")", "{", "var", "p", "=", "this", ".", "padding", ",", "w", "=", "this", ".", "canvas", ".", "width", ",", "h", "=", "this", ".", "canvas", ".", "height", "*", "0.5", ";", "// Convert padding percentage to actual padding", "p...
Get CSS left, top offsets for endpoint handle @param {Element} element Endpoint handle <button> element @return {Array.string[2]}
[ "Get", "CSS", "left", "top", "offsets", "for", "endpoint", "handle" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/BezierCurveEditor.js#L129-L143
train
Returns an array of padding percentage values
[ 30522, 3853, 1006, 5783, 1007, 1063, 13075, 1052, 1027, 2023, 1012, 11687, 4667, 1010, 1059, 1027, 2023, 1012, 10683, 1012, 9381, 1010, 1044, 1027, 2023, 1012, 10683, 1012, 4578, 1008, 1014, 1012, 1019, 1025, 1013, 1013, 10463, 11687, 4667,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/space-unary-ops.js
verifyWordHasSpaces
function verifyWordHasSpaces(node, firstToken, secondToken, word) { if (secondToken.range[0] === firstToken.range[1]) { context.report({ node, messageId: "wordOperator", data: { word }, fix(fixer) { return fixer.insertTextAfter(firstToken, " "); } }); } }
javascript
function verifyWordHasSpaces(node, firstToken, secondToken, word) { if (secondToken.range[0] === firstToken.range[1]) { context.report({ node, messageId: "wordOperator", data: { word }, fix(fixer) { return fixer.insertTextAfter(firstToken, " "); } }); } }
[ "function", "verifyWordHasSpaces", "(", "node", ",", "firstToken", ",", "secondToken", ",", "word", ")", "{", "if", "(", "secondToken", ".", "range", "[", "0", "]", "===", "firstToken", ".", "range", "[", "1", "]", ")", "{", "context", ".", "report", "...
Verify Unary Word Operator has spaces after the word operator @param {ASTnode} node AST node @param {Object} firstToken first token from the AST node @param {Object} secondToken second token from the AST node @param {string} word The word to be used for reporting @returns {void}
[ "Verify", "Unary", "Word", "Operator", "has", "spaces", "after", "the", "word", "operator" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/space-unary-ops.js#L107-L120
train
Verify word has spaces
[ 30522, 3853, 20410, 18351, 14949, 23058, 2015, 1006, 13045, 1010, 2034, 18715, 2368, 1010, 2117, 18715, 2368, 1010, 2773, 1007, 1063, 2065, 1006, 2117, 18715, 2368, 1012, 2846, 1031, 1014, 1033, 1027, 1027, 1027, 2034, 18715, 2368, 1012, 28...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jhipster/generator-jhipster
generators/aws-containers/prompts.js
askForSubnets
function askForSubnets() { if (this.abort) return null; const done = this.async(); const subnetList = _.map(this.awsFacts.availableSubnets, sn => { const friendlyName = _getFriendlyNameFromTag(sn); const formattedFriendlyName = friendlyName ? `name: '${friendlyName}', ` : ''; return { name: `${sn.SubnetId} (${formattedFriendlyName}Availability Zone: ${sn.AvailabilityZone}, Public IP On Launch: ${ sn.MapPublicIpOnLaunch ? 'yes' : 'no' })`, value: sn.SubnetId, short: sn.SubnetId }; }); const defaultSubnetValue = storedSubnetValue => storedSubnetValue || [_.get(this.awsFacts.availableSubnets, '[0].SubnetId'), _.get(this.awsFacts.availableSubnets, '[1].SubnetId')]; const validateSubnet = input => _.isEmpty(input) || (_.isArray(input) && input.length < 2) ? 'You must select two or more subnets' : true; const prompts = [ { type: 'checkbox', name: 'elbSubnets', message: `Which subnets should we deploy the ${chalk.yellow('Network Load Balancer (ELB)')} to?`, choices: subnetList, default: defaultSubnetValue(this.aws.vpc.elbSubnets), validate: validateSubnet }, { type: 'checkbox', name: 'appSubnets', message: `Which subnets should we deploy the ${chalk.yellow('Application & Database')} to?`, choices: subnetList, default: defaultSubnetValue(this.aws.vpc.appSubnets), validate: validateSubnet } ]; return this.prompt(prompts).then(props => { const publicIpOnLaunchArray = appSubnets => _.chain(this.awsFacts.availableSubnets) .filter(availableSubnet => _.includes(appSubnets, availableSubnet.SubnetId)) .map('MapPublicIpOnLaunch') .uniq() .value(); const uniqueIPLaunch = publicIpOnLaunchArray(props.appSubnets); const shouldAppHavePublicIP = _.head(uniqueIPLaunch); if (uniqueIPLaunch.length !== 1) { this.log.ok( `⚠️ Mix of Application Subnets containing contradictory 'MapPublic Ip On Launch' values. Defaulting to '${ shouldAppHavePublicIP ? 'yes' : 'no' }'` ); } this.aws.vpc.elbSubnets = props.elbSubnets; this.aws.vpc.appSubnets = props.appSubnets; this.aws.vpc.appSubnetsLaunchWithPublicIP = shouldAppHavePublicIP; done(); }); }
javascript
function askForSubnets() { if (this.abort) return null; const done = this.async(); const subnetList = _.map(this.awsFacts.availableSubnets, sn => { const friendlyName = _getFriendlyNameFromTag(sn); const formattedFriendlyName = friendlyName ? `name: '${friendlyName}', ` : ''; return { name: `${sn.SubnetId} (${formattedFriendlyName}Availability Zone: ${sn.AvailabilityZone}, Public IP On Launch: ${ sn.MapPublicIpOnLaunch ? 'yes' : 'no' })`, value: sn.SubnetId, short: sn.SubnetId }; }); const defaultSubnetValue = storedSubnetValue => storedSubnetValue || [_.get(this.awsFacts.availableSubnets, '[0].SubnetId'), _.get(this.awsFacts.availableSubnets, '[1].SubnetId')]; const validateSubnet = input => _.isEmpty(input) || (_.isArray(input) && input.length < 2) ? 'You must select two or more subnets' : true; const prompts = [ { type: 'checkbox', name: 'elbSubnets', message: `Which subnets should we deploy the ${chalk.yellow('Network Load Balancer (ELB)')} to?`, choices: subnetList, default: defaultSubnetValue(this.aws.vpc.elbSubnets), validate: validateSubnet }, { type: 'checkbox', name: 'appSubnets', message: `Which subnets should we deploy the ${chalk.yellow('Application & Database')} to?`, choices: subnetList, default: defaultSubnetValue(this.aws.vpc.appSubnets), validate: validateSubnet } ]; return this.prompt(prompts).then(props => { const publicIpOnLaunchArray = appSubnets => _.chain(this.awsFacts.availableSubnets) .filter(availableSubnet => _.includes(appSubnets, availableSubnet.SubnetId)) .map('MapPublicIpOnLaunch') .uniq() .value(); const uniqueIPLaunch = publicIpOnLaunchArray(props.appSubnets); const shouldAppHavePublicIP = _.head(uniqueIPLaunch); if (uniqueIPLaunch.length !== 1) { this.log.ok( `⚠️ Mix of Application Subnets containing contradictory 'MapPublic Ip On Launch' values. Defaulting to '${ shouldAppHavePublicIP ? 'yes' : 'no' }'` ); } this.aws.vpc.elbSubnets = props.elbSubnets; this.aws.vpc.appSubnets = props.appSubnets; this.aws.vpc.appSubnetsLaunchWithPublicIP = shouldAppHavePublicIP; done(); }); }
[ "function", "askForSubnets", "(", ")", "{", "if", "(", "this", ".", "abort", ")", "return", "null", ";", "const", "done", "=", "this", ".", "async", "(", ")", ";", "const", "subnetList", "=", "_", ".", "map", "(", "this", ".", "awsFacts", ".", "ava...
Ask user to select availability information (availability, zones)/
[ "Ask", "user", "to", "select", "availability", "information", "(", "availability", "zones", ")", "/" ]
f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff
https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/aws-containers/prompts.js#L386-L449
train
Ask For Subnets
[ 30522, 3853, 3198, 29278, 6342, 24700, 8454, 1006, 1007, 1063, 2065, 1006, 2023, 1012, 11113, 11589, 1007, 2709, 19701, 1025, 9530, 3367, 2589, 1027, 2023, 1012, 2004, 6038, 2278, 1006, 1007, 1025, 9530, 3367, 4942, 7159, 9863, 1027, 1035, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/autocomplete/js/autocompleteController.js
init
function init () { $mdUtil.initOptionalProperties($scope, $attrs, { searchText: '', selectedItem: null, clearButton: false, disableVirtualRepeat: false, }); $mdTheming($element); configureWatchers(); $mdUtil.nextTick(function () { gatherElements(); moveDropdown(); // Forward all focus events to the input element when autofocus is enabled if ($scope.autofocus) { $element.on('focus', focusInputElement); } if ($scope.inputAriaDescribedBy) { elements.input.setAttribute('aria-describedby', $scope.inputAriaDescribedBy); } if (!$scope.floatingLabel) { if ($scope.inputAriaLabel) { elements.input.setAttribute('aria-label', $scope.inputAriaLabel); } else if ($scope.inputAriaLabelledBy) { elements.input.setAttribute('aria-labelledby', $scope.inputAriaLabelledBy); } else if ($scope.placeholder) { // If no aria-label or aria-labelledby references are defined, then just label using the // placeholder. elements.input.setAttribute('aria-label', $scope.placeholder); } } }); }
javascript
function init () { $mdUtil.initOptionalProperties($scope, $attrs, { searchText: '', selectedItem: null, clearButton: false, disableVirtualRepeat: false, }); $mdTheming($element); configureWatchers(); $mdUtil.nextTick(function () { gatherElements(); moveDropdown(); // Forward all focus events to the input element when autofocus is enabled if ($scope.autofocus) { $element.on('focus', focusInputElement); } if ($scope.inputAriaDescribedBy) { elements.input.setAttribute('aria-describedby', $scope.inputAriaDescribedBy); } if (!$scope.floatingLabel) { if ($scope.inputAriaLabel) { elements.input.setAttribute('aria-label', $scope.inputAriaLabel); } else if ($scope.inputAriaLabelledBy) { elements.input.setAttribute('aria-labelledby', $scope.inputAriaLabelledBy); } else if ($scope.placeholder) { // If no aria-label or aria-labelledby references are defined, then just label using the // placeholder. elements.input.setAttribute('aria-label', $scope.placeholder); } } }); }
[ "function", "init", "(", ")", "{", "$mdUtil", ".", "initOptionalProperties", "(", "$scope", ",", "$attrs", ",", "{", "searchText", ":", "''", ",", "selectedItem", ":", "null", ",", "clearButton", ":", "false", ",", "disableVirtualRepeat", ":", "false", ",", ...
initialization methods Initialize the controller, setup watchers, gather elements
[ "initialization", "methods", "Initialize", "the", "controller", "setup", "watchers", "gather", "elements" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L80-L115
train
Initializes the optional properties of the optional element
[ 30522, 3853, 1999, 4183, 1006, 1007, 1063, 1002, 9108, 21823, 2140, 1012, 1999, 9956, 16790, 2389, 21572, 4842, 7368, 1006, 1002, 9531, 1010, 1002, 2012, 16344, 2015, 1010, 1063, 3945, 18209, 1024, 1005, 1005, 1010, 3479, 4221, 2213, 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...
adobe/brackets
src/search/FindUtils.js
_doReplaceInOneFile
function _doReplaceInOneFile(fullPath, matchInfo, replaceText, options) { var doc = DocumentManager.getOpenDocumentForPath(fullPath); options = options || {}; // If we're forcing files open, or if the document is in the working set but not actually open // yet, we want to open the file and do the replacement in memory. if (!doc && (options.forceFilesOpen || MainViewManager.findInWorkingSet(MainViewManager.ALL_PANES, fullPath) !== -1)) { return DocumentManager.getDocumentForPath(fullPath).then(function (newDoc) { return _doReplaceInDocument(newDoc, matchInfo, replaceText, options.isRegexp); }); } else if (doc) { return _doReplaceInDocument(doc, matchInfo, replaceText, options.isRegexp); } else { return _doReplaceOnDisk(fullPath, matchInfo, replaceText, options.isRegexp); } }
javascript
function _doReplaceInOneFile(fullPath, matchInfo, replaceText, options) { var doc = DocumentManager.getOpenDocumentForPath(fullPath); options = options || {}; // If we're forcing files open, or if the document is in the working set but not actually open // yet, we want to open the file and do the replacement in memory. if (!doc && (options.forceFilesOpen || MainViewManager.findInWorkingSet(MainViewManager.ALL_PANES, fullPath) !== -1)) { return DocumentManager.getDocumentForPath(fullPath).then(function (newDoc) { return _doReplaceInDocument(newDoc, matchInfo, replaceText, options.isRegexp); }); } else if (doc) { return _doReplaceInDocument(doc, matchInfo, replaceText, options.isRegexp); } else { return _doReplaceOnDisk(fullPath, matchInfo, replaceText, options.isRegexp); } }
[ "function", "_doReplaceInOneFile", "(", "fullPath", ",", "matchInfo", ",", "replaceText", ",", "options", ")", "{", "var", "doc", "=", "DocumentManager", ".", "getOpenDocumentForPath", "(", "fullPath", ")", ";", "options", "=", "options", "||", "{", "}", ";", ...
Does a set of replacements in a single file. If the file is already open in a Document in memory, will do the replacement there, otherwise does it directly on disk. @param {string} fullPath The full path to the file. @param {Object} matchInfo The match info for this file, as returned by `_addSearchMatches()`. @param {string} replaceText The text to replace each result with. @param {Object=} options An options object: forceFilesOpen: boolean - Whether to open the file in an editor 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 error if there were one or more errors.
[ "Does", "a", "set", "of", "replacements", "in", "a", "single", "file", ".", "If", "the", "file", "is", "already", "open", "in", "a", "Document", "in", "memory", "will", "do", "the", "replacement", "there", "otherwise", "does", "it", "directly", "on", "di...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindUtils.js#L190-L204
train
Replace a file in the file system
[ 30522, 3853, 1035, 2079, 2890, 24759, 10732, 5740, 2638, 8873, 2571, 1006, 2440, 15069, 1010, 2674, 2378, 14876, 1010, 5672, 18209, 1010, 7047, 1007, 1063, 13075, 9986, 1027, 6254, 24805, 4590, 1012, 2131, 26915, 3527, 24894, 4765, 29278, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Manifest.js
function() { // version check => only if minVersion is available a warning // will be logged and the debug mode is turned on // TODO: enhance version check also for libraries and components var sMinUI5Version = this.getEntry("/sap.ui5/dependencies/minUI5Version"); if (sMinUI5Version && Log.isLoggable(Log.Level.WARNING) && sap.ui.getCore().getConfiguration().getDebug()) { sap.ui.getVersionInfo({async: true}).then(function(oVersionInfo) { var oMinVersion = getVersionWithoutSuffix(sMinUI5Version); var oVersion = getVersionWithoutSuffix(oVersionInfo && oVersionInfo.version); if (oMinVersion.compareTo(oVersion) > 0) { Log.warning("Component \"" + this.getComponentName() + "\" requires at least version \"" + oMinVersion.toString() + "\" but running on \"" + oVersion.toString() + "\"!"); } }.bind(this), function(e) { Log.warning("The validation of the version for Component \"" + this.getComponentName() + "\" failed! Reasion: " + e); }.bind(this)); } }
javascript
function() { // version check => only if minVersion is available a warning // will be logged and the debug mode is turned on // TODO: enhance version check also for libraries and components var sMinUI5Version = this.getEntry("/sap.ui5/dependencies/minUI5Version"); if (sMinUI5Version && Log.isLoggable(Log.Level.WARNING) && sap.ui.getCore().getConfiguration().getDebug()) { sap.ui.getVersionInfo({async: true}).then(function(oVersionInfo) { var oMinVersion = getVersionWithoutSuffix(sMinUI5Version); var oVersion = getVersionWithoutSuffix(oVersionInfo && oVersionInfo.version); if (oMinVersion.compareTo(oVersion) > 0) { Log.warning("Component \"" + this.getComponentName() + "\" requires at least version \"" + oMinVersion.toString() + "\" but running on \"" + oVersion.toString() + "\"!"); } }.bind(this), function(e) { Log.warning("The validation of the version for Component \"" + this.getComponentName() + "\" failed! Reasion: " + e); }.bind(this)); } }
[ "function", "(", ")", "{", "// version check => only if minVersion is available a warning", "// will be logged and the debug mode is turned on", "// TODO: enhance version check also for libraries and components", "var", "sMinUI5Version", "=", "this", ".", "getEntry", "(", "\"/sap.ui5/dep...
Validates the current UI5 version with the minimal version defined in the manifest. If the minimal version is greater than the current version an issue will be reported in the console if open. @private
[ "Validates", "the", "current", "UI5", "version", "with", "the", "minimal", "version", "defined", "in", "the", "manifest", ".", "If", "the", "minimal", "version", "is", "greater", "than", "the", "current", "version", "an", "issue", "will", "be", "reported", "...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L368-L388
train
Checks that the component requires at least a version
[ 30522, 3853, 1006, 1007, 1063, 1013, 1013, 2544, 4638, 1027, 1028, 2069, 2065, 8117, 27774, 2003, 2800, 1037, 5432, 1013, 1013, 2097, 2022, 26618, 1998, 1996, 2139, 8569, 2290, 5549, 2003, 2357, 2006, 1013, 1013, 28681, 2080, 1024, 11598, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jantimon/html-webpack-plugin
lib/compiler.js
extractHelperFilesFromCompilation
function extractHelperFilesFromCompilation (mainCompilation, childCompilation, filename, childEntryChunks) { const helperAssetNames = childEntryChunks.map((entryChunk, index) => { return mainCompilation.mainTemplate.hooks.assetPath.call(filename, { hash: childCompilation.hash, chunk: entryChunk, name: `HtmlWebpackPlugin_${index}` }); }); helperAssetNames.forEach((helperFileName) => { delete mainCompilation.assets[helperFileName]; }); const helperContents = helperAssetNames.map((helperFileName) => { return childCompilation.assets[helperFileName].source(); }); return helperContents; }
javascript
function extractHelperFilesFromCompilation (mainCompilation, childCompilation, filename, childEntryChunks) { const helperAssetNames = childEntryChunks.map((entryChunk, index) => { return mainCompilation.mainTemplate.hooks.assetPath.call(filename, { hash: childCompilation.hash, chunk: entryChunk, name: `HtmlWebpackPlugin_${index}` }); }); helperAssetNames.forEach((helperFileName) => { delete mainCompilation.assets[helperFileName]; }); const helperContents = helperAssetNames.map((helperFileName) => { return childCompilation.assets[helperFileName].source(); }); return helperContents; }
[ "function", "extractHelperFilesFromCompilation", "(", "mainCompilation", ",", "childCompilation", ",", "filename", ",", "childEntryChunks", ")", "{", "const", "helperAssetNames", "=", "childEntryChunks", ".", "map", "(", "(", "entryChunk", ",", "index", ")", "=>", "...
The webpack child compilation will create files as a side effect. This function will extract them and clean them up so they won't be written to disk. Returns the source code of the compiled templates as string @returns Array<string>
[ "The", "webpack", "child", "compilation", "will", "create", "files", "as", "a", "side", "effect", ".", "This", "function", "will", "extract", "them", "and", "clean", "them", "up", "so", "they", "won", "t", "be", "written", "to", "disk", "." ]
38db64ae8805de37d038e0ee0f6dfa2a26e2163a
https://github.com/jantimon/html-webpack-plugin/blob/38db64ae8805de37d038e0ee0f6dfa2a26e2163a/lib/compiler.js#L180-L198
train
Extract all helper files from the compilation
[ 30522, 3853, 14817, 16001, 4842, 8873, 4244, 19699, 5358, 9006, 8197, 13490, 1006, 2364, 9006, 8197, 13490, 1010, 2775, 9006, 8197, 13490, 1010, 5371, 18442, 1010, 2775, 4765, 2854, 20760, 8950, 2015, 1007, 1063, 9530, 3367, 2393, 24140, 13...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/tabs/tabsPaginationService.js
getTotalTabsWidth
function getTotalTabsWidth(elements) { var sum = 0, i, tab; for (i = 0; i < elements.tabs.length; i++) { tab = elements.tabs[i]; sum += tab.offsetWidth; } return sum; }
javascript
function getTotalTabsWidth(elements) { var sum = 0, i, tab; for (i = 0; i < elements.tabs.length; i++) { tab = elements.tabs[i]; sum += tab.offsetWidth; } return sum; }
[ "function", "getTotalTabsWidth", "(", "elements", ")", "{", "var", "sum", "=", "0", ",", "i", ",", "tab", ";", "for", "(", "i", "=", "0", ";", "i", "<", "elements", ".", "tabs", ".", "length", ";", "i", "++", ")", "{", "tab", "=", "elements", "...
Sum the width of all tabs. @param elements @returns {number}
[ "Sum", "the", "width", "of", "all", "tabs", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/tabsPaginationService.js#L101-L110
train
Returns the total width of all tabs in the specified elements
[ 30522, 3853, 2131, 3406, 9080, 2696, 5910, 9148, 11927, 2232, 1006, 3787, 1007, 1063, 13075, 7680, 1027, 1014, 1010, 1045, 1010, 21628, 1025, 2005, 1006, 1045, 1027, 1014, 1025, 1045, 1026, 3787, 1012, 21628, 2015, 1012, 3091, 1025, 1045, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
Makefile.js
generateRuleIndexPage
function generateRuleIndexPage(basedir) { const outputFile = "../eslint.github.io/_data/rules.yml", categoryList = "conf/category-list.json", categoriesData = JSON.parse(cat(path.resolve(categoryList))); find(path.join(basedir, "/lib/rules/")).filter(fileType("js")) .map(filename => [filename, path.basename(filename, ".js")]) .sort((a, b) => a[1].localeCompare(b[1])) .forEach(pair => { const filename = pair[0]; const basename = pair[1]; const rule = require(filename); if (rule.meta.deprecated) { categoriesData.deprecated.rules.push({ name: basename, replacedBy: rule.meta.replacedBy || [] }); } else { const output = { name: basename, description: rule.meta.docs.description, recommended: rule.meta.docs.recommended || false, fixable: !!rule.meta.fixable }, category = lodash.find(categoriesData.categories, { name: rule.meta.docs.category }); if (!category.rules) { category.rules = []; } category.rules.push(output); } }); const output = yaml.safeDump(categoriesData, { sortKeys: true }); output.to(outputFile); }
javascript
function generateRuleIndexPage(basedir) { const outputFile = "../eslint.github.io/_data/rules.yml", categoryList = "conf/category-list.json", categoriesData = JSON.parse(cat(path.resolve(categoryList))); find(path.join(basedir, "/lib/rules/")).filter(fileType("js")) .map(filename => [filename, path.basename(filename, ".js")]) .sort((a, b) => a[1].localeCompare(b[1])) .forEach(pair => { const filename = pair[0]; const basename = pair[1]; const rule = require(filename); if (rule.meta.deprecated) { categoriesData.deprecated.rules.push({ name: basename, replacedBy: rule.meta.replacedBy || [] }); } else { const output = { name: basename, description: rule.meta.docs.description, recommended: rule.meta.docs.recommended || false, fixable: !!rule.meta.fixable }, category = lodash.find(categoriesData.categories, { name: rule.meta.docs.category }); if (!category.rules) { category.rules = []; } category.rules.push(output); } }); const output = yaml.safeDump(categoriesData, { sortKeys: true }); output.to(outputFile); }
[ "function", "generateRuleIndexPage", "(", "basedir", ")", "{", "const", "outputFile", "=", "\"../eslint.github.io/_data/rules.yml\"", ",", "categoryList", "=", "\"conf/category-list.json\"", ",", "categoriesData", "=", "JSON", ".", "parse", "(", "cat", "(", "path", "....
Generate a doc page that lists all of the rules and links to them @param {string} basedir The directory in which to look for code. @returns {void}
[ "Generate", "a", "doc", "page", "that", "lists", "all", "of", "the", "rules", "and", "links", "to", "them" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/Makefile.js#L177-L215
train
Generate rule index page
[ 30522, 3853, 9699, 6820, 19856, 3207, 2595, 13704, 1006, 2241, 4313, 1007, 1063, 9530, 3367, 6434, 8873, 2571, 1027, 1000, 1012, 1012, 1013, 9686, 4115, 2102, 1012, 21025, 2705, 12083, 1012, 22834, 1013, 1035, 2951, 1013, 3513, 1012, 1061, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aws/aws-sdk-js
lib/event-stream/split-message.js
splitMessage
function splitMessage(message) { if (!util.Buffer.isBuffer(message)) message = toBuffer(message); if (message.length < MINIMUM_MESSAGE_LENGTH) { throw new Error('Provided message too short to accommodate event stream message overhead'); } if (message.length !== message.readUInt32BE(0)) { throw new Error('Reported message length does not match received message length'); } var expectedPreludeChecksum = message.readUInt32BE(PRELUDE_LENGTH); if ( expectedPreludeChecksum !== util.crypto.crc32( message.slice(0, PRELUDE_LENGTH) ) ) { throw new Error( 'The prelude checksum specified in the message (' + expectedPreludeChecksum + ') does not match the calculated CRC32 checksum.' ); } var expectedMessageChecksum = message.readUInt32BE(message.length - CHECKSUM_LENGTH); if ( expectedMessageChecksum !== util.crypto.crc32( message.slice(0, message.length - CHECKSUM_LENGTH) ) ) { throw new Error( 'The message checksum did not match the expected value of ' + expectedMessageChecksum ); } var headersStart = PRELUDE_LENGTH + CHECKSUM_LENGTH; var headersEnd = headersStart + message.readUInt32BE(PRELUDE_MEMBER_LENGTH); return { headers: message.slice(headersStart, headersEnd), body: message.slice(headersEnd, message.length - CHECKSUM_LENGTH), }; }
javascript
function splitMessage(message) { if (!util.Buffer.isBuffer(message)) message = toBuffer(message); if (message.length < MINIMUM_MESSAGE_LENGTH) { throw new Error('Provided message too short to accommodate event stream message overhead'); } if (message.length !== message.readUInt32BE(0)) { throw new Error('Reported message length does not match received message length'); } var expectedPreludeChecksum = message.readUInt32BE(PRELUDE_LENGTH); if ( expectedPreludeChecksum !== util.crypto.crc32( message.slice(0, PRELUDE_LENGTH) ) ) { throw new Error( 'The prelude checksum specified in the message (' + expectedPreludeChecksum + ') does not match the calculated CRC32 checksum.' ); } var expectedMessageChecksum = message.readUInt32BE(message.length - CHECKSUM_LENGTH); if ( expectedMessageChecksum !== util.crypto.crc32( message.slice(0, message.length - CHECKSUM_LENGTH) ) ) { throw new Error( 'The message checksum did not match the expected value of ' + expectedMessageChecksum ); } var headersStart = PRELUDE_LENGTH + CHECKSUM_LENGTH; var headersEnd = headersStart + message.readUInt32BE(PRELUDE_MEMBER_LENGTH); return { headers: message.slice(headersStart, headersEnd), body: message.slice(headersEnd, message.length - CHECKSUM_LENGTH), }; }
[ "function", "splitMessage", "(", "message", ")", "{", "if", "(", "!", "util", ".", "Buffer", ".", "isBuffer", "(", "message", ")", ")", "message", "=", "toBuffer", "(", "message", ")", ";", "if", "(", "message", ".", "length", "<", "MINIMUM_MESSAGE_LENGT...
@api private @param {Buffer} message
[ "@api", "private" ]
c23e5f0edd150f8885267e5f7c8a564f8e6e8562
https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/event-stream/split-message.js#L18-L63
train
Split the message into two parts
[ 30522, 3853, 3975, 7834, 3736, 3351, 1006, 4471, 1007, 1063, 2065, 1006, 999, 21183, 4014, 1012, 17698, 1012, 2003, 8569, 12494, 1006, 4471, 1007, 1007, 4471, 1027, 2000, 8569, 12494, 1006, 4471, 1007, 1025, 2065, 1006, 4471, 1012, 3091, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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(sFormatId) { sFormatId = sFormatId ? String(sFormatId).toUpperCase() : ""; check(!sFormatId || M_ABAP_DATE_FORMAT_PATTERN.hasOwnProperty(sFormatId), "sFormatId must be one of ['1','2','3','4','5','6','7','8','9','A','B','C'] or empty"); var mChanges = this.oConfiguration._collect(); this.sLegacyDateFormat = mChanges.legacyDateFormat = sFormatId; this.setDatePattern("short", M_ABAP_DATE_FORMAT_PATTERN[sFormatId].pattern); this.setDatePattern("medium", M_ABAP_DATE_FORMAT_PATTERN[sFormatId].pattern); this.oConfiguration._endCollect(); return this; }
javascript
function(sFormatId) { sFormatId = sFormatId ? String(sFormatId).toUpperCase() : ""; check(!sFormatId || M_ABAP_DATE_FORMAT_PATTERN.hasOwnProperty(sFormatId), "sFormatId must be one of ['1','2','3','4','5','6','7','8','9','A','B','C'] or empty"); var mChanges = this.oConfiguration._collect(); this.sLegacyDateFormat = mChanges.legacyDateFormat = sFormatId; this.setDatePattern("short", M_ABAP_DATE_FORMAT_PATTERN[sFormatId].pattern); this.setDatePattern("medium", M_ABAP_DATE_FORMAT_PATTERN[sFormatId].pattern); this.oConfiguration._endCollect(); return this; }
[ "function", "(", "sFormatId", ")", "{", "sFormatId", "=", "sFormatId", "?", "String", "(", "sFormatId", ")", ".", "toUpperCase", "(", ")", ":", "\"\"", ";", "check", "(", "!", "sFormatId", "||", "M_ABAP_DATE_FORMAT_PATTERN", ".", "hasOwnProperty", "(", "sFor...
Allows to specify one of the legacy ABAP date formats. This method modifies the date patterns for 'short' and 'medium' style with the corresponding ABAP format. When called with a null or undefined format id, any previously applied format will be removed. After changing the legacy date format, the framework tries to update localization specific parts of the UI. See the documentation of {@link sap.ui.core.Configuration#setLanguage} for details and restrictions. @param {string} sFormatId id of the ABAP data format (one of '1','2','3','4','5','6','7','8','9','A','B','C') @return {sap.ui.core.Configuration.FormatSettings} Returns <code>this</code> to allow method chaining @public
[ "Allows", "to", "specify", "one", "of", "the", "legacy", "ABAP", "date", "formats", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L2057-L2066
train
Sets the legacy date format
[ 30522, 3853, 1006, 16420, 2953, 18900, 3593, 1007, 1063, 16420, 2953, 18900, 3593, 1027, 16420, 2953, 18900, 3593, 1029, 5164, 1006, 16420, 2953, 18900, 3593, 1007, 1012, 2000, 29547, 18992, 3366, 1006, 1007, 1024, 1000, 1000, 1025, 4638, 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...
TryGhost/Ghost
core/server/data/importer/index.js
function (directory) { // Globs match root level only var extMatches = glob.sync(this.getExtensionGlob(this.getExtensions(), ROOT_ONLY), {cwd: directory}), dirMatches = glob.sync(this.getDirectoryGlob(this.getDirectories(), ROOT_ONLY), {cwd: directory}), extMatchesAll; // There is no base directory if (extMatches.length > 0 || dirMatches.length > 0) { return; } // There is a base directory, grab it from any ext match extMatchesAll = glob.sync( this.getExtensionGlob(this.getExtensions(), ALL_DIRS), {cwd: directory} ); if (extMatchesAll.length < 1 || extMatchesAll[0].split('/') < 1) { throw new common.errors.ValidationError({message: common.i18n.t('errors.data.importer.index.invalidZipFileBaseDirectory')}); } return extMatchesAll[0].split('/')[0]; }
javascript
function (directory) { // Globs match root level only var extMatches = glob.sync(this.getExtensionGlob(this.getExtensions(), ROOT_ONLY), {cwd: directory}), dirMatches = glob.sync(this.getDirectoryGlob(this.getDirectories(), ROOT_ONLY), {cwd: directory}), extMatchesAll; // There is no base directory if (extMatches.length > 0 || dirMatches.length > 0) { return; } // There is a base directory, grab it from any ext match extMatchesAll = glob.sync( this.getExtensionGlob(this.getExtensions(), ALL_DIRS), {cwd: directory} ); if (extMatchesAll.length < 1 || extMatchesAll[0].split('/') < 1) { throw new common.errors.ValidationError({message: common.i18n.t('errors.data.importer.index.invalidZipFileBaseDirectory')}); } return extMatchesAll[0].split('/')[0]; }
[ "function", "(", "directory", ")", "{", "// Globs match root level only", "var", "extMatches", "=", "glob", ".", "sync", "(", "this", ".", "getExtensionGlob", "(", "this", ".", "getExtensions", "(", ")", ",", "ROOT_ONLY", ")", ",", "{", "cwd", ":", "director...
Get the name of the single base directory if there is one, else return an empty string @param {String} directory @returns {Promise (String)}
[ "Get", "the", "name", "of", "the", "single", "base", "directory", "if", "there", "is", "one", "else", "return", "an", "empty", "string" ]
bb7bb55cf3e60af99ebbc56099928827b58461bc
https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/data/importer/index.js#L197-L216
train
Get the base directory of the zip file
[ 30522, 3853, 1006, 14176, 1007, 1063, 1013, 1013, 1043, 4135, 5910, 2674, 7117, 2504, 2069, 13075, 4654, 29418, 10649, 2229, 1027, 1043, 4135, 2497, 1012, 26351, 1006, 2023, 1012, 2131, 10288, 29048, 23296, 16429, 1006, 2023, 1012, 2131, 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...
jgraph/mxgraph
javascript/mxClient.js
mxCellTracker
function mxCellTracker(graph, color, funct) { mxCellMarker.call(this, graph, color); this.graph.addMouseListener(this); if (funct != null) { this.getCell = funct; } // Automatic deallocation of memory if (mxClient.IS_IE) { mxEvent.addListener(window, 'unload', mxUtils.bind(this, function() { this.destroy(); })); } }
javascript
function mxCellTracker(graph, color, funct) { mxCellMarker.call(this, graph, color); this.graph.addMouseListener(this); if (funct != null) { this.getCell = funct; } // Automatic deallocation of memory if (mxClient.IS_IE) { mxEvent.addListener(window, 'unload', mxUtils.bind(this, function() { this.destroy(); })); } }
[ "function", "mxCellTracker", "(", "graph", ",", "color", ",", "funct", ")", "{", "mxCellMarker", ".", "call", "(", "this", ",", "graph", ",", "color", ")", ";", "this", ".", "graph", ".", "addMouseListener", "(", "this", ")", ";", "if", "(", "funct", ...
Copyright (c) 2006-2015, JGraph Ltd Copyright (c) 2006-2015, Gaudenz Alder Class: mxCellTracker Event handler that highlights cells. Inherits from <mxCellMarker>. Example: (code) new mxCellTracker(graph, '#00FF00'); (end) For detecting dragEnter, dragOver and dragLeave on cells, the following code can be used: (code) graph.addMouseListener( { cell: null, mouseDown: function(sender, me) { }, mouseMove: function(sender, me) { var tmp = me.getCell(); if (tmp != this.cell) { if (this.cell != null) { this.dragLeave(me.getEvent(), this.cell); } this.cell = tmp; if (this.cell != null) { this.dragEnter(me.getEvent(), this.cell); } } if (this.cell != null) { this.dragOver(me.getEvent(), this.cell); } }, mouseUp: function(sender, me) { }, dragEnter: function(evt, cell) { mxLog.debug('dragEnter', cell.value); }, dragOver: function(evt, cell) { mxLog.debug('dragOver', cell.value); }, dragLeave: function(evt, cell) { mxLog.debug('dragLeave', cell.value); } }); (end) Constructor: mxCellTracker Constructs an event handler that highlights cells. Parameters: graph - Reference to the enclosing <mxGraph>. color - Color of the highlight. Default is blue. funct - Optional JavaScript function that is used to override <mxCellMarker.getCell>.
[ "Copyright", "(", "c", ")", "2006", "-", "2015", "JGraph", "Ltd", "Copyright", "(", "c", ")", "2006", "-", "2015", "Gaudenz", "Alder", "Class", ":", "mxCellTracker" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L81453-L81472
train
A cell tracker that is used to track the state of a cell.
[ 30522, 3853, 25630, 29109, 7096, 22648, 5484, 1006, 10629, 1010, 3609, 1010, 4569, 6593, 1007, 1063, 25630, 29109, 19145, 25074, 2099, 1012, 2655, 1006, 2023, 1010, 10629, 1010, 3609, 1007, 1025, 2023, 1012, 10629, 1012, 5587, 27711, 29282, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/aggregation-layers/src/utils/gpu-grid-aggregation/grid-aggregation-utils.js
getGridOffset
function getGridOffset(boundingBox, cellSize) { const {yMin, yMax} = boundingBox; const latMin = yMin; const latMax = yMax; const centerLat = (latMin + latMax) / 2; return calculateGridLatLonOffset(cellSize, centerLat); }
javascript
function getGridOffset(boundingBox, cellSize) { const {yMin, yMax} = boundingBox; const latMin = yMin; const latMax = yMax; const centerLat = (latMin + latMax) / 2; return calculateGridLatLonOffset(cellSize, centerLat); }
[ "function", "getGridOffset", "(", "boundingBox", ",", "cellSize", ")", "{", "const", "{", "yMin", ",", "yMax", "}", "=", "boundingBox", ";", "const", "latMin", "=", "yMin", ";", "const", "latMax", "=", "yMax", ";", "const", "centerLat", "=", "(", "latMin...
/* eslint-enable max-statements Based on geometric center of sample points, calculate cellSize in lng/lat (degree) space @param {object} gridData - contains bounding box of data @param {number} cellSize - grid cell size in meters @returns {yOffset, xOffset} - cellSize size lng/lat (degree) space.
[ "/", "*", "eslint", "-", "enable", "max", "-", "statements", "Based", "on", "geometric", "center", "of", "sample", "points", "calculate", "cellSize", "in", "lng", "/", "lat", "(", "degree", ")", "space" ]
a2010448b7f268bbd03617b812334c68a6b9e5b2
https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/aggregation-layers/src/utils/gpu-grid-aggregation/grid-aggregation-utils.js#L155-L162
train
Calculate grid offset
[ 30522, 3853, 2131, 16523, 13820, 21807, 3388, 1006, 5391, 2075, 8758, 1010, 4442, 4697, 1007, 1063, 9530, 3367, 1063, 1061, 10020, 1010, 1061, 17848, 1065, 1027, 5391, 2075, 8758, 1025, 9530, 3367, 2474, 21246, 2378, 1027, 1061, 10020, 1025...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/editor/CodeHintManager.js
_endSession
function _endSession() { if (!hintList) { return; } hintList.close(); hintList = null; codeHintOpened = false; keyDownEditor = null; sessionProvider = null; sessionEditor = null; if (deferredHints) { deferredHints.reject(); deferredHints = null; } }
javascript
function _endSession() { if (!hintList) { return; } hintList.close(); hintList = null; codeHintOpened = false; keyDownEditor = null; sessionProvider = null; sessionEditor = null; if (deferredHints) { deferredHints.reject(); deferredHints = null; } }
[ "function", "_endSession", "(", ")", "{", "if", "(", "!", "hintList", ")", "{", "return", ";", "}", "hintList", ".", "close", "(", ")", ";", "hintList", "=", "null", ";", "codeHintOpened", "=", "false", ";", "keyDownEditor", "=", "null", ";", "sessionP...
End the current hinting session
[ "End", "the", "current", "hinting", "session" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/CodeHintManager.js#L373-L387
train
End session
[ 30522, 3853, 1035, 4515, 7971, 3258, 1006, 1007, 1063, 2065, 1006, 999, 9374, 9863, 1007, 1063, 2709, 1025, 1065, 9374, 9863, 1012, 2485, 1006, 1007, 1025, 9374, 9863, 1027, 19701, 1025, 3642, 10606, 14399, 6675, 1027, 6270, 1025, 3145, 7...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
mui-org/material-ui
docs/src/modules/components/AppWrapper.js
forcePageReload
function forcePageReload(registration) { // console.log('already controlled?', Boolean(navigator.serviceWorker.controller)); if (!navigator.serviceWorker.controller) { // The window client isn't currently controlled so it's a new service // worker that will activate immediately. return; } // console.log('registration waiting?', Boolean(registration.waiting)); if (registration.waiting) { // SW is waiting to activate. Can occur if multiple clients open and // one of the clients is refreshed. registration.waiting.postMessage('skipWaiting'); return; } function listenInstalledStateChange() { registration.installing.addEventListener('statechange', event => { // console.log('statechange', event.target.state); if (event.target.state === 'installed' && registration.waiting) { // A new service worker is available, inform the user registration.waiting.postMessage('skipWaiting'); } else if (event.target.state === 'activated') { // Force the control of the page by the activated service worker. window.location.reload(); } }); } if (registration.installing) { listenInstalledStateChange(); return; } // We are currently controlled so a new SW may be found... // Add a listener in case a new SW is found, registration.addEventListener('updatefound', listenInstalledStateChange); }
javascript
function forcePageReload(registration) { // console.log('already controlled?', Boolean(navigator.serviceWorker.controller)); if (!navigator.serviceWorker.controller) { // The window client isn't currently controlled so it's a new service // worker that will activate immediately. return; } // console.log('registration waiting?', Boolean(registration.waiting)); if (registration.waiting) { // SW is waiting to activate. Can occur if multiple clients open and // one of the clients is refreshed. registration.waiting.postMessage('skipWaiting'); return; } function listenInstalledStateChange() { registration.installing.addEventListener('statechange', event => { // console.log('statechange', event.target.state); if (event.target.state === 'installed' && registration.waiting) { // A new service worker is available, inform the user registration.waiting.postMessage('skipWaiting'); } else if (event.target.state === 'activated') { // Force the control of the page by the activated service worker. window.location.reload(); } }); } if (registration.installing) { listenInstalledStateChange(); return; } // We are currently controlled so a new SW may be found... // Add a listener in case a new SW is found, registration.addEventListener('updatefound', listenInstalledStateChange); }
[ "function", "forcePageReload", "(", "registration", ")", "{", "// console.log('already controlled?', Boolean(navigator.serviceWorker.controller));", "if", "(", "!", "navigator", ".", "serviceWorker", ".", "controller", ")", "{", "// The window client isn't currently controlled so i...
Inspired by https://developers.google.com/web/tools/workbox/guides/advanced-recipes#offer_a_page_reload_for_users
[ "Inspired", "by", "https", ":", "//", "developers", ".", "google", ".", "com", "/", "web", "/", "tools", "/", "workbox", "/", "guides", "/", "advanced", "-", "recipes#offer_a_page_reload_for_users" ]
1555e52367835946382fbf2a8f681de71318915d
https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/docs/src/modules/components/AppWrapper.js#L59-L97
train
Force a reload of the page by the active service worker.
[ 30522, 3853, 2486, 13704, 16570, 10441, 2094, 1006, 8819, 1007, 1063, 1013, 1013, 10122, 1012, 8833, 1006, 1005, 2525, 4758, 1029, 1005, 1010, 22017, 20898, 1006, 20532, 1012, 2326, 6198, 2121, 1012, 11486, 1007, 1007, 1025, 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...
eslint/eslint
lib/config/config-rule.js
explodeArray
function explodeArray(xs) { return xs.reduce((accumulator, x) => { accumulator.push([x]); return accumulator; }, []); }
javascript
function explodeArray(xs) { return xs.reduce((accumulator, x) => { accumulator.push([x]); return accumulator; }, []); }
[ "function", "explodeArray", "(", "xs", ")", "{", "return", "xs", ".", "reduce", "(", "(", "accumulator", ",", "x", ")", "=>", "{", "accumulator", ".", "push", "(", "[", "x", "]", ")", ";", "return", "accumulator", ";", "}", ",", "[", "]", ")", ";...
------------------------------------------------------------------------------ Helpers ------------------------------------------------------------------------------ Wrap all of the elements of an array into arrays. @param {*[]} xs Any array. @returns {Array[]} An array of arrays.
[ "------------------------------------------------------------------------------", "Helpers", "------------------------------------------------------------------------------", "Wrap", "all", "of", "the", "elements", "of", "an", "array", "into", "arrays", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/config/config-rule.js#L26-L31
train
Explode an array of tokens into an array of tokens
[ 30522, 3853, 15044, 2906, 9447, 1006, 1060, 2015, 1007, 1063, 2709, 1060, 2015, 1012, 5547, 1006, 1006, 16222, 2819, 20350, 1010, 1060, 1007, 1027, 1028, 1063, 16222, 2819, 20350, 1012, 5245, 1006, 1031, 1060, 1033, 1007, 1025, 2709, 16222,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/preferences/PreferencesBase.js
function (data, oldContext, newContext) { var newGlob = _findMatchingGlob(data, FileUtils.getRelativeFilename(this.prefFilePath, newContext[this.key])), oldGlob = _findMatchingGlob(data, FileUtils.getRelativeFilename(this.prefFilePath, oldContext[this.key])); if (newGlob === oldGlob) { return; } if (newGlob === undefined) { return _.keys(data[oldGlob]); } if (oldGlob === undefined) { return _.keys(data[newGlob]); } return _.union(_.keys(data[oldGlob]), _.keys(data[newGlob])); }
javascript
function (data, oldContext, newContext) { var newGlob = _findMatchingGlob(data, FileUtils.getRelativeFilename(this.prefFilePath, newContext[this.key])), oldGlob = _findMatchingGlob(data, FileUtils.getRelativeFilename(this.prefFilePath, oldContext[this.key])); if (newGlob === oldGlob) { return; } if (newGlob === undefined) { return _.keys(data[oldGlob]); } if (oldGlob === undefined) { return _.keys(data[newGlob]); } return _.union(_.keys(data[oldGlob]), _.keys(data[newGlob])); }
[ "function", "(", "data", ",", "oldContext", ",", "newContext", ")", "{", "var", "newGlob", "=", "_findMatchingGlob", "(", "data", ",", "FileUtils", ".", "getRelativeFilename", "(", "this", ".", "prefFilePath", ",", "newContext", "[", "this", ".", "key", "]",...
Determines if there are preference IDs that could change as a result of a change in the context. This implementation considers only the path portion of the context and looks up matching globes if any. @param {Object} data Data in the Scope @param {{path: string}} oldContext Old context @param {{path: string}} newContext New context @return {Array.<string>} list of preference IDs that could have changed
[ "Determines", "if", "there", "are", "preference", "IDs", "that", "could", "change", "as", "a", "result", "of", "a", "change", "in", "the", "context", ".", "This", "implementation", "considers", "only", "the", "path", "portion", "of", "the", "context", "and",...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L1001-L1018
train
returns the keys of the new and old globs
[ 30522, 3853, 1006, 2951, 1010, 2214, 8663, 18209, 1010, 2047, 8663, 18209, 1007, 1063, 13075, 2047, 23296, 16429, 1027, 1035, 2424, 18900, 8450, 23296, 16429, 1006, 2951, 1010, 5371, 21823, 4877, 1012, 2131, 16570, 8082, 8873, 20844, 4168, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
zeit/now-cli
src/commands/inspect.js
stateString
function stateString(s) { switch (s) { case 'INITIALIZING': return chalk.yellow(s); case 'ERROR': return chalk.red(s); case 'READY': return s; default: return chalk.gray('UNKNOWN'); } }
javascript
function stateString(s) { switch (s) { case 'INITIALIZING': return chalk.yellow(s); case 'ERROR': return chalk.red(s); case 'READY': return s; default: return chalk.gray('UNKNOWN'); } }
[ "function", "stateString", "(", "s", ")", "{", "switch", "(", "s", ")", "{", "case", "'INITIALIZING'", ":", "return", "chalk", ".", "yellow", "(", "s", ")", ";", "case", "'ERROR'", ":", "return", "chalk", ".", "red", "(", "s", ")", ";", "case", "'R...
renders the state string
[ "renders", "the", "state", "string" ]
b53d907b745126113bc3e251ac2451088026a363
https://github.com/zeit/now-cli/blob/b53d907b745126113bc3e251ac2451088026a363/src/commands/inspect.js#L309-L323
train
Returns the state string for a cluster
[ 30522, 3853, 2163, 18886, 3070, 1006, 1055, 1007, 1063, 6942, 1006, 1055, 1007, 1063, 2553, 1005, 3988, 6026, 1005, 1024, 2709, 16833, 1012, 3756, 1006, 1055, 1007, 1025, 2553, 1005, 7561, 1005, 1024, 2709, 16833, 1012, 2417, 1006, 1055, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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 (mUnits) { // add custom units, or remove the existing ones if none are given var mExistingUnits = this.getCustomUnits(); if (mExistingUnits){ mUnits = jQuery.extend({}, mExistingUnits, mUnits); } this.setCustomUnits(mUnits); return this; }
javascript
function (mUnits) { // add custom units, or remove the existing ones if none are given var mExistingUnits = this.getCustomUnits(); if (mExistingUnits){ mUnits = jQuery.extend({}, mExistingUnits, mUnits); } this.setCustomUnits(mUnits); return this; }
[ "function", "(", "mUnits", ")", "{", "// add custom units, or remove the existing ones if none are given", "var", "mExistingUnits", "=", "this", ".", "getCustomUnits", "(", ")", ";", "if", "(", "mExistingUnits", ")", "{", "mUnits", "=", "jQuery", ".", "extend", "(",...
Adds custom units. Similar to {@link sap.ui.core.Configuration#setCustomUnits} but instead of setting the custom units, it will add additional ones. @param mUnits {object} custom unit object which replaces the current custom unit definition. Call with <code>null</code> to delete custom units. @return {sap.ui.core.Configuration.FormatSettings} @see sap.ui.core.Configuration#setCustomUnits
[ "Adds", "custom", "units", ".", "Similar", "to", "{" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Configuration.js#L1759-L1767
train
Adds custom units to the current unit list
[ 30522, 3853, 1006, 14163, 3490, 3215, 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, 7874, 20389, 19496, 3215, 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/transform-apijson-for-sdk.js
transformer
function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles, options) { const fs = options && options.fs || require("fs"); const returnOutputFiles = options && !!options.returnOutputFiles; log.info("Transform API index files for sap.ui.documentation"); log.info(" original file: " + sInputFile); log.info(" output file: " + sOutputFile); log.info(" library file: " + sLibraryFile); log.info(" dependency dir: " + vDependencyAPIFiles); if (options && options.fs) { log.info("Using custom fs."); } if (returnOutputFiles) { log.info("Returning output files instead of writing to fs.") } log.info(""); /** * Transforms api.json file * @param {object} oChainObject chain object */ let transformApiJson = function (oChainObject) { function isBuiltInType(type) { return formatters._baseTypes.indexOf(type) >= 0; } /** * Heuristically determining if there is a possibility the given input string * to be a UI5 symbol * @param {string} sName * @returns {boolean} */ function possibleUI5Symbol(sName) { return /^[a-zA-Z][a-zA-Z.]*[a-zA-Z]$/.test(sName); } // Function is a copy from: LibraryInfo.js => LibraryInfo.prototype._getActualComponent => "match" inline method function matchComponent(sModuleName, sPattern) { sModuleName = sModuleName.toLowerCase(); sPattern = sPattern.toLowerCase(); return ( sModuleName === sPattern || sPattern.match(/\*$/) && sModuleName.indexOf(sPattern.slice(0,-1)) === 0 // simple prefix match || sPattern.match(/\.\*$/) && sModuleName === sPattern.slice(0,-2) // directory pattern also matches directory itself ); } /** * Pre-processes the symbols list - creating virtual namespace records and attaching children list to namespace * records. * @param {object} symbols list */ function preProcessSymbols(symbols) { // Create treeName and modify module names symbols.forEach(oSymbol => { let sModuleClearName = oSymbol.name.replace(/^module:/, ""); oSymbol.displayName = sModuleClearName; oSymbol.treeName = sModuleClearName.replace(/\//g, "."); }); // Create missing - virtual namespaces symbols.forEach(oSymbol => { oSymbol.treeName.split(".").forEach((sPart, i, a) => { let sName = a.slice(0, (i + 1)).join("."); if (!symbols.find(o => o.treeName === sName)) { symbols.push({ name: sName, displayName: sName, treeName: sName, lib: oSymbol.lib, kind: "namespace" }); } }); }); // Discover parents symbols.forEach(oSymbol => { let aParent = oSymbol.treeName.split("."), sParent; // Extract parent name aParent.pop(); sParent = aParent.join("."); // Mark parent if (symbols.find(({treeName}) => treeName === sParent)) { oSymbol.parent = sParent; } }); // Attach children info symbols.forEach(oSymbol => { if (oSymbol.parent) { let oParent = symbols.find(({treeName}) => treeName === oSymbol.parent); if (!oParent.nodes) oParent.nodes = []; oParent.nodes.push({ name: oSymbol.displayName, description: formatters._preProcessLinksInTextBlock(oSymbol.description), href: "#/api/" + encodeURIComponent(oSymbol.name) }); } }); // Clean list - keep file size down symbols.forEach(o => { delete o.treeName; delete o.parent; }); } // Transform to object let oData = oChainObject.fileData; // Attach default component for the library if available if (oChainObject.defaultComponent) { oData.defaultComponent = oChainObject.defaultComponent; } formatters._oOwnLibrary = oData; // Pre process symbols preProcessSymbols(oData.symbols); // Apply formatter's and modify data as needed oData.symbols.forEach((oSymbol) => { // when the module name starts with the library name, then we apply the default component if (oSymbol.name.indexOf(oData.library) === 0) { oSymbol.component = oChainObject.defaultComponent; } // Attach symbol specific component if available (special cases) // Note: Last hit wins as there may be a more specific component pattern if (oChainObject.customSymbolComponents) { Object.keys(oChainObject.customSymbolComponents).forEach(sComponent => { if (matchComponent(oSymbol.name, sComponent)) { oSymbol.component = oChainObject.customSymbolComponents[sComponent]; } }); } // Attach symbol sample flag if available if (oChainObject.entitiesWithSamples) { oSymbol.hasSample = oChainObject.entitiesWithSamples.indexOf(oSymbol.name) >= 0; } // Apply settings to formatter object - needed until formatter's are rewritten formatters._sTopicId = oSymbol.name; formatters._oTopicData = oSymbol; // Format Page Title oSymbol.title = (oSymbol.abstract ? "abstract " : "") + oSymbol.kind + " " + oSymbol.displayName; oSymbol.subTitle = formatters.formatSubtitle(oSymbol.deprecated); // Constructor if (oSymbol.constructor) { let oConstructor = oSymbol.constructor; // Description if (oConstructor.description) { oConstructor.description = formatters.formatDescription(oConstructor.description); } // References formatters.modifyReferences(oSymbol, true); // Examples if (oConstructor.examples) { oConstructor.examples.forEach((oExample) => { oExample.data = formatters.formatExample(oExample.caption, oExample.text); // Keep file size in check if (oExample.caption) { delete oExample.caption; } if (oExample.text) { delete oExample.text; } }); } // Code Example string oConstructor.codeExample = formatters.formatConstructor(oSymbol.name, oConstructor.parameters); // Parameters if (oConstructor.parameters) { oConstructor.parameters = methods.buildConstructorParameters(oConstructor.parameters); let aParameters = oConstructor.parameters; aParameters.forEach(oParameter => { // Types oParameter.types = []; if (oParameter.type) { let aTypes = oParameter.type.split("|"); for (let i = 0; i < aTypes.length; i++) { oParameter.types.push({ name: aTypes[i], linkEnabled: !isBuiltInType(aTypes[i]) }); } // Keep file size in check delete oParameter.type; } // Default value oParameter.defaultValue = formatters.formatDefaultValue(oParameter.defaultValue); // Description if (oParameter.description) { oParameter.description = formatters.formatDescription(oParameter.description); } }) } // Throws if (oConstructor.throws) { oConstructor.throws.forEach(oThrows => { // Description if (oThrows.description) { oThrows.description = formatters.formatDescription(oThrows.description); } // Exception link enabled if (oThrows.type) { oThrows.linkEnabled = formatters.formatExceptionLink(oThrows.type); } }); } } // Description if (oSymbol.description) { oSymbol.description = formatters.formatOverviewDescription(oSymbol.description, oSymbol.constructor.references); } // Deprecated if (oSymbol.deprecated) { oSymbol.deprecatedText = formatters.formatDeprecated(oSymbol.deprecated.since, oSymbol.deprecated.text); // Keep file size in check delete oSymbol.deprecated; } // Properties if (oSymbol.properties) { oSymbol.properties.forEach((oProperty) => { // Name oProperty.name = formatters.formatEntityName(oProperty.name, oSymbol.name, oProperty.static); // Description if (oProperty.deprecated) { oProperty.description = formatters.formatDescription(oProperty.description, oProperty.deprecated.text, oProperty.deprecated.since); } else { oProperty.description = formatters.formatDescription(oProperty.description); } // Link Enabled if (oSymbol.kind !== "enum" && !isBuiltInType(oProperty.type) && possibleUI5Symbol(oProperty.type)) { oProperty.linkEnabled = true; oProperty.href = "#/api/" + oProperty.type.replace("[]", ""); } // Keep file size in check if (oProperty.static) { delete oProperty.static; } if (oSymbol.kind === "enum" || oProperty.type === "undefined") { delete oProperty.type; } }); } // UI5 Metadata if (oSymbol["ui5-metadata"]) { let oMeta = oSymbol["ui5-metadata"]; // Properties if (oMeta.properties) { // Sort oMeta.properties.sort(function (a, b) { if (a.name < b.name) { return -1; } else if (a.name > b.name) { return 1; } else { return 0; } }); // Pre-process oMeta.properties.forEach((oProperty) => { // Name oProperty.name = formatters.formatEntityName(oProperty.name, oSymbol.name, oProperty.static); // Description oProperty.description = formatters.formatDescriptionSince(oProperty.description, oProperty.since); // Link Enabled if (!isBuiltInType(oProperty.type)) { oProperty.linkEnabled = true; } // Default value oProperty.defaultValue = formatters.formatDefaultValue(oProperty.defaultValue); // Deprecated if (oProperty.deprecated) { oProperty.deprecatedText = formatters.formatDeprecated(oProperty.deprecated.since, oProperty.deprecated.text); // Keep file size in check delete oProperty.deprecated; } }); } // Aggregations if (oMeta.aggregations) { // Sort oMeta.aggregations.sort(function (a, b) { if (a.name < b.name) { return -1; } else if (a.name > b.name) { return 1; } else { return 0; } }); // Pre-process oMeta.aggregations.forEach((oAggregation) => { // Link Enabled if (!isBuiltInType(oAggregation.type)) { oAggregation.linkEnabled = true; } // Description if (oAggregation.deprecated) { oAggregation.description = formatters.formatDescription(oAggregation.description, oAggregation.deprecated.text, oAggregation.deprecated.since); } else { oAggregation.description = formatters.formatDescription(oAggregation.description); } // Link enabled oAggregation.linkEnabled = !isBuiltInType(oAggregation.type); }); } // Associations if (oMeta.associations) { // Sort oMeta.associations.sort(function (a, b) { if (a.name < b.name) { return -1; } else if (a.name > b.name) { return 1; } else { return 0; } }); // Pre-process oMeta.associations.forEach((oAssociation) => { // Link Enabled if (!isBuiltInType(oAssociation.type)) { oAssociation.linkEnabled = true; } // Description if (oAssociation.deprecated) { oAssociation.description = formatters.formatDescription(oAssociation.description, oAssociation.deprecated.text, oAssociation.deprecated.since); } else { oAssociation.description = formatters.formatDescription(oAssociation.description); } }); } // Events if (oMeta.events) { // We don't need event's data from the UI5-metadata for now. Keep file size in check delete oMeta.events; } // Special Settings if (oMeta.specialSettings) { oMeta.specialSettings.forEach(oSetting => { // Link Enabled if (!isBuiltInType(oSetting.type)) { oSetting.linkEnabled = true; } // Description if (oSetting.deprecated) { oSetting.description = formatters.formatDescription(oSetting.description, oSetting.deprecated.text, oSetting.deprecated.since); } else { oSetting.description = formatters.formatDescription(oSetting.description); } }); } // Annotations if (oMeta.annotations) { oMeta.annotations.forEach(oAnnotation => { // Description oAnnotation.description = formatters.formatAnnotationDescription(oAnnotation.description, oAnnotation.since); // Namespace oAnnotation.namespaceText = oAnnotation.namespace; oAnnotation.namespace = formatters.formatAnnotationNamespace(oAnnotation.namespace); // Target oAnnotation.target = formatters.formatAnnotationTarget(oAnnotation.target); // Applies to oAnnotation.appliesTo = formatters.formatAnnotationTarget(oAnnotation.appliesTo); }); } } if (oSymbol.events) { // Pre-process events methods.buildEventsModel(oSymbol.events); oSymbol.events.forEach(oEvent => { // Description if (oEvent.description) { oEvent.description = formatters.formatDescriptionSince(oEvent.description, oEvent.since); } // Deprecated if (oEvent.deprecated) { oEvent.deprecatedText = formatters.formatEventDeprecated(oEvent.deprecated.since, oEvent.deprecated.text); } // Parameters if (oEvent.parameters && Array.isArray(oEvent.parameters)) { oEvent.parameters.forEach(oParameter => { // Link Enabled if (!isBuiltInType(oParameter.type)) { oParameter.linkEnabled = true; } // Description if (oParameter.deprecated) { oParameter.description = formatters.formatDescription(oParameter.description, oParameter.deprecated.text, oParameter.deprecated.since); } else { oParameter.description = formatters.formatDescription(oParameter.description); } }); } }); } // Methods if (oSymbol.methods) { // Pre-process methods methods.buildMethodsModel(oSymbol.methods); oSymbol.methods.forEach(oMethod => { // Name and link if (oMethod.name) { oMethod.name = formatters.formatEntityName(oMethod.name, oSymbol.name, oMethod.static); // Link oMethod.href = "#/api/" + encodeURIComponent(oSymbol.name) + "/methods/" + encodeURIComponent(oMethod.name); } formatters.formatReferencesInDescription(oMethod); // Description if (oMethod.description) { oMethod.description = formatters.formatDescription(oMethod.description); } // Examples oMethod.examples && oMethod.examples.forEach(oExample => { oExample = formatters.formatExample(oExample.caption, oExample.text); }); // Deprecated if (oMethod.deprecated) { oMethod.deprecatedText = formatters.formatEventDeprecated(oMethod.deprecated.since, oMethod.deprecated.text); } // Code example oMethod.code = formatters.formatMethodCode(oMethod.name, oMethod.parameters, oMethod.returnValue); // Parameters if (oMethod.parameters) { oMethod.parameters.forEach(oParameter => { // Types if (oParameter.types) { oParameter.types.forEach(oType => { // Link Enabled if (!isBuiltInType(oType.value) && possibleUI5Symbol(oType.value)) { oType.linkEnabled = true; oType.href = "#/api/" + oType.value.replace("[]", ""); } }); } // Default value oParameter.defaultValue = formatters.formatDefaultValue(oParameter.defaultValue); // Description if (oParameter.deprecated) { oParameter.description = formatters.formatDescription(oParameter.description, oParameter.deprecated.text, oParameter.deprecated.since); } else { oParameter.description = formatters.formatDescription(oParameter.description); } }); } // Return value if (oMethod.returnValue) { // Description oMethod.returnValue.description = formatters.formatDescription(oMethod.returnValue.description); // Types if (oMethod.returnValue.types) { oMethod.returnValue.types.forEach(oType => { // Link Enabled if (!isBuiltInType(oType.value)) { oType.href = "#/api/" + encodeURIComponent(oType.value.replace("[]", "")); oType.linkEnabled = true; } }); } } // Throws if (oMethod.throws) { oMethod.throws.forEach(oThrows => { // Description if (oThrows.description) { oThrows.description = formatters.formatDescription(oThrows.description); } // Exception link enabled if (oThrows.type) { oThrows.linkEnabled = formatters.formatExceptionLink(oThrows.type); } }); } // Examples if (oMethod.examples) { oMethod.examples.forEach((oExample) => { oExample.data = formatters.formatExample(oExample.caption, oExample.text); // Keep file size in check if (oExample.caption) { delete oExample.caption; } if (oExample.text) { delete oExample.text; } }); } }); } // Formatting namespaces, functions and enums, which may contain examples // or references with links to process them similar to methods and constructors of classes if (oSymbol.kind !== "class") { if (oSymbol.examples) { oSymbol.examples.forEach((oExample) => { oExample.data = formatters.formatExample(oExample.caption, oExample.text); // Keep file size in check if (oExample.caption) { delete oExample.caption; } if (oExample.text) { delete oExample.text; } }); } if (oSymbol.references) { formatters.modifyReferences(oSymbol); formatters.formatReferencesInDescription(oSymbol); } // Description if (oSymbol.description) { oSymbol.description = formatters.formatDescription(oSymbol.description); } } }); oChainObject.parsedData = oData; return oChainObject; }; function getDependencyLibraryFilesList(oChainObject) { // if vDependencyAPIFiles is an array, it contains the file paths of api.json files if ( Array.isArray(vDependencyAPIFiles) ) { return oChainObject; } // otherwise, it names a directory that has to be scanned for the files return new Promise(oResolve => { fs.readdir(vDependencyAPIFiles, function (oError, aItems) { if (!oError && aItems && aItems.length) { let aFiles = []; aItems.forEach(sItem => { aFiles.push(path.join(vDependencyAPIFiles, sItem)); }) oChainObject.aDependentLibraryFiles = aFiles; } oResolve(oChainObject); // We don't fail if no dependency library files are available }); }); } function loadDependencyLibraryFiles (oChainObject) { if (!oChainObject.aDependentLibraryFiles) { return oChainObject; } let aPromises = []; oChainObject.aDependentLibraryFiles.forEach(sFile => { aPromises.push(new Promise(oResolve => { fs.readFile(sFile, 'utf8', (oError, oData) => { oResolve(oError ? false : oData); }); })); }); return Promise.all(aPromises).then(aValues => { let oDependentAPIs = {}; aValues.forEach(sData => { let oData; try { oData = JSON.parse(sData); } catch (e) { // Silence possible dependency library invalid json errors as they are not critical // and we should not fail BCP: 1870560058 } // OpenUI5 build specific - own library can be listed as dependency library also. // In this case we don't add it to the dependency list to skip double iteration. if (oData && oChainObject.fileData.library !== oData.library) { oDependentAPIs[oData.library] = oData.symbols; } }); oChainObject.oDependentAPIs = oDependentAPIs; return oChainObject; }) } /** * Create api.json from parsed data * @param oChainObject chain object */ function createApiRefApiJson(oChainObject) { if (returnOutputFiles) { // If requested, return data instead of writing to FS (required by UI5 Tooling/UI5 Builder) return JSON.stringify(oChainObject.parsedData); } let sOutputDir = path.dirname(oChainObject.outputFile); // Create dir if it does not exist if (!fs.existsSync(sOutputDir)) { fs.mkdirSync(sOutputDir); } // Write result to file fs.writeFileSync(oChainObject.outputFile, JSON.stringify(oChainObject.parsedData) /* Transform back to string */, 'utf8'); } /** * Load .library file * @param oChainObject chain return object * @returns {Promise} library file promise */ function getLibraryPromise(oChainObject) { return new Promise(function(oResolve) { fs.readFile(oChainObject.libraryFile, 'utf8', (oError, oData) => { oChainObject.libraryFileData = oData; oResolve(oChainObject); }); }); } /** * Extracts components list and docuindex.json relative path from .library file data * @param {object} oChainObject chain object * @returns {object} chain object */ function extractComponentAndDocuindexUrl(oChainObject) { oChainObject.modules = []; if (oChainObject.libraryFileData) { let $ = cheerio.load(oChainObject.libraryFileData, { ignoreWhitespace: true, xmlMode: true, lowerCaseTags: false }); // Extract documentation URL oChainObject.docuPath = $("appData documentation").attr("indexUrl"); // Extract components $("ownership > component").each((i, oComponent) => { if (oComponent.children) { if (oComponent.children.length === 1) { oChainObject.defaultComponent = $(oComponent).text(); } else { let sCurrentComponentName = $(oComponent).find("name").text(); let aCurrentModules = []; $(oComponent).find("module").each((a, oC) => { aCurrentModules.push($(oC).text().replace(/\//g, ".")); }); oChainObject.modules.push({ componentName: sCurrentComponentName, modules: aCurrentModules }); } } }); } return oChainObject; } /** * Adds to the passed object custom symbol component map generated from the extracted components list * to be easily searchable later * @param {object} oChainObject chain object * @returns {object} chain object */ function flattenComponents(oChainObject) { if (oChainObject.modules && oChainObject.modules.length > 0) { oChainObject.customSymbolComponents = {}; oChainObject.modules.forEach(oComponent => { let sCurrentComponent = oComponent.componentName; oComponent.modules.forEach(sModule => { oChainObject.customSymbolComponents[sModule] = sCurrentComponent; }); }); } return oChainObject; } /** * Adds to the passed object array with entities which have explored samples * @param {object} oChainObject chain object * @returns {object} chain object */ function extractSamplesFromDocuIndex(oChainObject) { // If we have not extracted docuPath we return early if (!oChainObject.docuPath) { return oChainObject; } return new Promise(function(oResolve) { // Join .library path with relative docuindex.json path let sPath = path.join(path.dirname(oChainObject.libraryFile), oChainObject.docuPath); // Normalize path to resolve relative path sPath = path.normalize(sPath); fs.readFile(sPath, 'utf8', (oError, oFileData) => { if (!oError) { oFileData = JSON.parse(oFileData); if (oFileData.explored && oFileData.explored.entities && oFileData.explored.entities.length > 0) { oChainObject.entitiesWithSamples = []; oFileData.explored.entities.forEach(oEntity => { oChainObject.entitiesWithSamples.push(oEntity.id); }); } } // We aways resolve as this data is not mandatory oResolve(oChainObject); }); }); } /** * Load api.json file * @param {object} oChainObject chain object * @returns {object} chain object */ function getAPIJSONPromise(oChainObject) { return new Promise(function(oResolve, oReject) { fs.readFile(sInputFile, 'utf8', (oError, sFileData) => { if (oError) { oReject(oError); } else { oChainObject.fileData = JSON.parse(sFileData); oResolve(oChainObject); } }); }); } /* * ===================================================================================================================== * IMPORTANT NOTE: Formatter code is a copy from APIDetail.controller.js with a very little modification and mocking and * code can be significantly improved * ===================================================================================================================== */ let formatters = { _sTopicId: "", _oTopicData: {}, _baseTypes: [ "sap.ui.core.any", "sap.ui.core.object", "sap.ui.core.function", "sap.ui.core.number", // TODO discuss with Thomas, type does not exist "sap.ui.core.float", "sap.ui.core.int", "sap.ui.core.boolean", "sap.ui.core.string", "sap.ui.core.void", "null", "any", "any[]", "Error", "Error[]", "array", "element", "Element", "DomRef", "object", "Object", "object[]", "object|object[]", "[object Object][]", "Array.<[object Object]>", "Object.<string,string>", "function", "float", "int", "boolean", "string", "string[]", "number", "map", "promise", "Promise", "document", "Document", "Touch", "TouchList", "undefined" ], ANNOTATIONS_LINK: 'http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part3-csdl.html', ANNOTATIONS_NAMESPACE_LINK: 'http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/vocabularies/', /** * Adds "deprecated" information if such exists to the header area * @param deprecated - object containing information about deprecation * @returns {string} - the deprecated text to display */ formatSubtitle: function (deprecated) { var result = ""; if (deprecated) { result += "Deprecated in version: " + deprecated.since; } return result; }, /** * Formats the target and applies to texts of annotations * @param target - the array of texts to be formatted * @returns string - the formatted text */ formatAnnotationTarget: function (target) { var result = ""; if (target) { target.forEach(function (element) { result += element + '<br>'; }); } result = this._preProcessLinksInTextBlock(result); return result; }, /** * Formats the namespace of annotations * @param namespace - the namespace to be formatted * @returns string - the formatted text */ formatAnnotationNamespace: function (namespace) { var result, aNamespaceParts = namespace.split("."); if (aNamespaceParts[0] === "Org" && aNamespaceParts[1] === "OData") { result = '<a href="' + this.ANNOTATIONS_NAMESPACE_LINK + namespace + '.xml">' + namespace + '</a>'; } else { result = namespace; } result = this._preProcessLinksInTextBlock(result); return result; }, /** * Formats the description of annotations * @param description - the description of the annotation * @param since - the since version information of the annotation * @returns string - the formatted description */ formatAnnotationDescription: function (description, since) { var result = description || ""; result += '<br>For more information, see ' + this.handleExternalUrl(this.ANNOTATIONS_LINK, "OData v4 Annotations"); if (since) { result += '<br><br><i>Since: ' + since + '.</i>'; } result = this._preProcessLinksInTextBlock(result); return result; }, formatExceptionLink: function (linkText) { linkText = linkText || ''; return linkText.indexOf('sap.ui.') !== -1; }, formatMethodCode: function (sName, aParams, aReturnValue) { var result = '<pre class="prettyprint">' + sName + '('; if (aParams && aParams.length > 0) { /* We consider only root level parameters so we get rid of all that are not on the root level */ aParams = aParams.filter(oElem => { return oElem.depth === undefined; }); aParams.forEach(function (element, index, array) { result += element.name; if (element.optional) { result += '?'; } if (index < array.length - 1) { result += ', '; } }); } result += ') : '; if (aReturnValue) { result += aReturnValue.type; } else { result += 'void'; } result += "</pre>"; return result; }, /** * Formats method deprecation message and pre-process jsDoc link and code blocks * @param {string} sSince since text * @param {string} sDescription deprecation description text * @returns {string} formatted deprecation message */ formatMethodDeprecated: function (sSince, sDescription) { return this.formatDeprecated(sSince, sDescription, "methods"); }, /** * Formats event deprecation message and pre-process jsDoc link and code blocks * @param {string} sSince since text * @param {string} sDescription deprecation description text * @returns {string} formatted deprecation message */ formatEventDeprecated: function (sSince, sDescription) { return this.formatDeprecated(sSince, sDescription, "events"); }, /** * Formats the description of control properties * @param description - the description of the property * @param since - the since version information of the property * @returns string - the formatted description */ formatDescriptionSince: function (description, since) { var result = description || ""; if (since) { result += '<br><br><i>Since: ' + since + '.</i>'; } result = this._preProcessLinksInTextBlock(result); return result; }, /** * Formats the default value of the property as a string. * @param defaultValue - the default value of the property * @returns string - The default value of the property formatted as a string. */ formatDefaultValue: function (defaultValue) { var sReturn; switch (defaultValue) { case null: case undefined: sReturn = ''; break; case '': sReturn = 'empty string'; break; default: sReturn = defaultValue; } return Array.isArray(sReturn) ? sReturn.join(', ') : sReturn; }, /** * Formats the constructor of the class * @param name * @param params * @returns string - The code needed to create an object of that class */ formatConstructor: function (name, params) { var result = '<pre class="prettyprint">new '; if (name) { result += name + '('; } if (params) { params.forEach(function (element, index, array) { result += element.name; if (element.optional) { result += '?'; } if (index < array.length - 1) { result += ', '; } }); } if (name) { result += ')</pre>'; } return result; }, formatExample: function (sCaption, sText) { return this.formatDescription( ["<span><strong>Example: </strong>", sCaption, "<pre class='sapUiSmallMarginTop'>", sText, "</pre></span>"].join("") ); }, /** * Formats the name of a property or a method depending on if it's static or not * @param sName {string} - Name * @param sClassName {string} - Name of the class * @param bStatic {boolean} - If it's static * @returns {string} - Formatted name */ formatEntityName: function (sName, sClassName, bStatic) { return (bStatic === true) ? sClassName + "." + sName : sName; }, JSDocUtil: function () { var rEscapeRegExp = /[[\]{}()*+?.\\^$|]/g; // Local mocked methods var escapeRegExp = function escapeRegExp(sString) { return sString.replace(rEscapeRegExp, "\\$&"); }; function defaultLinkFormatter(target, text) { return "<code>" + (text || target) + "</code>"; } function format(src, options) { options = options || {}; var beforeParagraph = options.beforeParagraph === undefined ? '<p>' : options.beforeParagraph; var afterParagraph = options.afterParagraph === undefined ? '</p>' : options.afterParagraph; var beforeFirstParagraph = options.beforeFirstParagraph === undefined ? beforeParagraph : options.beforeFirstParagraph; var afterLastParagraph = options.afterLastParagraph === undefined ? afterParagraph : options.afterLastParagraph; var linkFormatter = typeof options.linkFormatter === 'function' ? options.linkFormatter : defaultLinkFormatter; /* * regexp to recognize important places in the text * * Capturing groups of the RegExp: * group 1: begin of a pre block * group 2: end of a pre block * group 3: begin of a header, implicitly ends a paragraph * group 4: end of a header, implicitly starts a new paragraph * group 5: target portion of an inline @link tag * group 6: (optional) text portion of an inline link tag * group 7: an empty line which implicitly starts a new paragraph * * [-- <pre> block -] [---- some header ----] [---- an inline [@link ...} tag ----] [---------- an empty line ---------] */ var r = /(<pre>)|(<\/pre>)|(<h[\d+]>)|(<\/h[\d+]>)|\{@link\s+([^}\s]+)(?:\s+([^\}]*))?\}|((?:\r\n|\r|\n)[ \t]*(?:\r\n|\r|\n))/gi; var inpre = false; src = src || ''; linkFormatter = linkFormatter || defaultLinkFormatter; src = beforeFirstParagraph + src.replace(r, function(match, pre, endpre, header, endheader, linkTarget, linkText, emptyline) { if ( pre ) { inpre = true; } else if ( endpre ) { inpre = false; } else if ( header ) { if ( !inpre ) { return afterParagraph + match; } } else if ( endheader ) { if ( !inpre ) { return match + beforeParagraph; } } else if ( emptyline ) { if ( !inpre ) { return afterParagraph + beforeParagraph; } } else if ( linkTarget ) { if ( !inpre ) { return linkFormatter(linkTarget, linkText); } } return match; }) + afterLastParagraph; // remove empty paragraphs if (beforeParagraph !== "" && afterParagraph !== "") { src = src.replace(new RegExp(escapeRegExp(beforeParagraph) + "\\s*" + escapeRegExp(afterParagraph), "g"), ""); } return src; } return { formatTextBlock: format }; }, handleExternalUrl: function (sTarget, sText) { // Check if the external domain is SAP hosted let bSAPHosted = /^https?:\/\/(?:www.)?[\w.]*(?:sap|hana\.ondemand|sapfioritrial)\.com/.test(sTarget); return `<a target="_blank" href="${sTarget}">${sText}</a> <img src="./resources/sap/ui/documentation/sdk/images/${bSAPHosted ? 'link-sap' : 'link-external'}.png" title="Information published on ${bSAPHosted ? '' : 'non '}SAP site" class="sapUISDKExternalLink"/>`; }, /** * Discover possible target type by looking at symbols from own and depending libraries * @param {string} target * @param {object} self * @param {object} ownLibrary * @param {object} dependencyLibs * @param {boolean} module * @returns {string} */ createLinkFromTargetType: function ({className, methodName, target, self, ownLibrary, dependencyLibs, text}) { let sResult; function searchInSymbol(oSymbol) { function findProperty(oEntity, sName, sTarget) { if (!oEntity || !oEntity.properties) { return; } return oEntity.properties.find(({name}) => name === sName || name === sTarget); } function findMethod(oEntity, sName, sTarget) { if (!oEntity || !oEntity.methods) { return; } return oEntity.methods.find(({name}) => name === sName || name === sTarget); } function findEvent(oEntity, sName) { if (!oEntity || !oEntity.events) { return; } return oEntity.events.find(({name}) => name === sName); } if (oSymbol.name === target) { sResult = this.createLink({ name: oSymbol.name, text: text }); return true; } if (oSymbol.name === className) { let oProperty = findProperty(oSymbol, methodName, target); if (oProperty) { sResult = this.createLink({ name: oProperty.name, text: text }); return true; } let oMethod = findMethod(oSymbol, methodName, target); if (oMethod) { sResult = this.createLink({ name: oMethod.static ? target : oMethod.name, type: "methods", text: text, className: className }); return true; } let oEvent = findEvent(oSymbol, methodName); if (oEvent) { sResult = this.createLink({ name: oEvent.name, type: "events", text: text, className: className }); return true; } } return false; } // Self link if (self.name === target) { return this.createLink({ name: target, text: text }); } // Own methods search if (self.name === className && self.methods) { let oResult = self.methods.find(({name}) => name === methodName); if (oResult) { return this.createLink({ name: oResult.static ? [self.name, oResult.name].join(".") : oResult.name, type: "methods", className: className, text: text, local: true }); } } // Local library symbols ownLibrary.symbols.find(oSymbol => { return searchInSymbol.call(this, oSymbol); }); if (sResult) return sResult; // Dependent library symbols dependencyLibs && Object.keys(dependencyLibs).find(sLib => { if (sLib === target) { sResult = this.createLink({ name: sLib, text: text }); return true; } return dependencyLibs[sLib].find(oSymbol => { return searchInSymbol.call(this, oSymbol); }); }); return sResult; }, /** * Creates a html link * @param {string} name * @param {string} type * @param {string} className * @param {string} [text=name] by default if no text is provided the name will be used * @param {boolean} [local=false] * @param {string} [hrefAppend=""] * @returns {string} link */ createLink: function ({name, type, className, text=name, local=false, hrefAppend=""}) { let sLink; // handling module's if (className !== undefined && (/^module:/.test(name) || /^module:/.test(className))) { name = name.replace(/^module:/, ""); } name = encodeURIComponent(name); className = encodeURIComponent(className); // Build the link sLink = type ? `${className}/${type}/${name}` : name; if (hrefAppend) { sLink += hrefAppend; } if (local) { return `<a target="_self" class="jsdoclink scrollTo${type === `events` ? `Event` : `Method`}" data-sap-ui-target="${name}" href="#/api/${sLink}">${text}</a>`; } return `<a target="_self" class="jsdoclink" href="#/api/${sLink}">${text}</a>`; }, /** * Pre-process links in text block * @param {string} sText text block * @param {boolean} bSkipParagraphs skip paragraphs * @returns {string} processed text block * @private */ _preProcessLinksInTextBlock: function (sText, bSkipParagraphs) { let oSelf = this._oTopicData, oOwnLibrary = this._oOwnLibrary, oDependencyLibs = oChainObject.oDependentAPIs, oOptions = { linkFormatter: function (sTarget, sText) { let aMatch, aTarget; // keep the full target in the fallback text sText = sText || sTarget; // If the link has a protocol, do not modify, but open in a new window if (/:\/\//.test(sTarget)) { return this.handleExternalUrl(sTarget, sText); } // topic:xxx Topic aMatch = sTarget.match(/^topic:(\w{32})$/); if (aMatch) { return '<a target="_self" href="#/topic/' + aMatch[1] + '">' + sText + '</a>'; } // sap.x.Xxx.prototype.xxx - In case of prototype we have a link to method aMatch = sTarget.match(/([a-zA-Z0-9.$_]+?)\.prototype\.([a-zA-Z0-9.$_]+)$/); if (aMatch) { return this.createLink({ name: aMatch[2], type: "methods", className: aMatch[1], text: sText }); } // Heuristics: Extend is always a static method // sap.x.Xxx.extend // module:sap/x/Xxx.extend aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+?)\.extend$/); if (aMatch) { let [, sModule, sClass] = aMatch; return this.createLink({ name: sTarget.replace(/^module:/, ""), type: "methods", className: (sModule ? sModule : "") + sClass, text: sText }); } // Constructor links are handled in special manner by the SDK // sap.x.Xxx.constructor // sap.x.Xxx#constructor // module:sap/x/Xxx.constructor // #constructor aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+?)?[\.#]constructor$/i); if (aMatch) { let [, sModule, sClass] = aMatch, sName; if (sClass) { sName = (sModule ? sModule : "") + sClass; } else { sName = oSelf.name } return this.createLink({ name: sName, hrefAppend: "/constructor", text: sText }); } // #.setText - local static method // #setText - local instance method // #.setText.from - local nested method aMatch = sTarget.match(/^#(\.)?([a-zA-Z0-9.$_]+)$/); if (aMatch) { return this.createLink({ name: aMatch[1] ? `${oSelf.name}.${aMatch[2]}` : aMatch[2], type: "methods", className: oSelf.name, local: true, text: sText }); } // #event:press - local event aMatch = sTarget.match(/^#event:([a-zA-Z0-9$_]+)$/); if (aMatch) { return this.createLink({ name: aMatch[1], type: "events", className: oSelf.name, local: true, text: sText }); } // Event links // sap.m.Button#event:press // sap.m.Button.event:press // module:sap/m/Button.event:press // module:sap/m/Button#event:press aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+?)[.#]event:([a-zA-Z0-9$_]+)$/); if (aMatch) { let [, sModule, sClass, sEvent] = aMatch; return this.createLink({ name: sEvent, type: "events", className: (sModule ? sModule : "") + sClass, text: sText }); } // sap.m.Button#setText - instance method // module:sap/m/Button#setText aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+)#([a-zA-Z0-9.$_]+)$/); if (aMatch) { let [, sModule, sClass, sMethod] = aMatch; return this.createLink({ name: sMethod, type: "methods", className: (sModule ? sModule : "") + sClass, text: sText }); } // Unresolved type - try to discover target type // sap.x.Xxx.xxx // module:sap/x/Xxx.xxx if (/^(?:module:)?([a-zA-Z0-9.$_\/]+?)\.([a-zA-Z0-9$_]+)$/.test(sTarget)) { let [,sClass, sName] = sTarget.match(/^((?:module:)?[a-zA-Z0-9.$_\/]+?)\.([a-zA-Z0-9$_]+)$/), sResult = this.createLinkFromTargetType({ className: sClass, methodName: sName, target: sTarget, self: oSelf, ownLibrary: oOwnLibrary, dependencyLibs: oDependencyLibs, text: sText }); if (sResult) { return sResult; } } // Possible nested functions discovery - currently we do this only for regular symbols aTarget = sTarget.split("."); if (aTarget.length >= 3) { let sResult = this.createLinkFromTargetType({ methodName: aTarget.splice(-2).join("."), className: aTarget.join("."), target: sTarget, self: oSelf, ownLibrary: oOwnLibrary, dependencyLibs: oDependencyLibs, text: sText }); if (sResult) { return sResult; } } // Possible forward reference - we will treat them as symbol link return this.createLink({ name: sTarget, text: sText }); }.bind(this) }; if (bSkipParagraphs) { oOptions.beforeParagraph = ""; oOptions.afterParagraph = ""; } return this.JSDocUtil().formatTextBlock(sText, oOptions); }, /** * Formatter for Overview section * @param {string} sDescription - Class about description * @param {array} aReferences - References * @returns {string} - formatted text block */ formatOverviewDescription: function (sDescription, aReferences) { var iLen, i; // format references if (aReferences && aReferences.length > 0) { sDescription += "<br><br><span>Documentation links:</span><ul>"; iLen = aReferences.length; for (i = 0; i < iLen; i++) { // We treat references as links but as they may not be defined as such we enforce it if needed if (/{@link.*}/.test(aReferences[i])) { sDescription += "<li>" + aReferences[i] + "</li>"; } else { sDescription += "<li>{@link " + aReferences[i] + "}</li>"; } } sDescription += "</ul>"; } // Calling formatDescription so it could handle further formatting return this.formatDescription(sDescription); }, /** * Formats the description of the property * @param description - the description of the property * @param deprecatedText - the text explaining this property is deprecated * @param deprecatedSince - the version when this property was deprecated * @returns string - the formatted description */ formatDescription: function (description, deprecatedText, deprecatedSince) { if (!description && !deprecatedText && !deprecatedSince) { return ""; } var result = description || ""; if (deprecatedSince || deprecatedText) { // Note: sapUiDocumentationDeprecated - transformed to sapUiDeprecated to keep json file size low result += "<span class=\"sapUiDeprecated\"><br>"; result += this.formatDeprecated(deprecatedSince, deprecatedText); result += "</span>"; } result = this._preProcessLinksInTextBlock(result); return result; }, /** * Formats the entity deprecation message and pre-process jsDoc link and code blocks * @param {string} sSince since text * @param {string} sDescription deprecation description text * @param {string} sEntityType string representation of entity type * @returns {string} formatted deprecation message */ formatDeprecated: function (sSince, sDescription, sEntityType) { var aResult; // Build deprecation message // Note: there may be no since or no description text available aResult = ["Deprecated"]; if (sSince) { aResult.push(" as of version " + sSince); } if (sDescription) { // Evaluate code blocks - Handle <code>...</code> pattern sDescription = sDescription.replace(/<code>(\S+)<\/code>/gi, function (sMatch, sCodeEntity) { return ['<em>', sCodeEntity, '</em>'].join(""); } ); // Evaluate links in the deprecation description aResult.push(". " + this._preProcessLinksInTextBlock(sDescription, true)); } return aResult.join(""); }, /** * Pre-process and modify references * @param {object} oSymbol control data object which will be modified * @private */ modifyReferences: function (oSymbol, bCalledOnConstructor) { var bHeaderDocuLinkFound = false, bUXGuidelinesLinkFound = false, aReferences = [], entity = bCalledOnConstructor? oSymbol.constructor.references : oSymbol.references; const UX_GUIDELINES_BASE_URL = "https://experience.sap.com/fiori-design-web/"; if (entity && entity.length > 0) { entity.forEach(function (sReference) { var aParts; // Docu link - For the header we take into account only the first link that matches one of the patterns if (!bHeaderDocuLinkFound) { // Handled patterns: // * topic:59a0e11712e84a648bb990a1dba76bc7 // * {@link topic:59a0e11712e84a648bb990a1dba76bc7} // * {@link topic:59a0e11712e84a648bb990a1dba76bc7 Link text} aParts = sReference.match(/^{@link\s+topic:(\w{32})(\s.+)?}$|^topic:(\w{32})$/); if (aParts) { if (aParts[3]) { // Link is of type topic:GUID oSymbol.docuLink = aParts[3]; oSymbol.docuLinkText = oSymbol.basename; } else if (aParts[1]) { // Link of type {@link topic:GUID} or {@link topic:GUID Link text} oSymbol.docuLink = aParts[1]; oSymbol.docuLinkText = aParts[2] ? aParts[2] : oSymbol.basename; } bHeaderDocuLinkFound = true; return; } } // Fiori link - Handled patterns: // * fiori:flexible-column-layout // * fiori:/flexible-column-layout/ // * fiori:https://experience.sap.com/fiori-design-web/flexible-column-layout/ // * {@link fiori:flexible-column-layout} // * {@link fiori:/flexible-column-layout/} // * {@link fiori:/flexible-column-layout/ Flexible Column Layout} // * {@link fiori:https://experience.sap.com/fiori-design-web/flexible-column-layout/} // * {@link fiori:https://experience.sap.com/fiori-design-web/flexible-column-layout/ Flexible Column Layout} aParts = sReference.match(/^(?:{@link\s)?fiori:(?:https:\/\/experience\.sap\.com\/fiori-design-web\/)?\/?(\S+\b)\/?\s?(.*[^\s}])?}?$/); if (aParts) { let [, sTarget, sTargetName] = aParts; if (bCalledOnConstructor && !bUXGuidelinesLinkFound) { // Extract first found UX Guidelines link as primary oSymbol.uxGuidelinesLink = UX_GUIDELINES_BASE_URL + sTarget; oSymbol.uxGuidelinesLinkText = sTargetName ? sTargetName : oSymbol.basename; bUXGuidelinesLinkFound = true; return; } else { // BCP: 1870155880 - Every consecutive "fiori:" link should be handled as a normal link sReference = "{@link " + UX_GUIDELINES_BASE_URL + sTarget + (sTargetName ? " " + sTargetName : "") + "}"; } } aReferences.push(sReference); }); bCalledOnConstructor? oSymbol.constructor.references = aReferences : oSymbol.references = aReferences; } else { bCalledOnConstructor? oSymbol.constructor.references = [] : oSymbol.references = []; } }, /** * Manage References, to apply as an unordered list in the description * @param {object} oEntity control data object which will be modified * @private */ formatReferencesInDescription: function(oEntity) { if (oEntity.references && Array.isArray(oEntity.references)) { oEntity.references = oEntity.references.map(sReference => { return `<li>${sReference}</li>`; }); if (!oEntity.description) { // If there is no method description - references should be the first line of it oEntity.description = ''; } else { oEntity.description += '<br><br>'; } oEntity.description += `References: <ul>${oEntity.references.join("")}</ul>`; } } }; /* Methods direct copy from API Detail */ let methods = { /** * Adjusts methods info so that it can be easily displayed in a table * @param aMethods - the methods array initially coming from the server */ buildMethodsModel: function (aMethods) { var fnCreateTypesArr = function (sTypes) { return sTypes.split("|").map(function (sType) { return {value: sType} }); }; var fnExtractParameterProperties = function (oParameter, aParameters, iDepth, aPhoneName) { if (oParameter.parameterProperties) { Object.keys(oParameter.parameterProperties).forEach(function (sProperty) { var oProperty = oParameter.parameterProperties[sProperty]; oProperty.depth = iDepth; // Handle types if (oProperty.type) { oProperty.types = fnCreateTypesArr(oProperty.type); } // Phone name - available only for parameters oProperty.phoneName = [aPhoneName.join("."), oProperty.name].join("."); // Add property to parameter array as we need a simple structure aParameters.push(oProperty); // Handle child parameterProperties fnExtractParameterProperties(oProperty, aParameters, (iDepth + 1), aPhoneName.concat([oProperty.name])); // Keep file size in check delete oProperty.type; }); // Keep file size in check delete oParameter.parameterProperties; } }; aMethods.forEach(function (oMethod) { // New array to hold modified parameters var aParameters = []; // Handle parameters if (oMethod.parameters) { oMethod.parameters.forEach(function (oParameter) { if (oParameter.type) { oParameter.types = fnCreateTypesArr(oParameter.type); } // Keep file size in check delete oParameter.type; // Add the parameter before the properties aParameters.push(oParameter); // Handle Parameter Properties // Note: We flatten the structure fnExtractParameterProperties(oParameter, aParameters, 1, [oParameter.name]); }); // Override the old data oMethod.parameters = aParameters; } // Handle return values if (oMethod.returnValue && oMethod.returnValue.type) { // Handle types oMethod.returnValue.types = fnCreateTypesArr(oMethod.returnValue.type); } }); }, /** * Adjusts events info so that it can be easily displayed in a table * @param {Array} aEvents - the events array initially coming from the server */ buildEventsModel: function (aEvents) { var fnExtractParameterProperties = function (oParameter, aParameters, iDepth, aPhoneName) { if (oParameter.parameterProperties) { Object.keys(oParameter.parameterProperties).forEach(function (sProperty) { var oProperty = oParameter.parameterProperties[sProperty], sPhoneTypeSuffix; oProperty.depth = iDepth; // Phone name - available only for parameters sPhoneTypeSuffix = oProperty.type === "array" ? "[]" : ""; oProperty.phoneName = [aPhoneName.join("."), (oProperty.name + sPhoneTypeSuffix)].join("."); // Add property to parameter array as we need a simple structure aParameters.push(oProperty); // Handle child parameterProperties fnExtractParameterProperties(oProperty, aParameters, (iDepth + 1), aPhoneName.concat([oProperty.name + sPhoneTypeSuffix])); }); // Keep file size in check delete oParameter.parameterProperties; } }; aEvents.forEach(function (aEvents) { // New array to hold modified parameters var aParameters = []; // Handle parameters if (aEvents.parameters) { aEvents.parameters.forEach(function (oParameter) { // Add the parameter before the properties aParameters.push(oParameter); // Handle Parameter Properties // Note: We flatten the structure fnExtractParameterProperties(oParameter, aParameters, 1, [oParameter.name]); }); // Override the old data aEvents.parameters = aParameters; } }); }, /** * Adjusts constructor parameters info so that it can be easily displayed in a table * @param {Array} aParameters - the events array initially coming from the server */ buildConstructorParameters: function (aParameters) { // New array to hold modified parameters var aNodes = [], processNode = function (oNode, sPhoneName, iDepth, aNodes) { // Handle phone name oNode.phoneName = sPhoneName ? [sPhoneName, oNode.name].join(".") : oNode.name; // Depth oNode.depth = iDepth; // Add to array aNodes.push(oNode); // Handle nesting if (oNode.parameterProperties) { Object.keys(oNode.parameterProperties).forEach(function (sNode) { processNode(oNode.parameterProperties[sNode], oNode.phoneName, (iDepth + 1), aNodes); }); } delete oNode.parameterProperties; }; aParameters.forEach(function (oParameter) { // Handle Parameter Properties // Note: We flatten the structure processNode(oParameter, undefined, 0, aNodes); }); return aNodes; }, oLibsData: {}, }; // Create the chain object let oChainObject = { inputFile: sInputFile, outputFile: sOutputFile, libraryFile: sLibraryFile, aDependentLibraryFiles: Array.isArray(vDependencyAPIFiles) ? vDependencyAPIFiles : null }; // Start the work here let p = getLibraryPromise(oChainObject) .then(extractComponentAndDocuindexUrl) .then(flattenComponents) .then(extractSamplesFromDocuIndex) .then(getDependencyLibraryFilesList) .then(getAPIJSONPromise) .then(loadDependencyLibraryFiles) .then(transformApiJson) .then(createApiRefApiJson); return p; }
javascript
function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles, options) { const fs = options && options.fs || require("fs"); const returnOutputFiles = options && !!options.returnOutputFiles; log.info("Transform API index files for sap.ui.documentation"); log.info(" original file: " + sInputFile); log.info(" output file: " + sOutputFile); log.info(" library file: " + sLibraryFile); log.info(" dependency dir: " + vDependencyAPIFiles); if (options && options.fs) { log.info("Using custom fs."); } if (returnOutputFiles) { log.info("Returning output files instead of writing to fs.") } log.info(""); /** * Transforms api.json file * @param {object} oChainObject chain object */ let transformApiJson = function (oChainObject) { function isBuiltInType(type) { return formatters._baseTypes.indexOf(type) >= 0; } /** * Heuristically determining if there is a possibility the given input string * to be a UI5 symbol * @param {string} sName * @returns {boolean} */ function possibleUI5Symbol(sName) { return /^[a-zA-Z][a-zA-Z.]*[a-zA-Z]$/.test(sName); } // Function is a copy from: LibraryInfo.js => LibraryInfo.prototype._getActualComponent => "match" inline method function matchComponent(sModuleName, sPattern) { sModuleName = sModuleName.toLowerCase(); sPattern = sPattern.toLowerCase(); return ( sModuleName === sPattern || sPattern.match(/\*$/) && sModuleName.indexOf(sPattern.slice(0,-1)) === 0 // simple prefix match || sPattern.match(/\.\*$/) && sModuleName === sPattern.slice(0,-2) // directory pattern also matches directory itself ); } /** * Pre-processes the symbols list - creating virtual namespace records and attaching children list to namespace * records. * @param {object} symbols list */ function preProcessSymbols(symbols) { // Create treeName and modify module names symbols.forEach(oSymbol => { let sModuleClearName = oSymbol.name.replace(/^module:/, ""); oSymbol.displayName = sModuleClearName; oSymbol.treeName = sModuleClearName.replace(/\//g, "."); }); // Create missing - virtual namespaces symbols.forEach(oSymbol => { oSymbol.treeName.split(".").forEach((sPart, i, a) => { let sName = a.slice(0, (i + 1)).join("."); if (!symbols.find(o => o.treeName === sName)) { symbols.push({ name: sName, displayName: sName, treeName: sName, lib: oSymbol.lib, kind: "namespace" }); } }); }); // Discover parents symbols.forEach(oSymbol => { let aParent = oSymbol.treeName.split("."), sParent; // Extract parent name aParent.pop(); sParent = aParent.join("."); // Mark parent if (symbols.find(({treeName}) => treeName === sParent)) { oSymbol.parent = sParent; } }); // Attach children info symbols.forEach(oSymbol => { if (oSymbol.parent) { let oParent = symbols.find(({treeName}) => treeName === oSymbol.parent); if (!oParent.nodes) oParent.nodes = []; oParent.nodes.push({ name: oSymbol.displayName, description: formatters._preProcessLinksInTextBlock(oSymbol.description), href: "#/api/" + encodeURIComponent(oSymbol.name) }); } }); // Clean list - keep file size down symbols.forEach(o => { delete o.treeName; delete o.parent; }); } // Transform to object let oData = oChainObject.fileData; // Attach default component for the library if available if (oChainObject.defaultComponent) { oData.defaultComponent = oChainObject.defaultComponent; } formatters._oOwnLibrary = oData; // Pre process symbols preProcessSymbols(oData.symbols); // Apply formatter's and modify data as needed oData.symbols.forEach((oSymbol) => { // when the module name starts with the library name, then we apply the default component if (oSymbol.name.indexOf(oData.library) === 0) { oSymbol.component = oChainObject.defaultComponent; } // Attach symbol specific component if available (special cases) // Note: Last hit wins as there may be a more specific component pattern if (oChainObject.customSymbolComponents) { Object.keys(oChainObject.customSymbolComponents).forEach(sComponent => { if (matchComponent(oSymbol.name, sComponent)) { oSymbol.component = oChainObject.customSymbolComponents[sComponent]; } }); } // Attach symbol sample flag if available if (oChainObject.entitiesWithSamples) { oSymbol.hasSample = oChainObject.entitiesWithSamples.indexOf(oSymbol.name) >= 0; } // Apply settings to formatter object - needed until formatter's are rewritten formatters._sTopicId = oSymbol.name; formatters._oTopicData = oSymbol; // Format Page Title oSymbol.title = (oSymbol.abstract ? "abstract " : "") + oSymbol.kind + " " + oSymbol.displayName; oSymbol.subTitle = formatters.formatSubtitle(oSymbol.deprecated); // Constructor if (oSymbol.constructor) { let oConstructor = oSymbol.constructor; // Description if (oConstructor.description) { oConstructor.description = formatters.formatDescription(oConstructor.description); } // References formatters.modifyReferences(oSymbol, true); // Examples if (oConstructor.examples) { oConstructor.examples.forEach((oExample) => { oExample.data = formatters.formatExample(oExample.caption, oExample.text); // Keep file size in check if (oExample.caption) { delete oExample.caption; } if (oExample.text) { delete oExample.text; } }); } // Code Example string oConstructor.codeExample = formatters.formatConstructor(oSymbol.name, oConstructor.parameters); // Parameters if (oConstructor.parameters) { oConstructor.parameters = methods.buildConstructorParameters(oConstructor.parameters); let aParameters = oConstructor.parameters; aParameters.forEach(oParameter => { // Types oParameter.types = []; if (oParameter.type) { let aTypes = oParameter.type.split("|"); for (let i = 0; i < aTypes.length; i++) { oParameter.types.push({ name: aTypes[i], linkEnabled: !isBuiltInType(aTypes[i]) }); } // Keep file size in check delete oParameter.type; } // Default value oParameter.defaultValue = formatters.formatDefaultValue(oParameter.defaultValue); // Description if (oParameter.description) { oParameter.description = formatters.formatDescription(oParameter.description); } }) } // Throws if (oConstructor.throws) { oConstructor.throws.forEach(oThrows => { // Description if (oThrows.description) { oThrows.description = formatters.formatDescription(oThrows.description); } // Exception link enabled if (oThrows.type) { oThrows.linkEnabled = formatters.formatExceptionLink(oThrows.type); } }); } } // Description if (oSymbol.description) { oSymbol.description = formatters.formatOverviewDescription(oSymbol.description, oSymbol.constructor.references); } // Deprecated if (oSymbol.deprecated) { oSymbol.deprecatedText = formatters.formatDeprecated(oSymbol.deprecated.since, oSymbol.deprecated.text); // Keep file size in check delete oSymbol.deprecated; } // Properties if (oSymbol.properties) { oSymbol.properties.forEach((oProperty) => { // Name oProperty.name = formatters.formatEntityName(oProperty.name, oSymbol.name, oProperty.static); // Description if (oProperty.deprecated) { oProperty.description = formatters.formatDescription(oProperty.description, oProperty.deprecated.text, oProperty.deprecated.since); } else { oProperty.description = formatters.formatDescription(oProperty.description); } // Link Enabled if (oSymbol.kind !== "enum" && !isBuiltInType(oProperty.type) && possibleUI5Symbol(oProperty.type)) { oProperty.linkEnabled = true; oProperty.href = "#/api/" + oProperty.type.replace("[]", ""); } // Keep file size in check if (oProperty.static) { delete oProperty.static; } if (oSymbol.kind === "enum" || oProperty.type === "undefined") { delete oProperty.type; } }); } // UI5 Metadata if (oSymbol["ui5-metadata"]) { let oMeta = oSymbol["ui5-metadata"]; // Properties if (oMeta.properties) { // Sort oMeta.properties.sort(function (a, b) { if (a.name < b.name) { return -1; } else if (a.name > b.name) { return 1; } else { return 0; } }); // Pre-process oMeta.properties.forEach((oProperty) => { // Name oProperty.name = formatters.formatEntityName(oProperty.name, oSymbol.name, oProperty.static); // Description oProperty.description = formatters.formatDescriptionSince(oProperty.description, oProperty.since); // Link Enabled if (!isBuiltInType(oProperty.type)) { oProperty.linkEnabled = true; } // Default value oProperty.defaultValue = formatters.formatDefaultValue(oProperty.defaultValue); // Deprecated if (oProperty.deprecated) { oProperty.deprecatedText = formatters.formatDeprecated(oProperty.deprecated.since, oProperty.deprecated.text); // Keep file size in check delete oProperty.deprecated; } }); } // Aggregations if (oMeta.aggregations) { // Sort oMeta.aggregations.sort(function (a, b) { if (a.name < b.name) { return -1; } else if (a.name > b.name) { return 1; } else { return 0; } }); // Pre-process oMeta.aggregations.forEach((oAggregation) => { // Link Enabled if (!isBuiltInType(oAggregation.type)) { oAggregation.linkEnabled = true; } // Description if (oAggregation.deprecated) { oAggregation.description = formatters.formatDescription(oAggregation.description, oAggregation.deprecated.text, oAggregation.deprecated.since); } else { oAggregation.description = formatters.formatDescription(oAggregation.description); } // Link enabled oAggregation.linkEnabled = !isBuiltInType(oAggregation.type); }); } // Associations if (oMeta.associations) { // Sort oMeta.associations.sort(function (a, b) { if (a.name < b.name) { return -1; } else if (a.name > b.name) { return 1; } else { return 0; } }); // Pre-process oMeta.associations.forEach((oAssociation) => { // Link Enabled if (!isBuiltInType(oAssociation.type)) { oAssociation.linkEnabled = true; } // Description if (oAssociation.deprecated) { oAssociation.description = formatters.formatDescription(oAssociation.description, oAssociation.deprecated.text, oAssociation.deprecated.since); } else { oAssociation.description = formatters.formatDescription(oAssociation.description); } }); } // Events if (oMeta.events) { // We don't need event's data from the UI5-metadata for now. Keep file size in check delete oMeta.events; } // Special Settings if (oMeta.specialSettings) { oMeta.specialSettings.forEach(oSetting => { // Link Enabled if (!isBuiltInType(oSetting.type)) { oSetting.linkEnabled = true; } // Description if (oSetting.deprecated) { oSetting.description = formatters.formatDescription(oSetting.description, oSetting.deprecated.text, oSetting.deprecated.since); } else { oSetting.description = formatters.formatDescription(oSetting.description); } }); } // Annotations if (oMeta.annotations) { oMeta.annotations.forEach(oAnnotation => { // Description oAnnotation.description = formatters.formatAnnotationDescription(oAnnotation.description, oAnnotation.since); // Namespace oAnnotation.namespaceText = oAnnotation.namespace; oAnnotation.namespace = formatters.formatAnnotationNamespace(oAnnotation.namespace); // Target oAnnotation.target = formatters.formatAnnotationTarget(oAnnotation.target); // Applies to oAnnotation.appliesTo = formatters.formatAnnotationTarget(oAnnotation.appliesTo); }); } } if (oSymbol.events) { // Pre-process events methods.buildEventsModel(oSymbol.events); oSymbol.events.forEach(oEvent => { // Description if (oEvent.description) { oEvent.description = formatters.formatDescriptionSince(oEvent.description, oEvent.since); } // Deprecated if (oEvent.deprecated) { oEvent.deprecatedText = formatters.formatEventDeprecated(oEvent.deprecated.since, oEvent.deprecated.text); } // Parameters if (oEvent.parameters && Array.isArray(oEvent.parameters)) { oEvent.parameters.forEach(oParameter => { // Link Enabled if (!isBuiltInType(oParameter.type)) { oParameter.linkEnabled = true; } // Description if (oParameter.deprecated) { oParameter.description = formatters.formatDescription(oParameter.description, oParameter.deprecated.text, oParameter.deprecated.since); } else { oParameter.description = formatters.formatDescription(oParameter.description); } }); } }); } // Methods if (oSymbol.methods) { // Pre-process methods methods.buildMethodsModel(oSymbol.methods); oSymbol.methods.forEach(oMethod => { // Name and link if (oMethod.name) { oMethod.name = formatters.formatEntityName(oMethod.name, oSymbol.name, oMethod.static); // Link oMethod.href = "#/api/" + encodeURIComponent(oSymbol.name) + "/methods/" + encodeURIComponent(oMethod.name); } formatters.formatReferencesInDescription(oMethod); // Description if (oMethod.description) { oMethod.description = formatters.formatDescription(oMethod.description); } // Examples oMethod.examples && oMethod.examples.forEach(oExample => { oExample = formatters.formatExample(oExample.caption, oExample.text); }); // Deprecated if (oMethod.deprecated) { oMethod.deprecatedText = formatters.formatEventDeprecated(oMethod.deprecated.since, oMethod.deprecated.text); } // Code example oMethod.code = formatters.formatMethodCode(oMethod.name, oMethod.parameters, oMethod.returnValue); // Parameters if (oMethod.parameters) { oMethod.parameters.forEach(oParameter => { // Types if (oParameter.types) { oParameter.types.forEach(oType => { // Link Enabled if (!isBuiltInType(oType.value) && possibleUI5Symbol(oType.value)) { oType.linkEnabled = true; oType.href = "#/api/" + oType.value.replace("[]", ""); } }); } // Default value oParameter.defaultValue = formatters.formatDefaultValue(oParameter.defaultValue); // Description if (oParameter.deprecated) { oParameter.description = formatters.formatDescription(oParameter.description, oParameter.deprecated.text, oParameter.deprecated.since); } else { oParameter.description = formatters.formatDescription(oParameter.description); } }); } // Return value if (oMethod.returnValue) { // Description oMethod.returnValue.description = formatters.formatDescription(oMethod.returnValue.description); // Types if (oMethod.returnValue.types) { oMethod.returnValue.types.forEach(oType => { // Link Enabled if (!isBuiltInType(oType.value)) { oType.href = "#/api/" + encodeURIComponent(oType.value.replace("[]", "")); oType.linkEnabled = true; } }); } } // Throws if (oMethod.throws) { oMethod.throws.forEach(oThrows => { // Description if (oThrows.description) { oThrows.description = formatters.formatDescription(oThrows.description); } // Exception link enabled if (oThrows.type) { oThrows.linkEnabled = formatters.formatExceptionLink(oThrows.type); } }); } // Examples if (oMethod.examples) { oMethod.examples.forEach((oExample) => { oExample.data = formatters.formatExample(oExample.caption, oExample.text); // Keep file size in check if (oExample.caption) { delete oExample.caption; } if (oExample.text) { delete oExample.text; } }); } }); } // Formatting namespaces, functions and enums, which may contain examples // or references with links to process them similar to methods and constructors of classes if (oSymbol.kind !== "class") { if (oSymbol.examples) { oSymbol.examples.forEach((oExample) => { oExample.data = formatters.formatExample(oExample.caption, oExample.text); // Keep file size in check if (oExample.caption) { delete oExample.caption; } if (oExample.text) { delete oExample.text; } }); } if (oSymbol.references) { formatters.modifyReferences(oSymbol); formatters.formatReferencesInDescription(oSymbol); } // Description if (oSymbol.description) { oSymbol.description = formatters.formatDescription(oSymbol.description); } } }); oChainObject.parsedData = oData; return oChainObject; }; function getDependencyLibraryFilesList(oChainObject) { // if vDependencyAPIFiles is an array, it contains the file paths of api.json files if ( Array.isArray(vDependencyAPIFiles) ) { return oChainObject; } // otherwise, it names a directory that has to be scanned for the files return new Promise(oResolve => { fs.readdir(vDependencyAPIFiles, function (oError, aItems) { if (!oError && aItems && aItems.length) { let aFiles = []; aItems.forEach(sItem => { aFiles.push(path.join(vDependencyAPIFiles, sItem)); }) oChainObject.aDependentLibraryFiles = aFiles; } oResolve(oChainObject); // We don't fail if no dependency library files are available }); }); } function loadDependencyLibraryFiles (oChainObject) { if (!oChainObject.aDependentLibraryFiles) { return oChainObject; } let aPromises = []; oChainObject.aDependentLibraryFiles.forEach(sFile => { aPromises.push(new Promise(oResolve => { fs.readFile(sFile, 'utf8', (oError, oData) => { oResolve(oError ? false : oData); }); })); }); return Promise.all(aPromises).then(aValues => { let oDependentAPIs = {}; aValues.forEach(sData => { let oData; try { oData = JSON.parse(sData); } catch (e) { // Silence possible dependency library invalid json errors as they are not critical // and we should not fail BCP: 1870560058 } // OpenUI5 build specific - own library can be listed as dependency library also. // In this case we don't add it to the dependency list to skip double iteration. if (oData && oChainObject.fileData.library !== oData.library) { oDependentAPIs[oData.library] = oData.symbols; } }); oChainObject.oDependentAPIs = oDependentAPIs; return oChainObject; }) } /** * Create api.json from parsed data * @param oChainObject chain object */ function createApiRefApiJson(oChainObject) { if (returnOutputFiles) { // If requested, return data instead of writing to FS (required by UI5 Tooling/UI5 Builder) return JSON.stringify(oChainObject.parsedData); } let sOutputDir = path.dirname(oChainObject.outputFile); // Create dir if it does not exist if (!fs.existsSync(sOutputDir)) { fs.mkdirSync(sOutputDir); } // Write result to file fs.writeFileSync(oChainObject.outputFile, JSON.stringify(oChainObject.parsedData) /* Transform back to string */, 'utf8'); } /** * Load .library file * @param oChainObject chain return object * @returns {Promise} library file promise */ function getLibraryPromise(oChainObject) { return new Promise(function(oResolve) { fs.readFile(oChainObject.libraryFile, 'utf8', (oError, oData) => { oChainObject.libraryFileData = oData; oResolve(oChainObject); }); }); } /** * Extracts components list and docuindex.json relative path from .library file data * @param {object} oChainObject chain object * @returns {object} chain object */ function extractComponentAndDocuindexUrl(oChainObject) { oChainObject.modules = []; if (oChainObject.libraryFileData) { let $ = cheerio.load(oChainObject.libraryFileData, { ignoreWhitespace: true, xmlMode: true, lowerCaseTags: false }); // Extract documentation URL oChainObject.docuPath = $("appData documentation").attr("indexUrl"); // Extract components $("ownership > component").each((i, oComponent) => { if (oComponent.children) { if (oComponent.children.length === 1) { oChainObject.defaultComponent = $(oComponent).text(); } else { let sCurrentComponentName = $(oComponent).find("name").text(); let aCurrentModules = []; $(oComponent).find("module").each((a, oC) => { aCurrentModules.push($(oC).text().replace(/\//g, ".")); }); oChainObject.modules.push({ componentName: sCurrentComponentName, modules: aCurrentModules }); } } }); } return oChainObject; } /** * Adds to the passed object custom symbol component map generated from the extracted components list * to be easily searchable later * @param {object} oChainObject chain object * @returns {object} chain object */ function flattenComponents(oChainObject) { if (oChainObject.modules && oChainObject.modules.length > 0) { oChainObject.customSymbolComponents = {}; oChainObject.modules.forEach(oComponent => { let sCurrentComponent = oComponent.componentName; oComponent.modules.forEach(sModule => { oChainObject.customSymbolComponents[sModule] = sCurrentComponent; }); }); } return oChainObject; } /** * Adds to the passed object array with entities which have explored samples * @param {object} oChainObject chain object * @returns {object} chain object */ function extractSamplesFromDocuIndex(oChainObject) { // If we have not extracted docuPath we return early if (!oChainObject.docuPath) { return oChainObject; } return new Promise(function(oResolve) { // Join .library path with relative docuindex.json path let sPath = path.join(path.dirname(oChainObject.libraryFile), oChainObject.docuPath); // Normalize path to resolve relative path sPath = path.normalize(sPath); fs.readFile(sPath, 'utf8', (oError, oFileData) => { if (!oError) { oFileData = JSON.parse(oFileData); if (oFileData.explored && oFileData.explored.entities && oFileData.explored.entities.length > 0) { oChainObject.entitiesWithSamples = []; oFileData.explored.entities.forEach(oEntity => { oChainObject.entitiesWithSamples.push(oEntity.id); }); } } // We aways resolve as this data is not mandatory oResolve(oChainObject); }); }); } /** * Load api.json file * @param {object} oChainObject chain object * @returns {object} chain object */ function getAPIJSONPromise(oChainObject) { return new Promise(function(oResolve, oReject) { fs.readFile(sInputFile, 'utf8', (oError, sFileData) => { if (oError) { oReject(oError); } else { oChainObject.fileData = JSON.parse(sFileData); oResolve(oChainObject); } }); }); } /* * ===================================================================================================================== * IMPORTANT NOTE: Formatter code is a copy from APIDetail.controller.js with a very little modification and mocking and * code can be significantly improved * ===================================================================================================================== */ let formatters = { _sTopicId: "", _oTopicData: {}, _baseTypes: [ "sap.ui.core.any", "sap.ui.core.object", "sap.ui.core.function", "sap.ui.core.number", // TODO discuss with Thomas, type does not exist "sap.ui.core.float", "sap.ui.core.int", "sap.ui.core.boolean", "sap.ui.core.string", "sap.ui.core.void", "null", "any", "any[]", "Error", "Error[]", "array", "element", "Element", "DomRef", "object", "Object", "object[]", "object|object[]", "[object Object][]", "Array.<[object Object]>", "Object.<string,string>", "function", "float", "int", "boolean", "string", "string[]", "number", "map", "promise", "Promise", "document", "Document", "Touch", "TouchList", "undefined" ], ANNOTATIONS_LINK: 'http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part3-csdl.html', ANNOTATIONS_NAMESPACE_LINK: 'http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/vocabularies/', /** * Adds "deprecated" information if such exists to the header area * @param deprecated - object containing information about deprecation * @returns {string} - the deprecated text to display */ formatSubtitle: function (deprecated) { var result = ""; if (deprecated) { result += "Deprecated in version: " + deprecated.since; } return result; }, /** * Formats the target and applies to texts of annotations * @param target - the array of texts to be formatted * @returns string - the formatted text */ formatAnnotationTarget: function (target) { var result = ""; if (target) { target.forEach(function (element) { result += element + '<br>'; }); } result = this._preProcessLinksInTextBlock(result); return result; }, /** * Formats the namespace of annotations * @param namespace - the namespace to be formatted * @returns string - the formatted text */ formatAnnotationNamespace: function (namespace) { var result, aNamespaceParts = namespace.split("."); if (aNamespaceParts[0] === "Org" && aNamespaceParts[1] === "OData") { result = '<a href="' + this.ANNOTATIONS_NAMESPACE_LINK + namespace + '.xml">' + namespace + '</a>'; } else { result = namespace; } result = this._preProcessLinksInTextBlock(result); return result; }, /** * Formats the description of annotations * @param description - the description of the annotation * @param since - the since version information of the annotation * @returns string - the formatted description */ formatAnnotationDescription: function (description, since) { var result = description || ""; result += '<br>For more information, see ' + this.handleExternalUrl(this.ANNOTATIONS_LINK, "OData v4 Annotations"); if (since) { result += '<br><br><i>Since: ' + since + '.</i>'; } result = this._preProcessLinksInTextBlock(result); return result; }, formatExceptionLink: function (linkText) { linkText = linkText || ''; return linkText.indexOf('sap.ui.') !== -1; }, formatMethodCode: function (sName, aParams, aReturnValue) { var result = '<pre class="prettyprint">' + sName + '('; if (aParams && aParams.length > 0) { /* We consider only root level parameters so we get rid of all that are not on the root level */ aParams = aParams.filter(oElem => { return oElem.depth === undefined; }); aParams.forEach(function (element, index, array) { result += element.name; if (element.optional) { result += '?'; } if (index < array.length - 1) { result += ', '; } }); } result += ') : '; if (aReturnValue) { result += aReturnValue.type; } else { result += 'void'; } result += "</pre>"; return result; }, /** * Formats method deprecation message and pre-process jsDoc link and code blocks * @param {string} sSince since text * @param {string} sDescription deprecation description text * @returns {string} formatted deprecation message */ formatMethodDeprecated: function (sSince, sDescription) { return this.formatDeprecated(sSince, sDescription, "methods"); }, /** * Formats event deprecation message and pre-process jsDoc link and code blocks * @param {string} sSince since text * @param {string} sDescription deprecation description text * @returns {string} formatted deprecation message */ formatEventDeprecated: function (sSince, sDescription) { return this.formatDeprecated(sSince, sDescription, "events"); }, /** * Formats the description of control properties * @param description - the description of the property * @param since - the since version information of the property * @returns string - the formatted description */ formatDescriptionSince: function (description, since) { var result = description || ""; if (since) { result += '<br><br><i>Since: ' + since + '.</i>'; } result = this._preProcessLinksInTextBlock(result); return result; }, /** * Formats the default value of the property as a string. * @param defaultValue - the default value of the property * @returns string - The default value of the property formatted as a string. */ formatDefaultValue: function (defaultValue) { var sReturn; switch (defaultValue) { case null: case undefined: sReturn = ''; break; case '': sReturn = 'empty string'; break; default: sReturn = defaultValue; } return Array.isArray(sReturn) ? sReturn.join(', ') : sReturn; }, /** * Formats the constructor of the class * @param name * @param params * @returns string - The code needed to create an object of that class */ formatConstructor: function (name, params) { var result = '<pre class="prettyprint">new '; if (name) { result += name + '('; } if (params) { params.forEach(function (element, index, array) { result += element.name; if (element.optional) { result += '?'; } if (index < array.length - 1) { result += ', '; } }); } if (name) { result += ')</pre>'; } return result; }, formatExample: function (sCaption, sText) { return this.formatDescription( ["<span><strong>Example: </strong>", sCaption, "<pre class='sapUiSmallMarginTop'>", sText, "</pre></span>"].join("") ); }, /** * Formats the name of a property or a method depending on if it's static or not * @param sName {string} - Name * @param sClassName {string} - Name of the class * @param bStatic {boolean} - If it's static * @returns {string} - Formatted name */ formatEntityName: function (sName, sClassName, bStatic) { return (bStatic === true) ? sClassName + "." + sName : sName; }, JSDocUtil: function () { var rEscapeRegExp = /[[\]{}()*+?.\\^$|]/g; // Local mocked methods var escapeRegExp = function escapeRegExp(sString) { return sString.replace(rEscapeRegExp, "\\$&"); }; function defaultLinkFormatter(target, text) { return "<code>" + (text || target) + "</code>"; } function format(src, options) { options = options || {}; var beforeParagraph = options.beforeParagraph === undefined ? '<p>' : options.beforeParagraph; var afterParagraph = options.afterParagraph === undefined ? '</p>' : options.afterParagraph; var beforeFirstParagraph = options.beforeFirstParagraph === undefined ? beforeParagraph : options.beforeFirstParagraph; var afterLastParagraph = options.afterLastParagraph === undefined ? afterParagraph : options.afterLastParagraph; var linkFormatter = typeof options.linkFormatter === 'function' ? options.linkFormatter : defaultLinkFormatter; /* * regexp to recognize important places in the text * * Capturing groups of the RegExp: * group 1: begin of a pre block * group 2: end of a pre block * group 3: begin of a header, implicitly ends a paragraph * group 4: end of a header, implicitly starts a new paragraph * group 5: target portion of an inline @link tag * group 6: (optional) text portion of an inline link tag * group 7: an empty line which implicitly starts a new paragraph * * [-- <pre> block -] [---- some header ----] [---- an inline [@link ...} tag ----] [---------- an empty line ---------] */ var r = /(<pre>)|(<\/pre>)|(<h[\d+]>)|(<\/h[\d+]>)|\{@link\s+([^}\s]+)(?:\s+([^\}]*))?\}|((?:\r\n|\r|\n)[ \t]*(?:\r\n|\r|\n))/gi; var inpre = false; src = src || ''; linkFormatter = linkFormatter || defaultLinkFormatter; src = beforeFirstParagraph + src.replace(r, function(match, pre, endpre, header, endheader, linkTarget, linkText, emptyline) { if ( pre ) { inpre = true; } else if ( endpre ) { inpre = false; } else if ( header ) { if ( !inpre ) { return afterParagraph + match; } } else if ( endheader ) { if ( !inpre ) { return match + beforeParagraph; } } else if ( emptyline ) { if ( !inpre ) { return afterParagraph + beforeParagraph; } } else if ( linkTarget ) { if ( !inpre ) { return linkFormatter(linkTarget, linkText); } } return match; }) + afterLastParagraph; // remove empty paragraphs if (beforeParagraph !== "" && afterParagraph !== "") { src = src.replace(new RegExp(escapeRegExp(beforeParagraph) + "\\s*" + escapeRegExp(afterParagraph), "g"), ""); } return src; } return { formatTextBlock: format }; }, handleExternalUrl: function (sTarget, sText) { // Check if the external domain is SAP hosted let bSAPHosted = /^https?:\/\/(?:www.)?[\w.]*(?:sap|hana\.ondemand|sapfioritrial)\.com/.test(sTarget); return `<a target="_blank" href="${sTarget}">${sText}</a> <img src="./resources/sap/ui/documentation/sdk/images/${bSAPHosted ? 'link-sap' : 'link-external'}.png" title="Information published on ${bSAPHosted ? '' : 'non '}SAP site" class="sapUISDKExternalLink"/>`; }, /** * Discover possible target type by looking at symbols from own and depending libraries * @param {string} target * @param {object} self * @param {object} ownLibrary * @param {object} dependencyLibs * @param {boolean} module * @returns {string} */ createLinkFromTargetType: function ({className, methodName, target, self, ownLibrary, dependencyLibs, text}) { let sResult; function searchInSymbol(oSymbol) { function findProperty(oEntity, sName, sTarget) { if (!oEntity || !oEntity.properties) { return; } return oEntity.properties.find(({name}) => name === sName || name === sTarget); } function findMethod(oEntity, sName, sTarget) { if (!oEntity || !oEntity.methods) { return; } return oEntity.methods.find(({name}) => name === sName || name === sTarget); } function findEvent(oEntity, sName) { if (!oEntity || !oEntity.events) { return; } return oEntity.events.find(({name}) => name === sName); } if (oSymbol.name === target) { sResult = this.createLink({ name: oSymbol.name, text: text }); return true; } if (oSymbol.name === className) { let oProperty = findProperty(oSymbol, methodName, target); if (oProperty) { sResult = this.createLink({ name: oProperty.name, text: text }); return true; } let oMethod = findMethod(oSymbol, methodName, target); if (oMethod) { sResult = this.createLink({ name: oMethod.static ? target : oMethod.name, type: "methods", text: text, className: className }); return true; } let oEvent = findEvent(oSymbol, methodName); if (oEvent) { sResult = this.createLink({ name: oEvent.name, type: "events", text: text, className: className }); return true; } } return false; } // Self link if (self.name === target) { return this.createLink({ name: target, text: text }); } // Own methods search if (self.name === className && self.methods) { let oResult = self.methods.find(({name}) => name === methodName); if (oResult) { return this.createLink({ name: oResult.static ? [self.name, oResult.name].join(".") : oResult.name, type: "methods", className: className, text: text, local: true }); } } // Local library symbols ownLibrary.symbols.find(oSymbol => { return searchInSymbol.call(this, oSymbol); }); if (sResult) return sResult; // Dependent library symbols dependencyLibs && Object.keys(dependencyLibs).find(sLib => { if (sLib === target) { sResult = this.createLink({ name: sLib, text: text }); return true; } return dependencyLibs[sLib].find(oSymbol => { return searchInSymbol.call(this, oSymbol); }); }); return sResult; }, /** * Creates a html link * @param {string} name * @param {string} type * @param {string} className * @param {string} [text=name] by default if no text is provided the name will be used * @param {boolean} [local=false] * @param {string} [hrefAppend=""] * @returns {string} link */ createLink: function ({name, type, className, text=name, local=false, hrefAppend=""}) { let sLink; // handling module's if (className !== undefined && (/^module:/.test(name) || /^module:/.test(className))) { name = name.replace(/^module:/, ""); } name = encodeURIComponent(name); className = encodeURIComponent(className); // Build the link sLink = type ? `${className}/${type}/${name}` : name; if (hrefAppend) { sLink += hrefAppend; } if (local) { return `<a target="_self" class="jsdoclink scrollTo${type === `events` ? `Event` : `Method`}" data-sap-ui-target="${name}" href="#/api/${sLink}">${text}</a>`; } return `<a target="_self" class="jsdoclink" href="#/api/${sLink}">${text}</a>`; }, /** * Pre-process links in text block * @param {string} sText text block * @param {boolean} bSkipParagraphs skip paragraphs * @returns {string} processed text block * @private */ _preProcessLinksInTextBlock: function (sText, bSkipParagraphs) { let oSelf = this._oTopicData, oOwnLibrary = this._oOwnLibrary, oDependencyLibs = oChainObject.oDependentAPIs, oOptions = { linkFormatter: function (sTarget, sText) { let aMatch, aTarget; // keep the full target in the fallback text sText = sText || sTarget; // If the link has a protocol, do not modify, but open in a new window if (/:\/\//.test(sTarget)) { return this.handleExternalUrl(sTarget, sText); } // topic:xxx Topic aMatch = sTarget.match(/^topic:(\w{32})$/); if (aMatch) { return '<a target="_self" href="#/topic/' + aMatch[1] + '">' + sText + '</a>'; } // sap.x.Xxx.prototype.xxx - In case of prototype we have a link to method aMatch = sTarget.match(/([a-zA-Z0-9.$_]+?)\.prototype\.([a-zA-Z0-9.$_]+)$/); if (aMatch) { return this.createLink({ name: aMatch[2], type: "methods", className: aMatch[1], text: sText }); } // Heuristics: Extend is always a static method // sap.x.Xxx.extend // module:sap/x/Xxx.extend aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+?)\.extend$/); if (aMatch) { let [, sModule, sClass] = aMatch; return this.createLink({ name: sTarget.replace(/^module:/, ""), type: "methods", className: (sModule ? sModule : "") + sClass, text: sText }); } // Constructor links are handled in special manner by the SDK // sap.x.Xxx.constructor // sap.x.Xxx#constructor // module:sap/x/Xxx.constructor // #constructor aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+?)?[\.#]constructor$/i); if (aMatch) { let [, sModule, sClass] = aMatch, sName; if (sClass) { sName = (sModule ? sModule : "") + sClass; } else { sName = oSelf.name } return this.createLink({ name: sName, hrefAppend: "/constructor", text: sText }); } // #.setText - local static method // #setText - local instance method // #.setText.from - local nested method aMatch = sTarget.match(/^#(\.)?([a-zA-Z0-9.$_]+)$/); if (aMatch) { return this.createLink({ name: aMatch[1] ? `${oSelf.name}.${aMatch[2]}` : aMatch[2], type: "methods", className: oSelf.name, local: true, text: sText }); } // #event:press - local event aMatch = sTarget.match(/^#event:([a-zA-Z0-9$_]+)$/); if (aMatch) { return this.createLink({ name: aMatch[1], type: "events", className: oSelf.name, local: true, text: sText }); } // Event links // sap.m.Button#event:press // sap.m.Button.event:press // module:sap/m/Button.event:press // module:sap/m/Button#event:press aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+?)[.#]event:([a-zA-Z0-9$_]+)$/); if (aMatch) { let [, sModule, sClass, sEvent] = aMatch; return this.createLink({ name: sEvent, type: "events", className: (sModule ? sModule : "") + sClass, text: sText }); } // sap.m.Button#setText - instance method // module:sap/m/Button#setText aMatch = sTarget.match(/^(module:)?([a-zA-Z0-9.$_\/]+)#([a-zA-Z0-9.$_]+)$/); if (aMatch) { let [, sModule, sClass, sMethod] = aMatch; return this.createLink({ name: sMethod, type: "methods", className: (sModule ? sModule : "") + sClass, text: sText }); } // Unresolved type - try to discover target type // sap.x.Xxx.xxx // module:sap/x/Xxx.xxx if (/^(?:module:)?([a-zA-Z0-9.$_\/]+?)\.([a-zA-Z0-9$_]+)$/.test(sTarget)) { let [,sClass, sName] = sTarget.match(/^((?:module:)?[a-zA-Z0-9.$_\/]+?)\.([a-zA-Z0-9$_]+)$/), sResult = this.createLinkFromTargetType({ className: sClass, methodName: sName, target: sTarget, self: oSelf, ownLibrary: oOwnLibrary, dependencyLibs: oDependencyLibs, text: sText }); if (sResult) { return sResult; } } // Possible nested functions discovery - currently we do this only for regular symbols aTarget = sTarget.split("."); if (aTarget.length >= 3) { let sResult = this.createLinkFromTargetType({ methodName: aTarget.splice(-2).join("."), className: aTarget.join("."), target: sTarget, self: oSelf, ownLibrary: oOwnLibrary, dependencyLibs: oDependencyLibs, text: sText }); if (sResult) { return sResult; } } // Possible forward reference - we will treat them as symbol link return this.createLink({ name: sTarget, text: sText }); }.bind(this) }; if (bSkipParagraphs) { oOptions.beforeParagraph = ""; oOptions.afterParagraph = ""; } return this.JSDocUtil().formatTextBlock(sText, oOptions); }, /** * Formatter for Overview section * @param {string} sDescription - Class about description * @param {array} aReferences - References * @returns {string} - formatted text block */ formatOverviewDescription: function (sDescription, aReferences) { var iLen, i; // format references if (aReferences && aReferences.length > 0) { sDescription += "<br><br><span>Documentation links:</span><ul>"; iLen = aReferences.length; for (i = 0; i < iLen; i++) { // We treat references as links but as they may not be defined as such we enforce it if needed if (/{@link.*}/.test(aReferences[i])) { sDescription += "<li>" + aReferences[i] + "</li>"; } else { sDescription += "<li>{@link " + aReferences[i] + "}</li>"; } } sDescription += "</ul>"; } // Calling formatDescription so it could handle further formatting return this.formatDescription(sDescription); }, /** * Formats the description of the property * @param description - the description of the property * @param deprecatedText - the text explaining this property is deprecated * @param deprecatedSince - the version when this property was deprecated * @returns string - the formatted description */ formatDescription: function (description, deprecatedText, deprecatedSince) { if (!description && !deprecatedText && !deprecatedSince) { return ""; } var result = description || ""; if (deprecatedSince || deprecatedText) { // Note: sapUiDocumentationDeprecated - transformed to sapUiDeprecated to keep json file size low result += "<span class=\"sapUiDeprecated\"><br>"; result += this.formatDeprecated(deprecatedSince, deprecatedText); result += "</span>"; } result = this._preProcessLinksInTextBlock(result); return result; }, /** * Formats the entity deprecation message and pre-process jsDoc link and code blocks * @param {string} sSince since text * @param {string} sDescription deprecation description text * @param {string} sEntityType string representation of entity type * @returns {string} formatted deprecation message */ formatDeprecated: function (sSince, sDescription, sEntityType) { var aResult; // Build deprecation message // Note: there may be no since or no description text available aResult = ["Deprecated"]; if (sSince) { aResult.push(" as of version " + sSince); } if (sDescription) { // Evaluate code blocks - Handle <code>...</code> pattern sDescription = sDescription.replace(/<code>(\S+)<\/code>/gi, function (sMatch, sCodeEntity) { return ['<em>', sCodeEntity, '</em>'].join(""); } ); // Evaluate links in the deprecation description aResult.push(". " + this._preProcessLinksInTextBlock(sDescription, true)); } return aResult.join(""); }, /** * Pre-process and modify references * @param {object} oSymbol control data object which will be modified * @private */ modifyReferences: function (oSymbol, bCalledOnConstructor) { var bHeaderDocuLinkFound = false, bUXGuidelinesLinkFound = false, aReferences = [], entity = bCalledOnConstructor? oSymbol.constructor.references : oSymbol.references; const UX_GUIDELINES_BASE_URL = "https://experience.sap.com/fiori-design-web/"; if (entity && entity.length > 0) { entity.forEach(function (sReference) { var aParts; // Docu link - For the header we take into account only the first link that matches one of the patterns if (!bHeaderDocuLinkFound) { // Handled patterns: // * topic:59a0e11712e84a648bb990a1dba76bc7 // * {@link topic:59a0e11712e84a648bb990a1dba76bc7} // * {@link topic:59a0e11712e84a648bb990a1dba76bc7 Link text} aParts = sReference.match(/^{@link\s+topic:(\w{32})(\s.+)?}$|^topic:(\w{32})$/); if (aParts) { if (aParts[3]) { // Link is of type topic:GUID oSymbol.docuLink = aParts[3]; oSymbol.docuLinkText = oSymbol.basename; } else if (aParts[1]) { // Link of type {@link topic:GUID} or {@link topic:GUID Link text} oSymbol.docuLink = aParts[1]; oSymbol.docuLinkText = aParts[2] ? aParts[2] : oSymbol.basename; } bHeaderDocuLinkFound = true; return; } } // Fiori link - Handled patterns: // * fiori:flexible-column-layout // * fiori:/flexible-column-layout/ // * fiori:https://experience.sap.com/fiori-design-web/flexible-column-layout/ // * {@link fiori:flexible-column-layout} // * {@link fiori:/flexible-column-layout/} // * {@link fiori:/flexible-column-layout/ Flexible Column Layout} // * {@link fiori:https://experience.sap.com/fiori-design-web/flexible-column-layout/} // * {@link fiori:https://experience.sap.com/fiori-design-web/flexible-column-layout/ Flexible Column Layout} aParts = sReference.match(/^(?:{@link\s)?fiori:(?:https:\/\/experience\.sap\.com\/fiori-design-web\/)?\/?(\S+\b)\/?\s?(.*[^\s}])?}?$/); if (aParts) { let [, sTarget, sTargetName] = aParts; if (bCalledOnConstructor && !bUXGuidelinesLinkFound) { // Extract first found UX Guidelines link as primary oSymbol.uxGuidelinesLink = UX_GUIDELINES_BASE_URL + sTarget; oSymbol.uxGuidelinesLinkText = sTargetName ? sTargetName : oSymbol.basename; bUXGuidelinesLinkFound = true; return; } else { // BCP: 1870155880 - Every consecutive "fiori:" link should be handled as a normal link sReference = "{@link " + UX_GUIDELINES_BASE_URL + sTarget + (sTargetName ? " " + sTargetName : "") + "}"; } } aReferences.push(sReference); }); bCalledOnConstructor? oSymbol.constructor.references = aReferences : oSymbol.references = aReferences; } else { bCalledOnConstructor? oSymbol.constructor.references = [] : oSymbol.references = []; } }, /** * Manage References, to apply as an unordered list in the description * @param {object} oEntity control data object which will be modified * @private */ formatReferencesInDescription: function(oEntity) { if (oEntity.references && Array.isArray(oEntity.references)) { oEntity.references = oEntity.references.map(sReference => { return `<li>${sReference}</li>`; }); if (!oEntity.description) { // If there is no method description - references should be the first line of it oEntity.description = ''; } else { oEntity.description += '<br><br>'; } oEntity.description += `References: <ul>${oEntity.references.join("")}</ul>`; } } }; /* Methods direct copy from API Detail */ let methods = { /** * Adjusts methods info so that it can be easily displayed in a table * @param aMethods - the methods array initially coming from the server */ buildMethodsModel: function (aMethods) { var fnCreateTypesArr = function (sTypes) { return sTypes.split("|").map(function (sType) { return {value: sType} }); }; var fnExtractParameterProperties = function (oParameter, aParameters, iDepth, aPhoneName) { if (oParameter.parameterProperties) { Object.keys(oParameter.parameterProperties).forEach(function (sProperty) { var oProperty = oParameter.parameterProperties[sProperty]; oProperty.depth = iDepth; // Handle types if (oProperty.type) { oProperty.types = fnCreateTypesArr(oProperty.type); } // Phone name - available only for parameters oProperty.phoneName = [aPhoneName.join("."), oProperty.name].join("."); // Add property to parameter array as we need a simple structure aParameters.push(oProperty); // Handle child parameterProperties fnExtractParameterProperties(oProperty, aParameters, (iDepth + 1), aPhoneName.concat([oProperty.name])); // Keep file size in check delete oProperty.type; }); // Keep file size in check delete oParameter.parameterProperties; } }; aMethods.forEach(function (oMethod) { // New array to hold modified parameters var aParameters = []; // Handle parameters if (oMethod.parameters) { oMethod.parameters.forEach(function (oParameter) { if (oParameter.type) { oParameter.types = fnCreateTypesArr(oParameter.type); } // Keep file size in check delete oParameter.type; // Add the parameter before the properties aParameters.push(oParameter); // Handle Parameter Properties // Note: We flatten the structure fnExtractParameterProperties(oParameter, aParameters, 1, [oParameter.name]); }); // Override the old data oMethod.parameters = aParameters; } // Handle return values if (oMethod.returnValue && oMethod.returnValue.type) { // Handle types oMethod.returnValue.types = fnCreateTypesArr(oMethod.returnValue.type); } }); }, /** * Adjusts events info so that it can be easily displayed in a table * @param {Array} aEvents - the events array initially coming from the server */ buildEventsModel: function (aEvents) { var fnExtractParameterProperties = function (oParameter, aParameters, iDepth, aPhoneName) { if (oParameter.parameterProperties) { Object.keys(oParameter.parameterProperties).forEach(function (sProperty) { var oProperty = oParameter.parameterProperties[sProperty], sPhoneTypeSuffix; oProperty.depth = iDepth; // Phone name - available only for parameters sPhoneTypeSuffix = oProperty.type === "array" ? "[]" : ""; oProperty.phoneName = [aPhoneName.join("."), (oProperty.name + sPhoneTypeSuffix)].join("."); // Add property to parameter array as we need a simple structure aParameters.push(oProperty); // Handle child parameterProperties fnExtractParameterProperties(oProperty, aParameters, (iDepth + 1), aPhoneName.concat([oProperty.name + sPhoneTypeSuffix])); }); // Keep file size in check delete oParameter.parameterProperties; } }; aEvents.forEach(function (aEvents) { // New array to hold modified parameters var aParameters = []; // Handle parameters if (aEvents.parameters) { aEvents.parameters.forEach(function (oParameter) { // Add the parameter before the properties aParameters.push(oParameter); // Handle Parameter Properties // Note: We flatten the structure fnExtractParameterProperties(oParameter, aParameters, 1, [oParameter.name]); }); // Override the old data aEvents.parameters = aParameters; } }); }, /** * Adjusts constructor parameters info so that it can be easily displayed in a table * @param {Array} aParameters - the events array initially coming from the server */ buildConstructorParameters: function (aParameters) { // New array to hold modified parameters var aNodes = [], processNode = function (oNode, sPhoneName, iDepth, aNodes) { // Handle phone name oNode.phoneName = sPhoneName ? [sPhoneName, oNode.name].join(".") : oNode.name; // Depth oNode.depth = iDepth; // Add to array aNodes.push(oNode); // Handle nesting if (oNode.parameterProperties) { Object.keys(oNode.parameterProperties).forEach(function (sNode) { processNode(oNode.parameterProperties[sNode], oNode.phoneName, (iDepth + 1), aNodes); }); } delete oNode.parameterProperties; }; aParameters.forEach(function (oParameter) { // Handle Parameter Properties // Note: We flatten the structure processNode(oParameter, undefined, 0, aNodes); }); return aNodes; }, oLibsData: {}, }; // Create the chain object let oChainObject = { inputFile: sInputFile, outputFile: sOutputFile, libraryFile: sLibraryFile, aDependentLibraryFiles: Array.isArray(vDependencyAPIFiles) ? vDependencyAPIFiles : null }; // Start the work here let p = getLibraryPromise(oChainObject) .then(extractComponentAndDocuindexUrl) .then(flattenComponents) .then(extractSamplesFromDocuIndex) .then(getDependencyLibraryFilesList) .then(getAPIJSONPromise) .then(loadDependencyLibraryFiles) .then(transformApiJson) .then(createApiRefApiJson); return p; }
[ "function", "transformer", "(", "sInputFile", ",", "sOutputFile", ",", "sLibraryFile", ",", "vDependencyAPIFiles", ",", "options", ")", "{", "const", "fs", "=", "options", "&&", "options", ".", "fs", "||", "require", "(", "\"fs\"", ")", ";", "const", "return...
/* Transforms the api.json as created by the JSDoc build into a pre-processed api.json file suitable for the SDK. The pre-processing includes formatting of type references, rewriting of links and other time consuming calculations. @param {string} sInputFile Path of the original api.json file that should be transformed @param {string} sOutputFile Path that the transformed api.json file should should be written to @param {string} sLibraryFile Path to the .library file of the library, used to extract further documentation information @param {string|string[]} vDependencyAPIFiles Path of folder that contains api.json files of predecessor libs or an array of paths of those files @returns {Promise} A Promise that resolves after the transformation has been completed
[ "/", "*", "Transforms", "the", "api", ".", "json", "as", "created", "by", "the", "JSDoc", "build", "into", "a", "pre", "-", "processed", "api", ".", "json", "file", "suitable", "for", "the", "SDK", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L40-L1977
train
Transforms the api. json file for sap. ui. documentation.
[ 30522, 3853, 10938, 2121, 1006, 8254, 18780, 8873, 2571, 1010, 2061, 4904, 18780, 8873, 2571, 1010, 22889, 12322, 19848, 2100, 8873, 2571, 1010, 1058, 3207, 11837, 4181, 5666, 9331, 10128, 9463, 2015, 1010, 7047, 1007, 1063, 9530, 3367, 104...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Tools.controller.js
function () { BaseController.prototype.onInit.call(this); // manually call the handler once at startup as device API won't do this for us this._onOrientationChange({ landscape: Device.orientation.landscape }); this.getRouter().getRoute("tools").attachPatternMatched(this._onMatched, this); }
javascript
function () { BaseController.prototype.onInit.call(this); // manually call the handler once at startup as device API won't do this for us this._onOrientationChange({ landscape: Device.orientation.landscape }); this.getRouter().getRoute("tools").attachPatternMatched(this._onMatched, this); }
[ "function", "(", ")", "{", "BaseController", ".", "prototype", ".", "onInit", ".", "call", "(", "this", ")", ";", "// manually call the handler once at startup as device API won't do this for us", "this", ".", "_onOrientationChange", "(", "{", "landscape", ":", "Device"...
/* =========================================================== /* lifecycle methods /* =========================================================== Called when the controller is instantiated. @public
[ "/", "*", "===========================================================", "/", "*", "lifecycle", "methods", "/", "*", "===========================================================", "Called", "when", "the", "controller", "is", "instantiated", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Tools.controller.js#L23-L32
train
This controller is called when the device is initialized
[ 30522, 3853, 1006, 1007, 1063, 2918, 8663, 13181, 10820, 1012, 8773, 1012, 2006, 5498, 2102, 1012, 2655, 1006, 2023, 1007, 1025, 1013, 1013, 21118, 2655, 1996, 28213, 2320, 2012, 22752, 2004, 5080, 17928, 2180, 1005, 1056, 2079, 2023, 2005,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
moment/luxon
src/interval.js
validateStartEnd
function validateStartEnd(start, end) { if (!start || !start.isValid) { return new Invalid("missing or invalid start"); } else if (!end || !end.isValid) { return new Invalid("missing or invalid end"); } else if (end < start) { return new Invalid( "end before start", `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}` ); } else { return null; } }
javascript
function validateStartEnd(start, end) { if (!start || !start.isValid) { return new Invalid("missing or invalid start"); } else if (!end || !end.isValid) { return new Invalid("missing or invalid end"); } else if (end < start) { return new Invalid( "end before start", `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}` ); } else { return null; } }
[ "function", "validateStartEnd", "(", "start", ",", "end", ")", "{", "if", "(", "!", "start", "||", "!", "start", ".", "isValid", ")", "{", "return", "new", "Invalid", "(", "\"missing or invalid start\"", ")", ";", "}", "else", "if", "(", "!", "end", "|...
checks if the start is equal to or before the end
[ "checks", "if", "the", "start", "is", "equal", "to", "or", "before", "the", "end" ]
236f2badea297ee73421aa39a83e06177c1be6d0
https://github.com/moment/luxon/blob/236f2badea297ee73421aa39a83e06177c1be6d0/src/interval.js#L10-L23
train
Validate start and end
[ 30522, 3853, 9398, 8520, 7559, 6528, 2094, 1006, 2707, 1010, 2203, 1007, 1063, 2065, 1006, 999, 2707, 1064, 1064, 999, 2707, 1012, 2003, 10175, 3593, 1007, 1063, 2709, 2047, 19528, 1006, 1000, 4394, 2030, 19528, 2707, 1000, 1007, 1025, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/dom-utils.js
DOMWalker_getNode
function DOMWalker_getNode(idSet) { var doc = this._controller.window.document; // QuerySelector seems to be unusuale for id's in this case: // https://developer.mozilla.org/En/Code_snippets/QuerySelector switch (idSet.getBy) { case DOMWalker.GET_BY_ID: return doc.getElementById(idSet[idSet.getBy]); case DOMWalker.GET_BY_SELECTOR: return doc.querySelector(idSet[idSet.getBy]); default: throw new Error("Not supported getBy-attribute: " + idSet.getBy); } }
javascript
function DOMWalker_getNode(idSet) { var doc = this._controller.window.document; // QuerySelector seems to be unusuale for id's in this case: // https://developer.mozilla.org/En/Code_snippets/QuerySelector switch (idSet.getBy) { case DOMWalker.GET_BY_ID: return doc.getElementById(idSet[idSet.getBy]); case DOMWalker.GET_BY_SELECTOR: return doc.querySelector(idSet[idSet.getBy]); default: throw new Error("Not supported getBy-attribute: " + idSet.getBy); } }
[ "function", "DOMWalker_getNode", "(", "idSet", ")", "{", "var", "doc", "=", "this", ".", "_controller", ".", "window", ".", "document", ";", "// QuerySelector seems to be unusuale for id's in this case:", "// https://developer.mozilla.org/En/Code_snippets/QuerySelector", "switc...
Retrieves and returns a wanted node based on the provided identification set. @param {array of objects} idSet Contains informations on the elements to open while Object-elements: getBy - attribute-name of the attribute containing the identification information for the opener-element subContent - array of ids of the opener-elements in the window with the value of the above getBy-attribute target - information, where the new elements will be opened [1|2|4] title - title of the opened dialog/window waitFunction - The function used as an argument for MozmillController.waitFor to wait before starting the walk. [optional - default: no waiting] windowHandler - Window instance [only needed for some tests] @returns Node @type {Node}
[ "Retrieves", "and", "returns", "a", "wanted", "node", "based", "on", "the", "provided", "identification", "set", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/dom-utils.js#L213-L226
train
Get node from idSet
[ 30522, 3853, 14383, 26965, 1035, 2131, 3630, 3207, 1006, 8909, 13462, 1007, 1063, 13075, 9986, 1027, 2023, 1012, 1035, 11486, 1012, 3332, 1012, 6254, 1025, 1013, 1013, 23032, 11246, 22471, 2953, 3849, 2000, 2022, 5866, 2063, 2005, 8909, 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...
adobe/brackets
src/language/CodeInspection.js
updateListeners
function updateListeners() { if (_enabled) { // register our event listeners MainViewManager .on("currentFileChange.codeInspection", function () { run(); }); DocumentManager .on("currentDocumentLanguageChanged.codeInspection", function () { run(); }) .on("documentSaved.codeInspection documentRefreshed.codeInspection", function (event, document) { if (document === DocumentManager.getCurrentDocument()) { run(); } }); } else { DocumentManager.off(".codeInspection"); MainViewManager.off(".codeInspection"); } }
javascript
function updateListeners() { if (_enabled) { // register our event listeners MainViewManager .on("currentFileChange.codeInspection", function () { run(); }); DocumentManager .on("currentDocumentLanguageChanged.codeInspection", function () { run(); }) .on("documentSaved.codeInspection documentRefreshed.codeInspection", function (event, document) { if (document === DocumentManager.getCurrentDocument()) { run(); } }); } else { DocumentManager.off(".codeInspection"); MainViewManager.off(".codeInspection"); } }
[ "function", "updateListeners", "(", ")", "{", "if", "(", "_enabled", ")", "{", "// register our event listeners", "MainViewManager", ".", "on", "(", "\"currentFileChange.codeInspection\"", ",", "function", "(", ")", "{", "run", "(", ")", ";", "}", ")", ";", "D...
Update DocumentManager listeners.
[ "Update", "DocumentManager", "listeners", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/CodeInspection.js#L533-L553
train
updateListeners - update listeners
[ 30522, 3853, 10651, 9863, 24454, 2015, 1006, 1007, 1063, 2065, 1006, 1035, 9124, 1007, 1063, 1013, 1013, 4236, 2256, 2724, 13810, 2364, 8584, 24805, 4590, 1012, 2006, 1006, 1000, 2783, 8873, 2571, 22305, 2063, 1012, 3642, 7076, 5051, 7542, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Entity.controller.js
function () { this.router = this.getRouter(); this.router.getRoute("entity").attachPatternMatched(this.onRouteMatched, this); this._oObjectPage = this.byId("ObjectPageLayout"); this.getView().setModel(new JSONModel()); }
javascript
function () { this.router = this.getRouter(); this.router.getRoute("entity").attachPatternMatched(this.onRouteMatched, this); this._oObjectPage = this.byId("ObjectPageLayout"); this.getView().setModel(new JSONModel()); }
[ "function", "(", ")", "{", "this", ".", "router", "=", "this", ".", "getRouter", "(", ")", ";", "this", ".", "router", ".", "getRoute", "(", "\"entity\"", ")", ".", "attachPatternMatched", "(", "this", ".", "onRouteMatched", ",", "this", ")", ";", "thi...
/* =========================================================== /* lifecycle methods /* ===========================================================
[ "/", "*", "===========================================================", "/", "*", "lifecycle", "methods", "/", "*", "===========================================================" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/Entity.controller.js#L29-L37
train
Initializes the layout and the model
[ 30522, 3853, 1006, 1007, 1063, 2023, 1012, 2799, 2099, 1027, 2023, 1012, 2131, 22494, 3334, 1006, 1007, 1025, 2023, 1012, 2799, 2099, 1012, 2131, 22494, 2618, 1006, 1000, 9178, 1000, 1007, 1012, 22476, 4502, 12079, 2078, 18900, 7690, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/JavaScriptRefactoring/WrapSelection.js
createGettersAndSetters
function createGettersAndSetters() { var editor = EditorManager.getActiveEditor(); if (!editor) { return; } initializeRefactoringSession(editor); var startIndex = current.startIndex, endIndex = current.endIndex, selectedText = current.selectedText; if (selectedText.length >= 1) { var selectionDetails = RefactoringUtils.normalizeText(selectedText, startIndex, endIndex); selectedText = selectionDetails.text; startIndex = selectionDetails.start; endIndex = selectionDetails.end; } var token = TokenUtils.getTokenAt(current.cm, current.cm.posFromIndex(endIndex)), commaString = ",", isLastNode, templateParams, parentNode, propertyEndPos; //Create getters and setters only if selected reference is a property if (token.type !== "property") { current.editor.displayErrorMessageAtCursor(Strings.ERROR_GETTERS_SETTERS); return; } parentNode = current.getParentNode(current.ast, endIndex); // Check if selected propery is child of a object expression if (!parentNode || !parentNode.properties) { current.editor.displayErrorMessageAtCursor(Strings.ERROR_GETTERS_SETTERS); return; } var propertyNodeArray = parentNode.properties; // Find the last Propery Node before endIndex var properyNodeIndex = propertyNodeArray.findIndex(function (element) { return (endIndex >= element.start && endIndex < element.end); }); var propertyNode = propertyNodeArray[properyNodeIndex]; //Get Current Selected Property End Index; propertyEndPos = editor.posFromIndex(propertyNode.end); //We have to add ',' so we need to find position of current property selected isLastNode = current.isLastNodeInScope(current.ast, endIndex); var nextPropertNode, nextPropertyStartPos; if(!isLastNode && properyNodeIndex + 1 <= propertyNodeArray.length - 1) { nextPropertNode = propertyNodeArray[properyNodeIndex + 1]; nextPropertyStartPos = editor.posFromIndex(nextPropertNode.start); if(propertyEndPos.line !== nextPropertyStartPos.line) { propertyEndPos = current.lineEndPosition(current.startPos.line); } else { propertyEndPos = nextPropertyStartPos; commaString = ", "; } } var getSetPos; if (isLastNode) { getSetPos = current.document.adjustPosForChange(propertyEndPos, commaString.split("\n"), propertyEndPos, propertyEndPos); } else { getSetPos = propertyEndPos; } templateParams = { "getName": token.string, "setName": token.string, "tokenName": token.string }; // Replace, setSelection, IndentLine // We need to call batchOperation as indentLine don't have option to add origin as like replaceRange current.document.batchOperation(function() { if (isLastNode) { //Add ',' in the end of current line current.document.replaceRange(commaString, propertyEndPos, propertyEndPos); } current.editor.setSelection(getSetPos); //Selection on line end // Add getters and setters for given token using template at current cursor position current.replaceTextFromTemplate(GETTERS_SETTERS, templateParams); if (!isLastNode) { // Add ',' at the end setter current.document.replaceRange(commaString, current.editor.getSelection().start, current.editor.getSelection().start); } }); }
javascript
function createGettersAndSetters() { var editor = EditorManager.getActiveEditor(); if (!editor) { return; } initializeRefactoringSession(editor); var startIndex = current.startIndex, endIndex = current.endIndex, selectedText = current.selectedText; if (selectedText.length >= 1) { var selectionDetails = RefactoringUtils.normalizeText(selectedText, startIndex, endIndex); selectedText = selectionDetails.text; startIndex = selectionDetails.start; endIndex = selectionDetails.end; } var token = TokenUtils.getTokenAt(current.cm, current.cm.posFromIndex(endIndex)), commaString = ",", isLastNode, templateParams, parentNode, propertyEndPos; //Create getters and setters only if selected reference is a property if (token.type !== "property") { current.editor.displayErrorMessageAtCursor(Strings.ERROR_GETTERS_SETTERS); return; } parentNode = current.getParentNode(current.ast, endIndex); // Check if selected propery is child of a object expression if (!parentNode || !parentNode.properties) { current.editor.displayErrorMessageAtCursor(Strings.ERROR_GETTERS_SETTERS); return; } var propertyNodeArray = parentNode.properties; // Find the last Propery Node before endIndex var properyNodeIndex = propertyNodeArray.findIndex(function (element) { return (endIndex >= element.start && endIndex < element.end); }); var propertyNode = propertyNodeArray[properyNodeIndex]; //Get Current Selected Property End Index; propertyEndPos = editor.posFromIndex(propertyNode.end); //We have to add ',' so we need to find position of current property selected isLastNode = current.isLastNodeInScope(current.ast, endIndex); var nextPropertNode, nextPropertyStartPos; if(!isLastNode && properyNodeIndex + 1 <= propertyNodeArray.length - 1) { nextPropertNode = propertyNodeArray[properyNodeIndex + 1]; nextPropertyStartPos = editor.posFromIndex(nextPropertNode.start); if(propertyEndPos.line !== nextPropertyStartPos.line) { propertyEndPos = current.lineEndPosition(current.startPos.line); } else { propertyEndPos = nextPropertyStartPos; commaString = ", "; } } var getSetPos; if (isLastNode) { getSetPos = current.document.adjustPosForChange(propertyEndPos, commaString.split("\n"), propertyEndPos, propertyEndPos); } else { getSetPos = propertyEndPos; } templateParams = { "getName": token.string, "setName": token.string, "tokenName": token.string }; // Replace, setSelection, IndentLine // We need to call batchOperation as indentLine don't have option to add origin as like replaceRange current.document.batchOperation(function() { if (isLastNode) { //Add ',' in the end of current line current.document.replaceRange(commaString, propertyEndPos, propertyEndPos); } current.editor.setSelection(getSetPos); //Selection on line end // Add getters and setters for given token using template at current cursor position current.replaceTextFromTemplate(GETTERS_SETTERS, templateParams); if (!isLastNode) { // Add ',' at the end setter current.document.replaceRange(commaString, current.editor.getSelection().start, current.editor.getSelection().start); } }); }
[ "function", "createGettersAndSetters", "(", ")", "{", "var", "editor", "=", "EditorManager", ".", "getActiveEditor", "(", ")", ";", "if", "(", "!", "editor", ")", "{", "return", ";", "}", "initializeRefactoringSession", "(", "editor", ")", ";", "var", "start...
Create gtteres and setters for a property
[ "Create", "gtteres", "and", "setters", "for", "a", "property" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/JavaScriptRefactoring/WrapSelection.js#L230-L327
train
Create getters and setters
[ 30522, 3853, 3443, 18150, 7747, 29560, 7585, 2869, 1006, 1007, 1063, 13075, 3559, 1027, 3559, 24805, 4590, 1012, 2131, 19620, 2098, 15660, 1006, 1007, 1025, 2065, 1006, 999, 3559, 1007, 1063, 2709, 1025, 1065, 3988, 17629, 12879, 18908, 287...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/document/DocumentManager.js
notifyPathNameChanged
function notifyPathNameChanged(oldName, newName) { // Notify all open documents _.forEach(_openDocuments, function (doc) { // TODO: Only notify affected documents? For now _notifyFilePathChange // just updates the language if the extension changed, so it's fine // to call for all open docs. doc._notifyFilePathChanged(); }); // Send a "fileNameChange" event. This will trigger the views to update. exports.trigger("fileNameChange", oldName, newName); }
javascript
function notifyPathNameChanged(oldName, newName) { // Notify all open documents _.forEach(_openDocuments, function (doc) { // TODO: Only notify affected documents? For now _notifyFilePathChange // just updates the language if the extension changed, so it's fine // to call for all open docs. doc._notifyFilePathChanged(); }); // Send a "fileNameChange" event. This will trigger the views to update. exports.trigger("fileNameChange", oldName, newName); }
[ "function", "notifyPathNameChanged", "(", "oldName", ",", "newName", ")", "{", "// Notify all open documents", "_", ".", "forEach", "(", "_openDocuments", ",", "function", "(", "doc", ")", "{", "// TODO: Only notify affected documents? For now _notifyFilePathChange", "// ju...
Called after a file or folder name has changed. This function is responsible for updating underlying model data and notifying all views of the change. @param {string} oldName The old name of the file/folder @param {string} newName The new name of the file/folder
[ "Called", "after", "a", "file", "or", "folder", "name", "has", "changed", ".", "This", "function", "is", "responsible", "for", "updating", "underlying", "model", "data", "and", "notifying", "all", "views", "of", "the", "change", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentManager.js#L531-L542
train
Notify all open documents that the file path has changed.
[ 30522, 3853, 2025, 8757, 15069, 18442, 22305, 2098, 1006, 2214, 18442, 1010, 2047, 18442, 1007, 1063, 1013, 1013, 2025, 8757, 2035, 2330, 5491, 1035, 1012, 18921, 6776, 1006, 1035, 2330, 3527, 24894, 11187, 1010, 3853, 1006, 9986, 1007, 106...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ColorlibHQ/AdminLTE
bower_components/jquery-sparkline/src/chart-bar.js
function (valuenum, highlight) { var vals = this.values[valuenum], options = this.options, xaxisOffset = this.xaxisOffset, result = [], range = this.range, stacked = this.stacked, target = this.target, x = valuenum * this.totalBarWidth, canvasHeightEf = this.canvasHeightEf, yoffset = this.yoffset, y, height, color, isNull, yoffsetNeg, i, valcount, val, minPlotted, allMin; vals = $.isArray(vals) ? vals : [vals]; valcount = vals.length; val = vals[0]; isNull = all(null, vals); allMin = all(xaxisOffset, vals, true); if (isNull) { if (options.get('nullColor')) { color = highlight ? options.get('nullColor') : this.calcHighlightColor(options.get('nullColor'), options); y = (yoffset > 0) ? yoffset - 1 : yoffset; return target.drawRect(x, y, this.barWidth - 1, 0, color, color); } else { return undefined; } } yoffsetNeg = yoffset; for (i = 0; i < valcount; i++) { val = vals[i]; if (stacked && val === xaxisOffset) { if (!allMin || minPlotted) { continue; } minPlotted = true; } if (range > 0) { height = Math.floor(canvasHeightEf * ((Math.abs(val - xaxisOffset) / range))) + 1; } else { height = 1; } if (val < xaxisOffset || (val === xaxisOffset && yoffset === 0)) { y = yoffsetNeg; yoffsetNeg += height; } else { y = yoffset - height; yoffset -= height; } color = this.calcColor(i, val, valuenum); if (highlight) { color = this.calcHighlightColor(color, options); } result.push(target.drawRect(x, y, this.barWidth - 1, height - 1, color, color)); } if (result.length === 1) { return result[0]; } return result; }
javascript
function (valuenum, highlight) { var vals = this.values[valuenum], options = this.options, xaxisOffset = this.xaxisOffset, result = [], range = this.range, stacked = this.stacked, target = this.target, x = valuenum * this.totalBarWidth, canvasHeightEf = this.canvasHeightEf, yoffset = this.yoffset, y, height, color, isNull, yoffsetNeg, i, valcount, val, minPlotted, allMin; vals = $.isArray(vals) ? vals : [vals]; valcount = vals.length; val = vals[0]; isNull = all(null, vals); allMin = all(xaxisOffset, vals, true); if (isNull) { if (options.get('nullColor')) { color = highlight ? options.get('nullColor') : this.calcHighlightColor(options.get('nullColor'), options); y = (yoffset > 0) ? yoffset - 1 : yoffset; return target.drawRect(x, y, this.barWidth - 1, 0, color, color); } else { return undefined; } } yoffsetNeg = yoffset; for (i = 0; i < valcount; i++) { val = vals[i]; if (stacked && val === xaxisOffset) { if (!allMin || minPlotted) { continue; } minPlotted = true; } if (range > 0) { height = Math.floor(canvasHeightEf * ((Math.abs(val - xaxisOffset) / range))) + 1; } else { height = 1; } if (val < xaxisOffset || (val === xaxisOffset && yoffset === 0)) { y = yoffsetNeg; yoffsetNeg += height; } else { y = yoffset - height; yoffset -= height; } color = this.calcColor(i, val, valuenum); if (highlight) { color = this.calcHighlightColor(color, options); } result.push(target.drawRect(x, y, this.barWidth - 1, height - 1, color, color)); } if (result.length === 1) { return result[0]; } return result; }
[ "function", "(", "valuenum", ",", "highlight", ")", "{", "var", "vals", "=", "this", ".", "values", "[", "valuenum", "]", ",", "options", "=", "this", ".", "options", ",", "xaxisOffset", "=", "this", ".", "xaxisOffset", ",", "result", "=", "[", "]", ...
Render bar(s) for a region
[ "Render", "bar", "(", "s", ")", "for", "a", "region" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jquery-sparkline/src/chart-bar.js#L193-L254
train
draws a single value
[ 30522, 3853, 1006, 3643, 19172, 1010, 12944, 1007, 1063, 13075, 11748, 2015, 1027, 2023, 30524, 1060, 8528, 19565, 21807, 3388, 1027, 2023, 1012, 1060, 8528, 19565, 21807, 3388, 1010, 2765, 1027, 1031, 1033, 1010, 2846, 1027, 2023, 1012, 28...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laurent22/joplin
Clipper/joplin-webclipper/content_scripts/JSDOMParser.js
function (node) { var name = ""; var n = this.html.indexOf("=", this.currentChar); if (n === -1) { this.currentChar = this.html.length; } else { // Read until a '=' character is hit; this will be the attribute key name = this.html.substring(this.currentChar, n); this.currentChar = n + 1; } if (!name) return; // After a '=', we should see a '"' for the attribute value var c = this.nextChar(); if (c !== '"' && c !== "'") { this.error("Error reading attribute " + name + ", expecting '\"'"); return; } // Read the attribute value (and consume the matching quote) var value = this.readString(c); node.attributes.push(new Attribute(name, value)); return; }
javascript
function (node) { var name = ""; var n = this.html.indexOf("=", this.currentChar); if (n === -1) { this.currentChar = this.html.length; } else { // Read until a '=' character is hit; this will be the attribute key name = this.html.substring(this.currentChar, n); this.currentChar = n + 1; } if (!name) return; // After a '=', we should see a '"' for the attribute value var c = this.nextChar(); if (c !== '"' && c !== "'") { this.error("Error reading attribute " + name + ", expecting '\"'"); return; } // Read the attribute value (and consume the matching quote) var value = this.readString(c); node.attributes.push(new Attribute(name, value)); return; }
[ "function", "(", "node", ")", "{", "var", "name", "=", "\"\"", ";", "var", "n", "=", "this", ".", "html", ".", "indexOf", "(", "\"=\"", ",", "this", ".", "currentChar", ")", ";", "if", "(", "n", "===", "-", "1", ")", "{", "this", ".", "currentC...
Called when parsing a node. This finds the next name/value attribute pair and adds the result to the attributes list.
[ "Called", "when", "parsing", "a", "node", ".", "This", "finds", "the", "next", "name", "/", "value", "attribute", "pair", "and", "adds", "the", "result", "to", "the", "attributes", "list", "." ]
beb428b246cecba4630a3ca57b472f43c0933a43
https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/Clipper/joplin-webclipper/content_scripts/JSDOMParser.js#L903-L931
train
Read an attribute
[ 30522, 3853, 1006, 13045, 1007, 1063, 13075, 2171, 1027, 1000, 1000, 1025, 13075, 1050, 1027, 2023, 1012, 16129, 1012, 5950, 11253, 1006, 1000, 1027, 1000, 1010, 2023, 1012, 2783, 7507, 2099, 1007, 1025, 2065, 1006, 1050, 1027, 1027, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GitbookIO/gitbook
lib/output/website/copyPluginAssets.js
copyAssets
function copyAssets(output, plugin) { var logger = output.getLogger(); var pluginRoot = plugin.getPath(); var options = output.getOptions(); var outputRoot = options.get('root'); var assetOutputFolder = path.join(outputRoot, 'gitbook'); var prefix = options.get('prefix'); var assetFolder = path.join(pluginRoot, ASSET_FOLDER, prefix); if (!fs.existsSync(assetFolder)) { return Promise(); } logger.debug.ln('copy assets from theme', assetFolder); return fs.copyDir( assetFolder, assetOutputFolder, { deleteFirst: false, overwrite: true, confirm: true } ); }
javascript
function copyAssets(output, plugin) { var logger = output.getLogger(); var pluginRoot = plugin.getPath(); var options = output.getOptions(); var outputRoot = options.get('root'); var assetOutputFolder = path.join(outputRoot, 'gitbook'); var prefix = options.get('prefix'); var assetFolder = path.join(pluginRoot, ASSET_FOLDER, prefix); if (!fs.existsSync(assetFolder)) { return Promise(); } logger.debug.ln('copy assets from theme', assetFolder); return fs.copyDir( assetFolder, assetOutputFolder, { deleteFirst: false, overwrite: true, confirm: true } ); }
[ "function", "copyAssets", "(", "output", ",", "plugin", ")", "{", "var", "logger", "=", "output", ".", "getLogger", "(", ")", ";", "var", "pluginRoot", "=", "plugin", ".", "getPath", "(", ")", ";", "var", "options", "=", "output", ".", "getOptions", "(...
Copy assets from a plugin @param {Plugin} @return {Promise}
[ "Copy", "assets", "from", "a", "plugin" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/output/website/copyPluginAssets.js#L45-L70
train
Copy assets from the plugin to the output folder
[ 30522, 3853, 6100, 27241, 3215, 1006, 6434, 1010, 13354, 2378, 1007, 1063, 13075, 8833, 4590, 1027, 6434, 1012, 2131, 21197, 4590, 1006, 1007, 1025, 13075, 13354, 2378, 3217, 4140, 1027, 13354, 2378, 1012, 2131, 15069, 1006, 1007, 1025, 130...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/dom/uri.js
normalizeUri
function normalizeUri(uri) { const anchor = createElement(TagName.A); // This is safe even though the URL might be untrustworthy. // The SafeURL is only used to set the href of an HTMLAnchorElement // that is never added to the DOM. Therefore, the user cannot navigate // to this URL. const safeUrl = uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract( Const.from('This URL is never added to the DOM'), uri); setAnchorHref(anchor, safeUrl); return anchor.href; }
javascript
function normalizeUri(uri) { const anchor = createElement(TagName.A); // This is safe even though the URL might be untrustworthy. // The SafeURL is only used to set the href of an HTMLAnchorElement // that is never added to the DOM. Therefore, the user cannot navigate // to this URL. const safeUrl = uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract( Const.from('This URL is never added to the DOM'), uri); setAnchorHref(anchor, safeUrl); return anchor.href; }
[ "function", "normalizeUri", "(", "uri", ")", "{", "const", "anchor", "=", "createElement", "(", "TagName", ".", "A", ")", ";", "// This is safe even though the URL might be untrustworthy.", "// The SafeURL is only used to set the href of an HTMLAnchorElement", "// that is never a...
Normalizes a URL by assigning it to an anchor element and reading back href. This converts relative URLs to absolute, and cleans up whitespace. @param {string} uri A string containing a URI. @return {string} Normalized, absolute form of uri.
[ "Normalizes", "a", "URL", "by", "assigning", "it", "to", "an", "anchor", "element", "and", "reading", "back", "href", "." ]
97390e9ca4483cebb9628e06026139fbb3023d65
https://github.com/google/closure-library/blob/97390e9ca4483cebb9628e06026139fbb3023d65/closure/goog/dom/uri.js#L30-L41
train
Normalize a URI.
[ 30522, 3853, 3671, 4697, 9496, 1006, 24471, 2072, 1007, 1063, 9530, 3367, 8133, 1027, 3443, 12260, 3672, 1006, 6415, 18442, 1012, 1037, 1007, 1025, 1013, 1013, 2023, 2003, 3647, 2130, 2295, 1996, 24471, 2140, 2453, 2022, 4895, 24669, 13966,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
TryGhost/Ghost
core/server/data/importer/index.js
function (file) { var self = this; return this.extractZip(file.path).then(function (zipDirectory) { var ops = [], importData = {}, baseDir; self.isValidZip(zipDirectory); baseDir = self.getBaseDirectory(zipDirectory); _.each(self.handlers, function (handler) { if (importData.hasOwnProperty(handler.type)) { // This limitation is here to reduce the complexity of the importer for now return Promise.reject(new common.errors.UnsupportedMediaTypeError({ message: common.i18n.t('errors.data.importer.index.zipContainsMultipleDataFormats') })); } var files = self.getFilesFromZip(handler, zipDirectory); if (files.length > 0) { ops.push(function () { return handler.loadFile(files, baseDir).then(function (data) { importData[handler.type] = data; }); }); } }); if (ops.length === 0) { return Promise.reject(new common.errors.UnsupportedMediaTypeError({ message: common.i18n.t('errors.data.importer.index.noContentToImport') })); } return sequence(ops).then(function () { return importData; }); }); }
javascript
function (file) { var self = this; return this.extractZip(file.path).then(function (zipDirectory) { var ops = [], importData = {}, baseDir; self.isValidZip(zipDirectory); baseDir = self.getBaseDirectory(zipDirectory); _.each(self.handlers, function (handler) { if (importData.hasOwnProperty(handler.type)) { // This limitation is here to reduce the complexity of the importer for now return Promise.reject(new common.errors.UnsupportedMediaTypeError({ message: common.i18n.t('errors.data.importer.index.zipContainsMultipleDataFormats') })); } var files = self.getFilesFromZip(handler, zipDirectory); if (files.length > 0) { ops.push(function () { return handler.loadFile(files, baseDir).then(function (data) { importData[handler.type] = data; }); }); } }); if (ops.length === 0) { return Promise.reject(new common.errors.UnsupportedMediaTypeError({ message: common.i18n.t('errors.data.importer.index.noContentToImport') })); } return sequence(ops).then(function () { return importData; }); }); }
[ "function", "(", "file", ")", "{", "var", "self", "=", "this", ";", "return", "this", ".", "extractZip", "(", "file", ".", "path", ")", ".", "then", "(", "function", "(", "zipDirectory", ")", "{", "var", "ops", "=", "[", "]", ",", "importData", "="...
Process Zip Takes a reference to a zip file, extracts it, sends any relevant files from inside to the right handler, and returns an object in the importData format: {data: {}, images: []} The data key contains JSON representing any data that should be imported The image key contains references to images that will be stored (and where they will be stored) @param {File} file @returns {Promise(ImportData)}
[ "Process", "Zip", "Takes", "a", "reference", "to", "a", "zip", "file", "extracts", "it", "sends", "any", "relevant", "files", "from", "inside", "to", "the", "right", "handler", "and", "returns", "an", "object", "in", "the", "importData", "format", ":", "{"...
bb7bb55cf3e60af99ebbc56099928827b58461bc
https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/data/importer/index.js#L226-L266
train
Load a file from a zip
[ 30522, 3853, 1006, 5371, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 2709, 2023, 1012, 14817, 5831, 2361, 1006, 5371, 1012, 4130, 1007, 1012, 2059, 1006, 3853, 1006, 14101, 4305, 2890, 16761, 2100, 1007, 1063, 13075, 23092, 1027, 1031, 1033,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/tooltip/tooltip.js
MdTooltipRegistry
function MdTooltipRegistry() { var listeners = {}; var ngWindow = angular.element(window); return { register: register, deregister: deregister }; /** * Global event handler that dispatches the registered handlers in the * service. * @param {!Event} event Event object passed in by the browser */ function globalEventHandler(event) { if (listeners[event.type]) { listeners[event.type].forEach(function(currentHandler) { currentHandler.call(this, event); }, this); } } /** * Registers a new handler with the service. * @param {string} type Type of event to be registered. * @param {!Function} handler Event handler. * @param {boolean} useCapture Whether to use event capturing. */ function register(type, handler, useCapture) { var handlers = listeners[type] = listeners[type] || []; if (!handlers.length) { useCapture ? window.addEventListener(type, globalEventHandler, true) : ngWindow.on(type, globalEventHandler); } if (handlers.indexOf(handler) === -1) { handlers.push(handler); } } /** * Removes an event handler from the service. * @param {string} type Type of event handler. * @param {!Function} handler The event handler itself. * @param {boolean} useCapture Whether the event handler used event capturing. */ function deregister(type, handler, useCapture) { var handlers = listeners[type]; var index = handlers ? handlers.indexOf(handler) : -1; if (index > -1) { handlers.splice(index, 1); if (handlers.length === 0) { useCapture ? window.removeEventListener(type, globalEventHandler, true) : ngWindow.off(type, globalEventHandler); } } } }
javascript
function MdTooltipRegistry() { var listeners = {}; var ngWindow = angular.element(window); return { register: register, deregister: deregister }; /** * Global event handler that dispatches the registered handlers in the * service. * @param {!Event} event Event object passed in by the browser */ function globalEventHandler(event) { if (listeners[event.type]) { listeners[event.type].forEach(function(currentHandler) { currentHandler.call(this, event); }, this); } } /** * Registers a new handler with the service. * @param {string} type Type of event to be registered. * @param {!Function} handler Event handler. * @param {boolean} useCapture Whether to use event capturing. */ function register(type, handler, useCapture) { var handlers = listeners[type] = listeners[type] || []; if (!handlers.length) { useCapture ? window.addEventListener(type, globalEventHandler, true) : ngWindow.on(type, globalEventHandler); } if (handlers.indexOf(handler) === -1) { handlers.push(handler); } } /** * Removes an event handler from the service. * @param {string} type Type of event handler. * @param {!Function} handler The event handler itself. * @param {boolean} useCapture Whether the event handler used event capturing. */ function deregister(type, handler, useCapture) { var handlers = listeners[type]; var index = handlers ? handlers.indexOf(handler) : -1; if (index > -1) { handlers.splice(index, 1); if (handlers.length === 0) { useCapture ? window.removeEventListener(type, globalEventHandler, true) : ngWindow.off(type, globalEventHandler); } } } }
[ "function", "MdTooltipRegistry", "(", ")", "{", "var", "listeners", "=", "{", "}", ";", "var", "ngWindow", "=", "angular", ".", "element", "(", "window", ")", ";", "return", "{", "register", ":", "register", ",", "deregister", ":", "deregister", "}", ";"...
Service that is used to reduce the amount of listeners that are being registered on the `window` by the tooltip component. Works by collecting the individual event handlers and dispatching them from a global handler. @ngInject
[ "Service", "that", "is", "used", "to", "reduce", "the", "amount", "of", "listeners", "that", "are", "being", "registered", "on", "the", "window", "by", "the", "tooltip", "component", ".", "Works", "by", "collecting", "the", "individual", "event", "handlers", ...
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tooltip/tooltip.js#L423-L483
train
The tooltip registry.
[ 30522, 3853, 9108, 3406, 27914, 11514, 2890, 24063, 2854, 1006, 1007, 1063, 13075, 13810, 1027, 1063, 1065, 1025, 13075, 12835, 11101, 5004, 1027, 16108, 1012, 5783, 1006, 3332, 1007, 1025, 2709, 1063, 4236, 1024, 4236, 1010, 4315, 13910, 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...
expressjs/express
lib/response.js
stringify
function stringify (value, replacer, spaces, escape) { // v8 checks arguments.length for optimizing simple call // https://bugs.chromium.org/p/v8/issues/detail?id=4730 var json = replacer || spaces ? JSON.stringify(value, replacer, spaces) : JSON.stringify(value); if (escape) { json = json.replace(/[<>&]/g, function (c) { switch (c.charCodeAt(0)) { case 0x3c: return '\\u003c' case 0x3e: return '\\u003e' case 0x26: return '\\u0026' default: return c } }) } return json }
javascript
function stringify (value, replacer, spaces, escape) { // v8 checks arguments.length for optimizing simple call // https://bugs.chromium.org/p/v8/issues/detail?id=4730 var json = replacer || spaces ? JSON.stringify(value, replacer, spaces) : JSON.stringify(value); if (escape) { json = json.replace(/[<>&]/g, function (c) { switch (c.charCodeAt(0)) { case 0x3c: return '\\u003c' case 0x3e: return '\\u003e' case 0x26: return '\\u0026' default: return c } }) } return json }
[ "function", "stringify", "(", "value", ",", "replacer", ",", "spaces", ",", "escape", ")", "{", "// v8 checks arguments.length for optimizing simple call", "// https://bugs.chromium.org/p/v8/issues/detail?id=4730", "var", "json", "=", "replacer", "||", "spaces", "?", "JSON"...
Stringify JSON, like JSON.stringify, but v8 optimized, with the ability to escape characters that can trigger HTML sniffing. @param {*} value @param {function} replaces @param {number} spaces @param {boolean} escape @returns {string} @private
[ "Stringify", "JSON", "like", "JSON", ".", "stringify", "but", "v8", "optimized", "with", "the", "ability", "to", "escape", "characters", "that", "can", "trigger", "HTML", "sniffing", "." ]
dc538f6e810bd462c98ee7e6aae24c64d4b1da93
https://github.com/expressjs/express/blob/dc538f6e810bd462c98ee7e6aae24c64d4b1da93/lib/response.js#L1114-L1137
train
Stringify value
[ 30522, 3853, 5164, 8757, 1006, 3643, 1010, 5672, 2099, 1010, 7258, 1010, 4019, 1007, 1063, 1013, 1013, 15754, 30524, 1029, 8909, 1027, 4700, 14142, 13075, 1046, 3385, 1027, 5672, 2099, 1064, 1064, 7258, 1029, 1046, 3385, 1012, 5164, 8757, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aws/aws-sdk-js
lib/publisher/configuration.js
resolveMonitoringConfig
function resolveMonitoringConfig() { var config = { port: undefined, clientId: undefined, enabled: undefined, }; if (fromEnvironment(config) || fromConfigFile(config)) return toJSType(config); return toJSType(config); }
javascript
function resolveMonitoringConfig() { var config = { port: undefined, clientId: undefined, enabled: undefined, }; if (fromEnvironment(config) || fromConfigFile(config)) return toJSType(config); return toJSType(config); }
[ "function", "resolveMonitoringConfig", "(", ")", "{", "var", "config", "=", "{", "port", ":", "undefined", ",", "clientId", ":", "undefined", ",", "enabled", ":", "undefined", ",", "}", ";", "if", "(", "fromEnvironment", "(", "config", ")", "||", "fromConf...
Resolve client-side monitoring configuration from either environmental variables or shared config file. Configurations from environmental variables have higher priority than those from shared config file. The resolver will try to read the shared config file no matter whether the AWS_SDK_LOAD_CONFIG variable is set. @api private
[ "Resolve", "client", "-", "side", "monitoring", "configuration", "from", "either", "environmental", "variables", "or", "shared", "config", "file", ".", "Configurations", "from", "environmental", "variables", "have", "higher", "priority", "than", "those", "from", "sh...
c23e5f0edd150f8885267e5f7c8a564f8e6e8562
https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/publisher/configuration.js#L10-L18
train
Resolves the monitoring configuration from the environment or the config file.
[ 30522, 3853, 10663, 8202, 15660, 2075, 8663, 8873, 2290, 1006, 1007, 1063, 13075, 9530, 8873, 2290, 1027, 1063, 3417, 1024, 6151, 28344, 1010, 7396, 3593, 1024, 6151, 28344, 1010, 9124, 1024, 6151, 28344, 1010, 1065, 1025, 2065, 1006, 2013,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
moleculerjs/moleculer
src/serializers/proto/packets.proto.js
PacketDisconnect
function PacketDisconnect(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; }
javascript
function PacketDisconnect(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; }
[ "function", "PacketDisconnect", "(", "properties", ")", "{", "if", "(", "properties", ")", "for", "(", "var", "keys", "=", "Object", ".", "keys", "(", "properties", ")", ",", "i", "=", "0", ";", "i", "<", "keys", ".", "length", ";", "++", "i", ")",...
Properties of a PacketDisconnect. @memberof packets @interface IPacketDisconnect @property {string} ver PacketDisconnect ver @property {string} sender PacketDisconnect sender Constructs a new PacketDisconnect. @memberof packets @classdesc Represents a PacketDisconnect. @implements IPacketDisconnect @constructor @param {packets.IPacketDisconnect=} [properties] Properties to set
[ "Properties", "of", "a", "PacketDisconnect", "." ]
f95aadc2d61b0d0e3c643a43c3ed28bca6425cde
https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/src/serializers/proto/packets.proto.js#L1952-L1957
train
Properties of a PacketDisconnect.
[ 30522, 3853, 14771, 10521, 8663, 2638, 6593, 1006, 5144, 1007, 1063, 2065, 1006, 5144, 1007, 2005, 1006, 13075, 6309, 1027, 4874, 1012, 6309, 1006, 5144, 1007, 1010, 1045, 1027, 1014, 1025, 1045, 1026, 6309, 1012, 3091, 1025, 1009, 1009, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
twbs/bootstrap
dist/js/bootstrap.esm.js
getUID
function getUID(prefix) { do { // eslint-disable-next-line no-bitwise prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here } while (document.getElementById(prefix)); return prefix; }
javascript
function getUID(prefix) { do { // eslint-disable-next-line no-bitwise prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here } while (document.getElementById(prefix)); return prefix; }
[ "function", "getUID", "(", "prefix", ")", "{", "do", "{", "// eslint-disable-next-line no-bitwise", "prefix", "+=", "~", "~", "(", "Math", ".", "random", "(", ")", "*", "MAX_UID", ")", ";", "// \"~~\" acts like a faster Math.floor() here", "}", "while", "(", "do...
-------------------------------------------------------------------------- Public Util Api --------------------------------------------------------------------------
[ "--------------------------------------------------------------------------", "Public", "Util", "Api", "--------------------------------------------------------------------------" ]
d806e874b4b9c4a3bb2d0715415aebbad78466a2
https://github.com/twbs/bootstrap/blob/d806e874b4b9c4a3bb2d0715415aebbad78466a2/dist/js/bootstrap.esm.js#L86-L93
train
Returns a unique ID
[ 30522, 3853, 2131, 21272, 1006, 17576, 1007, 1063, 2079, 1063, 1013, 1013, 9686, 4115, 2102, 1011, 4487, 19150, 1011, 2279, 1011, 2240, 2053, 1011, 2978, 14244, 17576, 1009, 1027, 1066, 1066, 1006, 8785, 1012, 6721, 1006, 1007, 1008, 4098, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...