repo
stringclasses
192 values
path
stringlengths
4
115
func_name
stringlengths
0
45
original_string
stringlengths
74
24k
language
stringclasses
1 value
code
stringlengths
74
24k
code_tokens
listlengths
23
4.2k
docstring
stringlengths
2
23.7k
docstring_tokens
listlengths
1
810
sha
stringclasses
192 values
url
stringlengths
90
200
partition
stringclasses
1 value
summary
stringlengths
6
313
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
uber/deck.gl
modules/core/src/utils/old-log.js
time
function time(priority, label) { assert(Number.isFinite(priority), 'log priority must be a number'); if (priority <= log.priority) { // In case the platform doesn't have console.time if (console.time) { console.time(label); } else { console.info(label); } } }
javascript
function time(priority, label) { assert(Number.isFinite(priority), 'log priority must be a number'); if (priority <= log.priority) { // In case the platform doesn't have console.time if (console.time) { console.time(label); } else { console.info(label); } } }
[ "function", "time", "(", "priority", ",", "label", ")", "{", "assert", "(", "Number", ".", "isFinite", "(", "priority", ")", ",", "'log priority must be a number'", ")", ";", "if", "(", "priority", "<=", "log", ".", "priority", ")", "{", "// In case the plat...
Logs a message with a time
[ "Logs", "a", "message", "with", "a", "time" ]
a2010448b7f268bbd03617b812334c68a6b9e5b2
https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/core/src/utils/old-log.js#L71-L81
train
Log time
[ 30522, 3853, 2051, 1006, 9470, 1010, 3830, 1007, 1063, 20865, 1006, 2193, 1012, 2003, 16294, 4221, 1006, 9470, 1007, 1010, 1005, 8833, 9470, 2442, 2022, 1037, 2193, 1005, 1007, 1025, 2065, 1006, 9470, 1026, 1027, 8833, 1012, 9470, 1007, 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...
summernote/summernote
src/js/base/core/dom.js
fromOffsetPath
function fromOffsetPath(ancestor, offsets) { let current = ancestor; for (let i = 0, len = offsets.length; i < len; i++) { if (current.childNodes.length <= offsets[i]) { current = current.childNodes[current.childNodes.length - 1]; } else { current = current.childNodes[offsets[i]]; } } return current; }
javascript
function fromOffsetPath(ancestor, offsets) { let current = ancestor; for (let i = 0, len = offsets.length; i < len; i++) { if (current.childNodes.length <= offsets[i]) { current = current.childNodes[current.childNodes.length - 1]; } else { current = current.childNodes[offsets[i]]; } } return current; }
[ "function", "fromOffsetPath", "(", "ancestor", ",", "offsets", ")", "{", "let", "current", "=", "ancestor", ";", "for", "(", "let", "i", "=", "0", ",", "len", "=", "offsets", ".", "length", ";", "i", "<", "len", ";", "i", "++", ")", "{", "if", "(...
@method fromOffsetPath return element from offsetPath(array of offset) @param {Node} ancestor - ancestor node @param {array} offsets - offsetPath
[ "@method", "fromOffsetPath" ]
8dcafb8107453006b905ef697a529c42e76beb3f
https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/dom.js#L715-L725
train
Returns the nearest ancestor node that is at the given offset path.
[ 30522, 3853, 2013, 27475, 3388, 15069, 1006, 13032, 1010, 16396, 2015, 1007, 1063, 2292, 2783, 1027, 13032, 1025, 2005, 1006, 2292, 1045, 1027, 1014, 1010, 18798, 1027, 16396, 2015, 1012, 3091, 1025, 1045, 1026, 18798, 1025, 1045, 1009, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Cache.js
onCancel
function onCancel() { _Helper.removeByPath(that.mPatchRequests, sFullPath, oPatchPromise); // write the previous value into the cache _Helper.updateExisting(that.mChangeListeners, sEntityPath, oEntity, Cache.makeUpdateData(aPropertyPath, vOldValue)); }
javascript
function onCancel() { _Helper.removeByPath(that.mPatchRequests, sFullPath, oPatchPromise); // write the previous value into the cache _Helper.updateExisting(that.mChangeListeners, sEntityPath, oEntity, Cache.makeUpdateData(aPropertyPath, vOldValue)); }
[ "function", "onCancel", "(", ")", "{", "_Helper", ".", "removeByPath", "(", "that", ".", "mPatchRequests", ",", "sFullPath", ",", "oPatchPromise", ")", ";", "// write the previous value into the cache", "_Helper", ".", "updateExisting", "(", "that", ".", "mChangeLis...
/* Synchronous callback to cancel the PATCH request so that it is really gone when resetChangesForPath has been called on the binding or model.
[ "/", "*", "Synchronous", "callback", "to", "cancel", "the", "PATCH", "request", "so", "that", "it", "is", "really", "gone", "when", "resetChangesForPath", "has", "been", "called", "on", "the", "binding", "or", "model", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Cache.js#L860-L865
train
Cancels the current patch request
[ 30522, 3853, 2006, 9336, 29109, 1006, 1007, 1063, 1035, 2393, 2121, 1012, 6366, 3762, 15069, 1006, 2008, 1012, 6131, 4017, 2818, 2890, 15500, 2015, 1010, 16420, 18083, 15069, 1010, 6728, 4017, 2818, 21572, 28732, 1007, 1025, 1013, 1013, 433...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
moleculerjs/moleculer
src/middlewares/circuit-breaker.js
getEpState
function getEpState(ep, opts) { let item = store.get(ep.name); if (!item) { item = { ep, opts, count: 0, failures: 0, state: C.CIRCUIT_CLOSE, cbTimer: null }; store.set(ep.name, item); } return item; }
javascript
function getEpState(ep, opts) { let item = store.get(ep.name); if (!item) { item = { ep, opts, count: 0, failures: 0, state: C.CIRCUIT_CLOSE, cbTimer: null }; store.set(ep.name, item); } return item; }
[ "function", "getEpState", "(", "ep", ",", "opts", ")", "{", "let", "item", "=", "store", ".", "get", "(", "ep", ".", "name", ")", ";", "if", "(", "!", "item", ")", "{", "item", "=", "{", "ep", ",", "opts", ",", "count", ":", "0", ",", "failur...
Get Endpoint state from store. If not exists, create it. @param {Endpoint} ep @param {Object} opts @returns {Object}
[ "Get", "Endpoint", "state", "from", "store", ".", "If", "not", "exists", "create", "it", "." ]
f95aadc2d61b0d0e3c643a43c3ed28bca6425cde
https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/src/middlewares/circuit-breaker.js#L57-L71
train
Get the state of an endpoint
[ 30522, 3853, 2131, 13699, 9153, 2618, 1006, 4958, 1010, 23569, 2015, 1007, 1063, 2292, 8875, 1027, 3573, 1012, 2131, 1006, 4958, 1012, 2171, 1007, 1025, 2065, 1006, 999, 8875, 1007, 1063, 8875, 1027, 1063, 4958, 1010, 23569, 2015, 1010, 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...
apache/incubator-echarts
src/coord/polar/Polar.js
function (point, clamp) { var coord = this.pointToCoord(point); return [ this._radiusAxis.radiusToData(coord[0], clamp), this._angleAxis.angleToData(coord[1], clamp) ]; }
javascript
function (point, clamp) { var coord = this.pointToCoord(point); return [ this._radiusAxis.radiusToData(coord[0], clamp), this._angleAxis.angleToData(coord[1], clamp) ]; }
[ "function", "(", "point", ",", "clamp", ")", "{", "var", "coord", "=", "this", ".", "pointToCoord", "(", "point", ")", ";", "return", "[", "this", ".", "_radiusAxis", ".", "radiusToData", "(", "coord", "[", "0", "]", ",", "clamp", ")", ",", "this", ...
Convert a (x, y) point to data @param {Array.<number>} point @param {boolean} [clamp=false] @return {Array.<number>}
[ "Convert", "a", "(", "x", "y", ")", "point", "to", "data" ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/polar/Polar.js#L203-L209
train
Returns the data for a point
[ 30522, 3853, 1006, 2391, 1010, 18856, 16613, 1007, 1063, 13075, 2522, 8551, 1027, 2023, 1012, 2391, 3406, 3597, 8551, 1006, 2391, 1007, 1025, 2709, 1031, 2023, 1012, 1035, 12177, 8528, 2483, 1012, 12177, 3406, 2850, 2696, 1006, 2522, 8551, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
build/js/DirectChat.js
Plugin
function Plugin(option) { return this.each(function () { var $this = $(this); var data = $this.data(DataKey); if (!data) { $this.data(DataKey, (data = new DirectChat($this))); } if (typeof option == 'string') data.toggle($this); }); }
javascript
function Plugin(option) { return this.each(function () { var $this = $(this); var data = $this.data(DataKey); if (!data) { $this.data(DataKey, (data = new DirectChat($this))); } if (typeof option == 'string') data.toggle($this); }); }
[ "function", "Plugin", "(", "option", ")", "{", "return", "this", ".", "each", "(", "function", "(", ")", "{", "var", "$this", "=", "$", "(", "this", ")", ";", "var", "data", "=", "$this", ".", "data", "(", "DataKey", ")", ";", "if", "(", "!", "...
Plugin Definition =================
[ "Plugin", "Definition", "=================" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/build/js/DirectChat.js#L34-L45
train
Plugin constructor.
[ 30522, 3853, 13354, 2378, 1006, 5724, 1007, 1063, 2709, 2023, 1012, 2169, 1006, 3853, 1006, 1007, 1063, 30524, 1006, 2951, 14839, 1010, 1006, 2951, 1027, 2047, 3622, 7507, 2102, 1006, 1002, 2023, 1007, 1007, 1007, 1025, 1065, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/LiveDevelopment/Agents/DOMAgent.js
_cleanURL
function _cleanURL(url) { var index = url.search(/[#\?]/); if (index >= 0) { url = url.substr(0, index); } return url; }
javascript
function _cleanURL(url) { var index = url.search(/[#\?]/); if (index >= 0) { url = url.substr(0, index); } return url; }
[ "function", "_cleanURL", "(", "url", ")", "{", "var", "index", "=", "url", ".", "search", "(", "/", "[#\\?]", "/", ")", ";", "if", "(", "index", ">=", "0", ")", "{", "url", "=", "url", ".", "substr", "(", "0", ",", "index", ")", ";", "}", "re...
Eliminate the query string from a URL @param {string} URL
[ "Eliminate", "the", "query", "string", "from", "a", "URL" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/DOMAgent.js#L123-L129
train
Remove the query string from the URL
[ 30522, 3853, 1035, 4550, 3126, 2140, 1006, 24471, 2140, 1007, 1063, 13075, 5950, 1027, 24471, 2140, 1012, 3945, 1006, 1013, 1031, 1001, 1032, 1029, 1033, 1013, 1007, 1025, 2065, 1006, 5950, 1028, 1027, 1014, 1007, 1063, 24471, 2140, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-echarts
src/chart/line/poly.js
drawNonMono
function drawNonMono( ctx, points, start, segLen, allLen, dir, smoothMin, smoothMax, smooth, smoothMonotone, connectNulls ) { var prevIdx = 0; var idx = start; for (var k = 0; k < segLen; k++) { var p = points[idx]; if (idx >= allLen || idx < 0) { break; } if (isPointNull(p)) { if (connectNulls) { idx += dir; continue; } break; } if (idx === start) { ctx[dir > 0 ? 'moveTo' : 'lineTo'](p[0], p[1]); v2Copy(cp0, p); } else { if (smooth > 0) { var nextIdx = idx + dir; var nextP = points[nextIdx]; if (connectNulls) { // Find next point not null while (nextP && isPointNull(points[nextIdx])) { nextIdx += dir; nextP = points[nextIdx]; } } var ratioNextSeg = 0.5; var prevP = points[prevIdx]; var nextP = points[nextIdx]; // Last point if (!nextP || isPointNull(nextP)) { v2Copy(cp1, p); } else { // If next data is null in not connect case if (isPointNull(nextP) && !connectNulls) { nextP = p; } vec2.sub(v, nextP, prevP); var lenPrevSeg; var lenNextSeg; if (smoothMonotone === 'x' || smoothMonotone === 'y') { var dim = smoothMonotone === 'x' ? 0 : 1; lenPrevSeg = Math.abs(p[dim] - prevP[dim]); lenNextSeg = Math.abs(p[dim] - nextP[dim]); } else { lenPrevSeg = vec2.dist(p, prevP); lenNextSeg = vec2.dist(p, nextP); } // Use ratio of seg length ratioNextSeg = lenNextSeg / (lenNextSeg + lenPrevSeg); scaleAndAdd(cp1, p, v, -smooth * (1 - ratioNextSeg)); } // Smooth constraint vec2Min(cp0, cp0, smoothMax); vec2Max(cp0, cp0, smoothMin); vec2Min(cp1, cp1, smoothMax); vec2Max(cp1, cp1, smoothMin); ctx.bezierCurveTo( cp0[0], cp0[1], cp1[0], cp1[1], p[0], p[1] ); // cp0 of next segment scaleAndAdd(cp0, p, v, smooth * ratioNextSeg); } else { ctx.lineTo(p[0], p[1]); } } prevIdx = idx; idx += dir; } return k; }
javascript
function drawNonMono( ctx, points, start, segLen, allLen, dir, smoothMin, smoothMax, smooth, smoothMonotone, connectNulls ) { var prevIdx = 0; var idx = start; for (var k = 0; k < segLen; k++) { var p = points[idx]; if (idx >= allLen || idx < 0) { break; } if (isPointNull(p)) { if (connectNulls) { idx += dir; continue; } break; } if (idx === start) { ctx[dir > 0 ? 'moveTo' : 'lineTo'](p[0], p[1]); v2Copy(cp0, p); } else { if (smooth > 0) { var nextIdx = idx + dir; var nextP = points[nextIdx]; if (connectNulls) { // Find next point not null while (nextP && isPointNull(points[nextIdx])) { nextIdx += dir; nextP = points[nextIdx]; } } var ratioNextSeg = 0.5; var prevP = points[prevIdx]; var nextP = points[nextIdx]; // Last point if (!nextP || isPointNull(nextP)) { v2Copy(cp1, p); } else { // If next data is null in not connect case if (isPointNull(nextP) && !connectNulls) { nextP = p; } vec2.sub(v, nextP, prevP); var lenPrevSeg; var lenNextSeg; if (smoothMonotone === 'x' || smoothMonotone === 'y') { var dim = smoothMonotone === 'x' ? 0 : 1; lenPrevSeg = Math.abs(p[dim] - prevP[dim]); lenNextSeg = Math.abs(p[dim] - nextP[dim]); } else { lenPrevSeg = vec2.dist(p, prevP); lenNextSeg = vec2.dist(p, nextP); } // Use ratio of seg length ratioNextSeg = lenNextSeg / (lenNextSeg + lenPrevSeg); scaleAndAdd(cp1, p, v, -smooth * (1 - ratioNextSeg)); } // Smooth constraint vec2Min(cp0, cp0, smoothMax); vec2Max(cp0, cp0, smoothMin); vec2Min(cp1, cp1, smoothMax); vec2Max(cp1, cp1, smoothMin); ctx.bezierCurveTo( cp0[0], cp0[1], cp1[0], cp1[1], p[0], p[1] ); // cp0 of next segment scaleAndAdd(cp0, p, v, smooth * ratioNextSeg); } else { ctx.lineTo(p[0], p[1]); } } prevIdx = idx; idx += dir; } return k; }
[ "function", "drawNonMono", "(", "ctx", ",", "points", ",", "start", ",", "segLen", ",", "allLen", ",", "dir", ",", "smoothMin", ",", "smoothMax", ",", "smooth", ",", "smoothMonotone", ",", "connectNulls", ")", "{", "var", "prevIdx", "=", "0", ";", "var",...
Draw smoothed line in non-monotone, in may cause undesired curve in extreme situations. This should be used when points are non-monotone neither in x or y dimension.
[ "Draw", "smoothed", "line", "in", "non", "-", "monotone", "in", "may", "cause", "undesired", "curve", "in", "extreme", "situations", ".", "This", "should", "be", "used", "when", "points", "are", "non", "-", "monotone", "neither", "in", "x", "or", "y", "d...
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/line/poly.js#L171-L262
train
Draw non - monotone points
[ 30522, 3853, 4567, 2239, 8202, 2080, 1006, 14931, 2595, 1010, 2685, 1010, 2707, 1010, 7367, 9354, 2078, 1010, 2035, 7770, 1010, 16101, 1010, 5744, 10020, 1010, 5744, 17848, 1010, 5744, 1010, 5744, 8202, 25862, 2063, 1010, 7532, 11231, 12718...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/yoda.js
same
function same(a, b) { if (a.type !== b.type) { return false; } switch (a.type) { case "Identifier": return a.name === b.name; case "Literal": return a.value === b.value; case "MemberExpression": { const nameA = astUtils.getStaticPropertyName(a); // x.y = x["y"] if (nameA) { return ( same(a.object, b.object) && nameA === astUtils.getStaticPropertyName(b) ); } /* * x[0] = x[0] * x[y] = x[y] * x.y = x.y */ return ( a.computed === b.computed && same(a.object, b.object) && same(a.property, b.property) ); } case "ThisExpression": return true; default: return false; } }
javascript
function same(a, b) { if (a.type !== b.type) { return false; } switch (a.type) { case "Identifier": return a.name === b.name; case "Literal": return a.value === b.value; case "MemberExpression": { const nameA = astUtils.getStaticPropertyName(a); // x.y = x["y"] if (nameA) { return ( same(a.object, b.object) && nameA === astUtils.getStaticPropertyName(b) ); } /* * x[0] = x[0] * x[y] = x[y] * x.y = x.y */ return ( a.computed === b.computed && same(a.object, b.object) && same(a.property, b.property) ); } case "ThisExpression": return true; default: return false; } }
[ "function", "same", "(", "a", ",", "b", ")", "{", "if", "(", "a", ".", "type", "!==", "b", ".", "type", ")", "{", "return", "false", ";", "}", "switch", "(", "a", ".", "type", ")", "{", "case", "\"Identifier\"", ":", "return", "a", ".", "name",...
Checks whether two expressions reference the same value. For example: a = a a.b = a.b a[0] = a[0] a['b'] = a['b'] @param {ASTNode} a Left side of the comparison. @param {ASTNode} b Right side of the comparison. @returns {boolean} True if both sides match and reference the same value.
[ "Checks", "whether", "two", "expressions", "reference", "the", "same", "value", ".", "For", "example", ":", "a", "=", "a", "a", ".", "b", "=", "a", ".", "b", "a", "[", "0", "]", "=", "a", "[", "0", "]", "a", "[", "b", "]", "=", "a", "[", "b...
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/yoda.js#L106-L147
train
returns true if a and b are the same
[ 30522, 3853, 2168, 1006, 1037, 1010, 1038, 1007, 1063, 2065, 1006, 1037, 1012, 2828, 999, 1027, 1027, 1038, 1012, 2828, 1007, 1063, 2709, 6270, 1025, 1065, 6942, 1006, 1037, 1012, 2828, 1007, 1063, 2553, 1000, 8909, 4765, 18095, 1000, 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...
zloirock/core-js
packages/core-js/internals/collection-strong.js
forEach
function forEach(callbackfn /* , that = undefined */) { var state = getInternalState(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); var entry; while (entry = entry ? entry.next : state.first) { boundFunction(entry.value, entry.key, this); // revert to the last existing entry while (entry && entry.removed) entry = entry.previous; } }
javascript
function forEach(callbackfn /* , that = undefined */) { var state = getInternalState(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); var entry; while (entry = entry ? entry.next : state.first) { boundFunction(entry.value, entry.key, this); // revert to the last existing entry while (entry && entry.removed) entry = entry.previous; } }
[ "function", "forEach", "(", "callbackfn", "/* , that = undefined */", ")", "{", "var", "state", "=", "getInternalState", "(", "this", ")", ";", "var", "boundFunction", "=", "bind", "(", "callbackfn", ",", "arguments", ".", "length", ">", "1", "?", "arguments",...
23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
[ "23", ".", "2", ".", "3", ".", "6", "Set", ".", "prototype", ".", "forEach", "(", "callbackfn", "thisArg", "=", "undefined", ")", "23", ".", "1", ".", "3", ".", "5", "Map", ".", "prototype", ".", "forEach", "(", "callbackfn", "thisArg", "=", "undef...
fe7c8511a6d27d03a9b8e075b3351416aae95c58
https://github.com/zloirock/core-js/blob/fe7c8511a6d27d03a9b8e075b3351416aae95c58/packages/core-js/internals/collection-strong.js#L110-L119
train
Iterates over all the cache entries in the cache.
[ 30522, 3853, 18921, 6776, 1006, 2655, 5963, 2546, 2078, 1013, 1008, 1010, 2008, 1027, 6151, 28344, 1008, 1013, 1007, 1063, 13075, 2110, 1027, 2131, 18447, 11795, 9777, 12259, 1006, 2023, 1007, 1025, 13075, 5391, 11263, 27989, 1027, 14187, 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.dt/src/sap/ui/dt/ContextMenuControl.js
function (aButtons) { var iVisibleButtons = 0; aButtons.forEach(function (oButton) { oButton.setVisible(oButton.getEnabled()); if (oButton.getEnabled()) { iVisibleButtons++; } }); return iVisibleButtons; }
javascript
function (aButtons) { var iVisibleButtons = 0; aButtons.forEach(function (oButton) { oButton.setVisible(oButton.getEnabled()); if (oButton.getEnabled()) { iVisibleButtons++; } }); return iVisibleButtons; }
[ "function", "(", "aButtons", ")", "{", "var", "iVisibleButtons", "=", "0", ";", "aButtons", ".", "forEach", "(", "function", "(", "oButton", ")", "{", "oButton", ".", "setVisible", "(", "oButton", ".", "getEnabled", "(", ")", ")", ";", "if", "(", "oBut...
Hiddes all disabled buttons and returns the number if visible buttons @param {array} aButtons some Buttons @return {int} the number of visible buttons
[ "Hiddes", "all", "disabled", "buttons", "and", "returns", "the", "number", "if", "visible", "buttons" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L268-L278
train
Sets the visibility of all buttons
[ 30522, 3853, 1006, 8273, 15474, 2015, 1007, 1063, 13075, 4921, 17417, 3468, 8569, 15474, 2015, 1027, 1014, 1025, 8273, 15474, 2015, 1012, 18921, 6776, 1006, 3853, 1006, 27885, 4904, 2669, 1007, 1063, 27885, 4904, 2669, 1012, 2275, 11365, 70...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensibility/ExtensionManagerDialog.js
updateNotificationIcon
function updateNotificationIcon(index) { var model = models[index], $notificationIcon = $dlg.find(".nav-tabs li").eq(index).find(".notification"); if (model.notifyCount) { $notificationIcon.text(model.notifyCount); $notificationIcon.show(); } else { $notificationIcon.hide(); } }
javascript
function updateNotificationIcon(index) { var model = models[index], $notificationIcon = $dlg.find(".nav-tabs li").eq(index).find(".notification"); if (model.notifyCount) { $notificationIcon.text(model.notifyCount); $notificationIcon.show(); } else { $notificationIcon.hide(); } }
[ "function", "updateNotificationIcon", "(", "index", ")", "{", "var", "model", "=", "models", "[", "index", "]", ",", "$notificationIcon", "=", "$dlg", ".", "find", "(", "\".nav-tabs li\"", ")", ".", "eq", "(", "index", ")", ".", "find", "(", "\".notificati...
Update & hide/show the notification overlay on a tab's icon, based on its model's notifyCount
[ "Update", "&", "hide", "/", "show", "the", "notification", "overlay", "on", "a", "tab", "s", "icon", "based", "on", "its", "model", "s", "notifyCount" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/ExtensionManagerDialog.js#L409-L418
train
Update notification icon
[ 30522, 3853, 10651, 17048, 9031, 28524, 1006, 5950, 1007, 1063, 13075, 2944, 1027, 4275, 1031, 5950, 1033, 1010, 1002, 26828, 28524, 1027, 1002, 21469, 2290, 1012, 2424, 1006, 1000, 1012, 6583, 2615, 1011, 21628, 2015, 5622, 1000, 1007, 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...
mochajs/mocha
lib/reporters/spec.js
Spec
function Spec(runner, options) { Base.call(this, runner, options); var self = this; var indents = 0; var n = 0; function indent() { return Array(indents).join(' '); } runner.on(EVENT_RUN_BEGIN, function() { console.log(); }); runner.on(EVENT_SUITE_BEGIN, function(suite) { ++indents; console.log(color('suite', '%s%s'), indent(), suite.title); }); runner.on(EVENT_SUITE_END, function() { --indents; if (indents === 1) { console.log(); } }); runner.on(EVENT_TEST_PENDING, function(test) { var fmt = indent() + color('pending', ' - %s'); console.log(fmt, test.title); }); runner.on(EVENT_TEST_PASS, function(test) { var fmt; if (test.speed === 'fast') { fmt = indent() + color('checkmark', ' ' + Base.symbols.ok) + color('pass', ' %s'); console.log(fmt, test.title); } else { fmt = indent() + color('checkmark', ' ' + Base.symbols.ok) + color('pass', ' %s') + color(test.speed, ' (%dms)'); console.log(fmt, test.title, test.duration); } }); runner.on(EVENT_TEST_FAIL, function(test) { console.log(indent() + color('fail', ' %d) %s'), ++n, test.title); }); runner.once(EVENT_RUN_END, self.epilogue.bind(self)); }
javascript
function Spec(runner, options) { Base.call(this, runner, options); var self = this; var indents = 0; var n = 0; function indent() { return Array(indents).join(' '); } runner.on(EVENT_RUN_BEGIN, function() { console.log(); }); runner.on(EVENT_SUITE_BEGIN, function(suite) { ++indents; console.log(color('suite', '%s%s'), indent(), suite.title); }); runner.on(EVENT_SUITE_END, function() { --indents; if (indents === 1) { console.log(); } }); runner.on(EVENT_TEST_PENDING, function(test) { var fmt = indent() + color('pending', ' - %s'); console.log(fmt, test.title); }); runner.on(EVENT_TEST_PASS, function(test) { var fmt; if (test.speed === 'fast') { fmt = indent() + color('checkmark', ' ' + Base.symbols.ok) + color('pass', ' %s'); console.log(fmt, test.title); } else { fmt = indent() + color('checkmark', ' ' + Base.symbols.ok) + color('pass', ' %s') + color(test.speed, ' (%dms)'); console.log(fmt, test.title, test.duration); } }); runner.on(EVENT_TEST_FAIL, function(test) { console.log(indent() + color('fail', ' %d) %s'), ++n, test.title); }); runner.once(EVENT_RUN_END, self.epilogue.bind(self)); }
[ "function", "Spec", "(", "runner", ",", "options", ")", "{", "Base", ".", "call", "(", "this", ",", "runner", ",", "options", ")", ";", "var", "self", "=", "this", ";", "var", "indents", "=", "0", ";", "var", "n", "=", "0", ";", "function", "inde...
Constructs a new `Spec` reporter instance. @public @class @memberof Mocha.reporters @extends Mocha.reporters.Base @param {Runner} runner - Instance triggers reporter actions. @param {Object} [options] - runner options
[ "Constructs", "a", "new", "Spec", "reporter", "instance", "." ]
9b00fedb610241e33f7592c40164e42a38a793cf
https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/reporters/spec.js#L37-L92
train
Spec constructor.
[ 30522, 3853, 28699, 1006, 5479, 1010, 7047, 1007, 1063, 2918, 1012, 2655, 1006, 2023, 1010, 5479, 1010, 7047, 1007, 1025, 13075, 2969, 1027, 2023, 1025, 13075, 27427, 11187, 1027, 1014, 1025, 13075, 1050, 1027, 1014, 1025, 3853, 27427, 4765...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/extensions.js
sequence
function sequence(streamProviders) { const result = es.through(); function pop() { if (streamProviders.length === 0) { result.emit('end'); } else { const fn = streamProviders.shift(); fn() .on('end', function () { setTimeout(pop, 0); }) .pipe(result, { end: false }); } } pop(); return result; }
javascript
function sequence(streamProviders) { const result = es.through(); function pop() { if (streamProviders.length === 0) { result.emit('end'); } else { const fn = streamProviders.shift(); fn() .on('end', function () { setTimeout(pop, 0); }) .pipe(result, { end: false }); } } pop(); return result; }
[ "function", "sequence", "(", "streamProviders", ")", "{", "const", "result", "=", "es", ".", "through", "(", ")", ";", "function", "pop", "(", ")", "{", "if", "(", "streamProviders", ".", "length", "===", "0", ")", "{", "result", ".", "emit", "(", "'...
We're doing way too much stuff at once, with webpack et al. So much stuff that while downloading extensions from the marketplace, node js doesn't get enough stack frames to complete the download in under 2 minutes, at which point the marketplace server cuts off the http request. So, we sequentialize the extensino tasks.
[ "We", "re", "doing", "way", "too", "much", "stuff", "at", "once", "with", "webpack", "et", "al", ".", "So", "much", "stuff", "that", "while", "downloading", "extensions", "from", "the", "marketplace", "node", "js", "doesn", "t", "get", "enough", "stack", ...
693a13cd32c5be798051edc0cb43e1e39fc456d9
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/extensions.js#L194-L209
train
sequence sequence function
[ 30522, 3853, 5537, 1006, 5460, 21572, 17258, 2545, 1007, 1063, 9530, 3367, 2765, 1027, 9686, 1012, 2083, 1006, 1007, 1025, 3853, 3769, 1006, 1007, 1063, 2065, 1006, 5460, 21572, 17258, 2545, 1012, 3091, 1027, 1027, 1027, 1014, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/config/config-file.js
loadConfigFile
function loadConfigFile(configInfo) { const { filePath } = configInfo; let config; switch (path.extname(filePath)) { case ".js": config = loadJSConfigFile(filePath); if (configInfo.configName) { config = config.configs[configInfo.configName]; if (!config) { throw configMissingError(configInfo.configFullName); } } break; case ".json": if (path.basename(filePath) === "package.json") { config = loadPackageJSONConfigFile(filePath); if (config === null) { return null; } } else { config = loadJSONConfigFile(filePath); } break; case ".yaml": case ".yml": config = loadYAMLConfigFile(filePath); break; default: config = loadLegacyConfigFile(filePath); } return ConfigOps.merge(ConfigOps.createEmptyConfig(), config); }
javascript
function loadConfigFile(configInfo) { const { filePath } = configInfo; let config; switch (path.extname(filePath)) { case ".js": config = loadJSConfigFile(filePath); if (configInfo.configName) { config = config.configs[configInfo.configName]; if (!config) { throw configMissingError(configInfo.configFullName); } } break; case ".json": if (path.basename(filePath) === "package.json") { config = loadPackageJSONConfigFile(filePath); if (config === null) { return null; } } else { config = loadJSONConfigFile(filePath); } break; case ".yaml": case ".yml": config = loadYAMLConfigFile(filePath); break; default: config = loadLegacyConfigFile(filePath); } return ConfigOps.merge(ConfigOps.createEmptyConfig(), config); }
[ "function", "loadConfigFile", "(", "configInfo", ")", "{", "const", "{", "filePath", "}", "=", "configInfo", ";", "let", "config", ";", "switch", "(", "path", ".", "extname", "(", "filePath", ")", ")", "{", "case", "\".js\"", ":", "config", "=", "loadJSC...
Loads a configuration file regardless of the source. Inspects the file path to determine the correctly way to load the config file. @param {Object} configInfo The path to the configuration. @returns {Object} The configuration information. @private
[ "Loads", "a", "configuration", "file", "regardless", "of", "the", "source", ".", "Inspects", "the", "file", "path", "to", "determine", "the", "correctly", "way", "to", "load", "the", "config", "file", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/config/config-file.js#L206-L242
train
Load a config file
[ 30522, 3853, 7170, 8663, 8873, 25708, 9463, 1006, 9530, 8873, 11528, 14876, 1007, 1063, 9530, 3367, 1063, 5371, 15069, 1065, 1027, 9530, 8873, 11528, 14876, 1025, 2292, 9530, 8873, 2290, 1025, 6942, 1006, 4130, 1012, 4654, 2102, 18442, 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...
Dogfalo/materialize
extras/noUiSlider/nouislider.js
addOrigin
function addOrigin ( base, handleNumber ) { var origin = addNodeTo(base, options.cssClasses.origin); var handle = addNodeTo(origin, options.cssClasses.handle); addNodeTo(handle, options.cssClasses.handleTouchArea); handle.setAttribute('data-handle', handleNumber); if ( handleNumber === 0 ) { addClass(handle, options.cssClasses.handleLower); } else if ( handleNumber === options.handles - 1 ) { addClass(handle, options.cssClasses.handleUpper); } return origin; }
javascript
function addOrigin ( base, handleNumber ) { var origin = addNodeTo(base, options.cssClasses.origin); var handle = addNodeTo(origin, options.cssClasses.handle); addNodeTo(handle, options.cssClasses.handleTouchArea); handle.setAttribute('data-handle', handleNumber); if ( handleNumber === 0 ) { addClass(handle, options.cssClasses.handleLower); } else if ( handleNumber === options.handles - 1 ) { addClass(handle, options.cssClasses.handleUpper); } return origin; }
[ "function", "addOrigin", "(", "base", ",", "handleNumber", ")", "{", "var", "origin", "=", "addNodeTo", "(", "base", ",", "options", ".", "cssClasses", ".", "origin", ")", ";", "var", "handle", "=", "addNodeTo", "(", "origin", ",", "options", ".", "cssCl...
Append a origin to the base
[ "Append", "a", "origin", "to", "the", "base" ]
1122efadad8f1433d404696f7613e3cc13fb83a4
https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/extras/noUiSlider/nouislider.js#L911-L928
train
add origin to base
[ 30522, 3853, 5587, 10050, 11528, 1006, 2918, 1010, 5047, 19172, 5677, 1007, 1063, 13075, 4761, 1027, 5587, 3630, 3207, 3406, 1006, 30524, 27102, 2229, 1012, 4761, 1007, 1025, 13075, 5047, 1027, 5587, 3630, 3207, 3406, 1006, 4761, 1010, 7047...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
pagekit/vue-resource
dist/vue-resource.esm.js
expand
function expand(url, params, variables) { var tmpl = parse(url), expanded = tmpl.expand(params); if (variables) { variables.push.apply(variables, tmpl.vars); } return expanded; }
javascript
function expand(url, params, variables) { var tmpl = parse(url), expanded = tmpl.expand(params); if (variables) { variables.push.apply(variables, tmpl.vars); } return expanded; }
[ "function", "expand", "(", "url", ",", "params", ",", "variables", ")", "{", "var", "tmpl", "=", "parse", "(", "url", ")", ",", "expanded", "=", "tmpl", ".", "expand", "(", "params", ")", ";", "if", "(", "variables", ")", "{", "variables", ".", "pu...
URL Template v2.0.6 (https://github.com/bramstein/url-template)
[ "URL", "Template", "v2", ".", "0", ".", "6", "(", "https", ":", "//", "github", ".", "com", "/", "bramstein", "/", "url", "-", "template", ")" ]
fe268fa1d6053ede5f34aef9a11e1a424a70446c
https://github.com/pagekit/vue-resource/blob/fe268fa1d6053ede5f34aef9a11e1a424a70446c/dist/vue-resource.esm.js#L486-L495
train
Expands a URL with parameters
[ 30522, 3853, 7818, 1006, 24471, 2140, 1010, 11498, 5244, 1010, 10857, 1007, 1063, 13075, 1056, 8737, 2140, 1027, 11968, 3366, 1006, 24471, 2140, 1007, 1010, 4423, 1027, 1056, 8737, 2140, 1012, 7818, 1006, 11498, 5244, 1007, 1025, 2065, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataParentBinding.js
fetchPropertyAndType
function fetchPropertyAndType() { if (bIsAdvertisement) { // Ensure entity type metadata is loaded even for advertisement so that sync access // to key properties is possible return oMetaModel.fetchObject(sFullMetaPath.slice(0, sFullMetaPath.lastIndexOf("/") + 1)); } return oMetaModel.fetchObject(sFullMetaPath).then(function (oProperty) { if (oProperty && oProperty.$kind === "NavigationProperty") { // Ensure that the target type of the navigation property is available // synchronously. This is only necessary for navigation properties and may only // be done for them because it would fail for properties with a simple type like // "Edm.String". return oMetaModel.fetchObject(sFullMetaPath + "/").then(function () { return oProperty; }); } return oProperty; }); }
javascript
function fetchPropertyAndType() { if (bIsAdvertisement) { // Ensure entity type metadata is loaded even for advertisement so that sync access // to key properties is possible return oMetaModel.fetchObject(sFullMetaPath.slice(0, sFullMetaPath.lastIndexOf("/") + 1)); } return oMetaModel.fetchObject(sFullMetaPath).then(function (oProperty) { if (oProperty && oProperty.$kind === "NavigationProperty") { // Ensure that the target type of the navigation property is available // synchronously. This is only necessary for navigation properties and may only // be done for them because it would fail for properties with a simple type like // "Edm.String". return oMetaModel.fetchObject(sFullMetaPath + "/").then(function () { return oProperty; }); } return oProperty; }); }
[ "function", "fetchPropertyAndType", "(", ")", "{", "if", "(", "bIsAdvertisement", ")", "{", "// Ensure entity type metadata is loaded even for advertisement so that sync access", "// to key properties is possible", "return", "oMetaModel", ".", "fetchObject", "(", "sFullMetaPath", ...
/* Fetches the property that is reached by the calculated meta path and (if necessary) its type. @returns {sap.ui.base.SyncPromise} A promise that is either resolved with the property or, in case of an action advertisement with the entity. If no property can be reached by the calculated meta path the promise is resolved with undefined.
[ "/", "*", "Fetches", "the", "property", "that", "is", "reached", "by", "the", "calculated", "meta", "path", "and", "(", "if", "necessary", ")", "its", "type", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataParentBinding.js#L556-L575
train
Fetch the property and its type
[ 30522, 3853, 18584, 21572, 4842, 21426, 26379, 18863, 1006, 1007, 1063, 2065, 1006, 20377, 4215, 16874, 5562, 3672, 1007, 1063, 1013, 1013, 5676, 9178, 2828, 27425, 2003, 8209, 2130, 2005, 15147, 2061, 2008, 26351, 3229, 1013, 1013, 2000, 3...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/selenium-core/lib/cssQuery/src/cssQuery-level3.js
nthChild
function nthChild($element, $arguments, $traverse) { switch ($arguments) { case "n": return true; case "even": $arguments = "2n"; break; case "odd": $arguments = "2n+1"; } var $$children = childElements($element.parentNode); function _checkIndex($index) { var $index = ($traverse == nextElementSibling) ? $$children.length - $index : $index - 1; return $$children[$index] == $element; }; // it was just a number (no "n") if (!isNaN($arguments)) return _checkIndex($arguments); $arguments = $arguments.split("n"); var $multiplier = parseInt($arguments[0]); var $step = parseInt($arguments[1]); if ((isNaN($multiplier) || $multiplier == 1) && $step == 0) return true; if ($multiplier == 0 && !isNaN($step)) return _checkIndex($step); if (isNaN($step)) $step = 0; var $count = 1; while ($element = $traverse($element)) $count++; if (isNaN($multiplier) || $multiplier == 1) return ($traverse == nextElementSibling) ? ($count <= $step) : ($step >= $count); return ($count % $multiplier) == $step; }
javascript
function nthChild($element, $arguments, $traverse) { switch ($arguments) { case "n": return true; case "even": $arguments = "2n"; break; case "odd": $arguments = "2n+1"; } var $$children = childElements($element.parentNode); function _checkIndex($index) { var $index = ($traverse == nextElementSibling) ? $$children.length - $index : $index - 1; return $$children[$index] == $element; }; // it was just a number (no "n") if (!isNaN($arguments)) return _checkIndex($arguments); $arguments = $arguments.split("n"); var $multiplier = parseInt($arguments[0]); var $step = parseInt($arguments[1]); if ((isNaN($multiplier) || $multiplier == 1) && $step == 0) return true; if ($multiplier == 0 && !isNaN($step)) return _checkIndex($step); if (isNaN($step)) $step = 0; var $count = 1; while ($element = $traverse($element)) $count++; if (isNaN($multiplier) || $multiplier == 1) return ($traverse == nextElementSibling) ? ($count <= $step) : ($step >= $count); return ($count % $multiplier) == $step; }
[ "function", "nthChild", "(", "$element", ",", "$arguments", ",", "$traverse", ")", "{", "switch", "(", "$arguments", ")", "{", "case", "\"n\"", ":", "return", "true", ";", "case", "\"even\"", ":", "$arguments", "=", "\"2n\"", ";", "break", ";", "case", "...
----------------------------------------------------------------------- nth child support (Bill Edney) -----------------------------------------------------------------------
[ "-----------------------------------------------------------------------", "nth", "child", "support", "(", "Bill", "Edney", ")", "-----------------------------------------------------------------------" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/lib/cssQuery/src/cssQuery-level3.js#L117-L148
train
Returns true if the element is the nth child of the element
[ 30522, 3853, 23961, 16257, 19466, 2094, 1006, 1002, 5783, 1010, 1002, 9918, 1010, 1002, 20811, 1007, 1063, 6942, 1006, 1002, 9918, 1007, 1063, 2553, 1000, 1050, 1000, 1024, 2709, 2995, 1025, 2553, 1000, 2130, 1000, 1024, 1002, 9918, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js
function (oInterface, oPathValue) { var oRawValue = oPathValue.value, oSubPathValue, sType; Basics.expectType(oPathValue, "object"); if (oRawValue.hasOwnProperty("Type")) { sType = Basics.property(oPathValue, "Type", "string"); oSubPathValue = Basics.descend(oPathValue, "Value"); } else { ["And", "Apply", "Bool", "Date", "DateTimeOffset", "Decimal", "Float", "Eq", "Ge", "Gt", "Guid", "If", "Int", "Le", "Lt", "Ne", "Not", "Null", "Or", "Path", "PropertyPath", "String", "TimeOfDay" ].forEach(function (sProperty) { if (oRawValue.hasOwnProperty(sProperty)) { sType = sProperty; oSubPathValue = Basics.descend(oPathValue, sProperty); } }); } switch (sType) { case "Apply": // 14.5.3 Expression edm:Apply return Expression.apply(oInterface, oSubPathValue); case "If": // 14.5.6 Expression edm:If return Expression.conditional(oInterface, oSubPathValue); case "Path": // 14.5.12 Expression edm:Path case "PropertyPath": // 14.5.13 Expression edm:PropertyPath return Expression.path(oInterface, oSubPathValue); case "Bool": // 14.4.2 Expression edm:Bool case "Date": // 14.4.3 Expression edm:Date case "DateTimeOffset": // 14.4.4 Expression edm:DateTimeOffset case "Decimal": // 14.4.5 Expression edm:Decimal case "Float": // 14.4.8 Expression edm:Float case "Guid": // 14.4.9 Expression edm:Guid case "Int": // 14.4.10 Expression edm:Int case "String": // 14.4.11 Expression edm:String case "TimeOfDay": // 14.4.12 Expression edm:TimeOfDay return Expression.constant(oInterface, oSubPathValue, sType); case "And": case "Eq": case "Ge": case "Gt": case "Le": case "Lt": case "Ne": case "Or": // 14.5.1 Comparison and Logical Operators return Expression.operator(oInterface, oSubPathValue, sType); case "Not": // 14.5.1 Comparison and Logical Operators return Expression.not(oInterface, oSubPathValue); case "Null": // 14.5.10 Expression edm:Null return { result : "constant", value : "null", type : "edm:Null" }; default: Basics.error(oPathValue, "Unsupported OData expression"); } }
javascript
function (oInterface, oPathValue) { var oRawValue = oPathValue.value, oSubPathValue, sType; Basics.expectType(oPathValue, "object"); if (oRawValue.hasOwnProperty("Type")) { sType = Basics.property(oPathValue, "Type", "string"); oSubPathValue = Basics.descend(oPathValue, "Value"); } else { ["And", "Apply", "Bool", "Date", "DateTimeOffset", "Decimal", "Float", "Eq", "Ge", "Gt", "Guid", "If", "Int", "Le", "Lt", "Ne", "Not", "Null", "Or", "Path", "PropertyPath", "String", "TimeOfDay" ].forEach(function (sProperty) { if (oRawValue.hasOwnProperty(sProperty)) { sType = sProperty; oSubPathValue = Basics.descend(oPathValue, sProperty); } }); } switch (sType) { case "Apply": // 14.5.3 Expression edm:Apply return Expression.apply(oInterface, oSubPathValue); case "If": // 14.5.6 Expression edm:If return Expression.conditional(oInterface, oSubPathValue); case "Path": // 14.5.12 Expression edm:Path case "PropertyPath": // 14.5.13 Expression edm:PropertyPath return Expression.path(oInterface, oSubPathValue); case "Bool": // 14.4.2 Expression edm:Bool case "Date": // 14.4.3 Expression edm:Date case "DateTimeOffset": // 14.4.4 Expression edm:DateTimeOffset case "Decimal": // 14.4.5 Expression edm:Decimal case "Float": // 14.4.8 Expression edm:Float case "Guid": // 14.4.9 Expression edm:Guid case "Int": // 14.4.10 Expression edm:Int case "String": // 14.4.11 Expression edm:String case "TimeOfDay": // 14.4.12 Expression edm:TimeOfDay return Expression.constant(oInterface, oSubPathValue, sType); case "And": case "Eq": case "Ge": case "Gt": case "Le": case "Lt": case "Ne": case "Or": // 14.5.1 Comparison and Logical Operators return Expression.operator(oInterface, oSubPathValue, sType); case "Not": // 14.5.1 Comparison and Logical Operators return Expression.not(oInterface, oSubPathValue); case "Null": // 14.5.10 Expression edm:Null return { result : "constant", value : "null", type : "edm:Null" }; default: Basics.error(oPathValue, "Unsupported OData expression"); } }
[ "function", "(", "oInterface", ",", "oPathValue", ")", "{", "var", "oRawValue", "=", "oPathValue", ".", "value", ",", "oSubPathValue", ",", "sType", ";", "Basics", ".", "expectType", "(", "oPathValue", ",", "\"object\"", ")", ";", "if", "(", "oRawValue", "...
Calculates an expression. @param {sap.ui.core.util.XMLPreprocessor.IContext|sap.ui.model.Context} oInterface the callback interface related to the current formatter call @param {object} oPathValue path and value information pointing to the parameters array (see Expression object) @returns {object} the result object
[ "Calculates", "an", "expression", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js#L337-L400
train
Returns an object representation of the given path value.
[ 30522, 3853, 1006, 1051, 18447, 2121, 12172, 1010, 6728, 8988, 10175, 5657, 1007, 1063, 13075, 2030, 10376, 10175, 5657, 1027, 6728, 8988, 10175, 5657, 1012, 3643, 1010, 9808, 12083, 15069, 10175, 5657, 1010, 2358, 18863, 1025, 24078, 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...
GoogleChrome/workbox
packages/workbox-build/src/entry-points/get-manifest.js
getManifest
async function getManifest(config) { // This check needs to be done before validation, since the deprecated options // will be renamed. const deprecationWarnings = checkForDeprecatedOptions(config); const options = validate(config, getManifestSchema); const {manifestEntries, count, size, warnings} = await getFileManifestEntries(options); // Add in any deprecation warnings. warnings.push(...deprecationWarnings); return {manifestEntries, count, size, warnings}; }
javascript
async function getManifest(config) { // This check needs to be done before validation, since the deprecated options // will be renamed. const deprecationWarnings = checkForDeprecatedOptions(config); const options = validate(config, getManifestSchema); const {manifestEntries, count, size, warnings} = await getFileManifestEntries(options); // Add in any deprecation warnings. warnings.push(...deprecationWarnings); return {manifestEntries, count, size, warnings}; }
[ "async", "function", "getManifest", "(", "config", ")", "{", "// This check needs to be done before validation, since the deprecated options", "// will be renamed.", "const", "deprecationWarnings", "=", "checkForDeprecatedOptions", "(", "config", ")", ";", "const", "options", "...
This method returns a list of URLs to precache, referred to as a "precache manifest", along with details about the number of entries and their size, based on the options you provide. @param {Object} config Please refer to the [configuration guide](https://developers.google.com/web/tools/workbox/modules/workbox-build#getmanifest_mode). @return {Promise<{manifestEntries: Array<ManifestEntry>, count: number, size: number, warnings: Array<string>}>} A promise that resolves once the precache manifest is determined. The `size` property contains the aggregate size of all the precached entries, in bytes, the `count` property contains the total number of precached entries, and the `manifestEntries` property contains all the `ManifestEntry` items. Any non-fatal warning messages will be returned via `warnings`. @memberof module:workbox-build
[ "This", "method", "returns", "a", "list", "of", "URLs", "to", "precache", "referred", "to", "as", "a", "precache", "manifest", "along", "with", "details", "about", "the", "number", "of", "entries", "and", "their", "size", "based", "on", "the", "options", "...
8379c51b6deaf52faed5879206fe84579cae41f0
https://github.com/GoogleChrome/workbox/blob/8379c51b6deaf52faed5879206fe84579cae41f0/packages/workbox-build/src/entry-points/get-manifest.js#L32-L46
train
Get the manifest from the specified config
[ 30522, 2004, 6038, 2278, 3853, 2131, 20799, 14081, 1006, 9530, 8873, 2290, 1007, 1063, 1013, 1013, 2023, 4638, 3791, 2000, 2022, 2589, 2077, 27354, 1010, 2144, 1996, 2139, 28139, 12921, 7047, 1013, 1013, 2097, 2022, 4096, 1012, 9530, 3367, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
expressjs/express
lib/application.js
tryRender
function tryRender(view, options, callback) { try { view.render(options, callback); } catch (err) { callback(err); } }
javascript
function tryRender(view, options, callback) { try { view.render(options, callback); } catch (err) { callback(err); } }
[ "function", "tryRender", "(", "view", ",", "options", ",", "callback", ")", "{", "try", "{", "view", ".", "render", "(", "options", ",", "callback", ")", ";", "}", "catch", "(", "err", ")", "{", "callback", "(", "err", ")", ";", "}", "}" ]
Try rendering a view. @private
[ "Try", "rendering", "a", "view", "." ]
dc538f6e810bd462c98ee7e6aae24c64d4b1da93
https://github.com/expressjs/express/blob/dc538f6e810bd462c98ee7e6aae24c64d4b1da93/lib/application.js#L638-L644
train
Try to render a view using a Knockout algorithm.
[ 30522, 3853, 3046, 7389, 4063, 1006, 3193, 1010, 7047, 1010, 2655, 5963, 1007, 1063, 3046, 1063, 3193, 1012, 17552, 1006, 7047, 1010, 2655, 5963, 1007, 1025, 1065, 4608, 1006, 9413, 2099, 1007, 1063, 2655, 5963, 1006, 9413, 2099, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
Microsoft/vscode
src/main.js
getUserDefinedLocale
function getUserDefinedLocale() { const locale = args['locale']; if (locale) { return Promise.resolve(locale.toLowerCase()); } const localeConfig = path.join(userDataPath, 'User', 'locale.json'); return bootstrap.readFile(localeConfig).then(content => { content = stripComments(content); try { const value = JSON.parse(content).locale; return value && typeof value === 'string' ? value.toLowerCase() : undefined; } catch (e) { return undefined; } }, () => { return undefined; }); }
javascript
function getUserDefinedLocale() { const locale = args['locale']; if (locale) { return Promise.resolve(locale.toLowerCase()); } const localeConfig = path.join(userDataPath, 'User', 'locale.json'); return bootstrap.readFile(localeConfig).then(content => { content = stripComments(content); try { const value = JSON.parse(content).locale; return value && typeof value === 'string' ? value.toLowerCase() : undefined; } catch (e) { return undefined; } }, () => { return undefined; }); }
[ "function", "getUserDefinedLocale", "(", ")", "{", "const", "locale", "=", "args", "[", "'locale'", "]", ";", "if", "(", "locale", ")", "{", "return", "Promise", ".", "resolve", "(", "locale", ".", "toLowerCase", "(", ")", ")", ";", "}", "const", "loca...
Language tags are case insensitive however an amd loader is case sensitive To make this work on case preserving & insensitive FS we do the following: the language bundles have lower case language tags and we always lower case the locale we receive from the user or OS. @returns {Promise<string>}
[ "Language", "tags", "are", "case", "insensitive", "however", "an", "amd", "loader", "is", "case", "sensitive", "To", "make", "this", "work", "on", "case", "preserving", "&", "insensitive", "FS", "we", "do", "the", "following", ":", "the", "language", "bundle...
693a13cd32c5be798051edc0cb43e1e39fc456d9
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/src/main.js#L331-L349
train
Get the user defined locale
[ 30522, 3853, 2131, 20330, 3207, 23460, 19422, 24755, 2571, 1006, 1007, 1063, 9530, 3367, 2334, 2063, 1027, 12098, 5620, 1031, 1005, 2334, 2063, 1005, 1033, 1025, 2065, 1006, 2334, 2063, 1007, 1063, 2709, 4872, 1012, 10663, 1006, 2334, 2063,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ccxt/ccxt
build/export-exchanges.js
replaceInFile
function replaceInFile (filename, regex, replacement) { log.bright.cyan ('Exporting exchanges →', filename.yellow) let contents = fs.readFileSync (filename, 'utf8') const newContents = contents.replace (regex, replacement) fs.truncateSync (filename) fs.writeFileSync (filename, newContents) }
javascript
function replaceInFile (filename, regex, replacement) { log.bright.cyan ('Exporting exchanges →', filename.yellow) let contents = fs.readFileSync (filename, 'utf8') const newContents = contents.replace (regex, replacement) fs.truncateSync (filename) fs.writeFileSync (filename, newContents) }
[ "function", "replaceInFile", "(", "filename", ",", "regex", ",", "replacement", ")", "{", "log", ".", "bright", ".", "cyan", "(", "'Exporting exchanges →', ", "f", "lename.y", "e", "llow)", "", "let", "contents", "=", "fs", ".", "readFileSync", "(", "filenam...
----------------------------------------------------------------------------
[ "----------------------------------------------------------------------------" ]
8168069b9180a465532905e225586215e115a565
https://github.com/ccxt/ccxt/blob/8168069b9180a465532905e225586215e115a565/build/export-exchanges.js#L31-L37
train
Replace a string in a file
[ 30522, 3853, 5672, 2378, 8873, 2571, 1006, 5371, 18442, 1010, 19723, 10288, 1010, 30524, 1007, 9530, 3367, 2047, 8663, 6528, 3215, 1027, 8417, 1012, 5672, 1006, 19723, 10288, 1010, 6110, 1007, 1042, 2015, 1012, 19817, 4609, 16280, 6508, 122...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
codemirror/CodeMirror
src/display/update_display.js
patchDisplay
function patchDisplay(cm, updateNumbersFrom, dims) { let display = cm.display, lineNumbers = cm.options.lineNumbers let container = display.lineDiv, cur = container.firstChild function rm(node) { let next = node.nextSibling // Works around a throw-scroll bug in OS X Webkit if (webkit && mac && cm.display.currentWheelTarget == node) node.style.display = "none" else node.parentNode.removeChild(node) return next } let view = display.view, lineN = display.viewFrom // Loop over the elements in the view, syncing cur (the DOM nodes // in display.lineDiv) with the view as we go. for (let i = 0; i < view.length; i++) { let lineView = view[i] if (lineView.hidden) { } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet let node = buildLineElement(cm, lineView, lineN, dims) container.insertBefore(node, cur) } else { // Already drawn while (cur != lineView.node) cur = rm(cur) let updateNumber = lineNumbers && updateNumbersFrom != null && updateNumbersFrom <= lineN && lineView.lineNumber if (lineView.changes) { if (indexOf(lineView.changes, "gutter") > -1) updateNumber = false updateLineForChanges(cm, lineView, lineN, dims) } if (updateNumber) { removeChildren(lineView.lineNumber) lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN))) } cur = lineView.node.nextSibling } lineN += lineView.size } while (cur) cur = rm(cur) }
javascript
function patchDisplay(cm, updateNumbersFrom, dims) { let display = cm.display, lineNumbers = cm.options.lineNumbers let container = display.lineDiv, cur = container.firstChild function rm(node) { let next = node.nextSibling // Works around a throw-scroll bug in OS X Webkit if (webkit && mac && cm.display.currentWheelTarget == node) node.style.display = "none" else node.parentNode.removeChild(node) return next } let view = display.view, lineN = display.viewFrom // Loop over the elements in the view, syncing cur (the DOM nodes // in display.lineDiv) with the view as we go. for (let i = 0; i < view.length; i++) { let lineView = view[i] if (lineView.hidden) { } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet let node = buildLineElement(cm, lineView, lineN, dims) container.insertBefore(node, cur) } else { // Already drawn while (cur != lineView.node) cur = rm(cur) let updateNumber = lineNumbers && updateNumbersFrom != null && updateNumbersFrom <= lineN && lineView.lineNumber if (lineView.changes) { if (indexOf(lineView.changes, "gutter") > -1) updateNumber = false updateLineForChanges(cm, lineView, lineN, dims) } if (updateNumber) { removeChildren(lineView.lineNumber) lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN))) } cur = lineView.node.nextSibling } lineN += lineView.size } while (cur) cur = rm(cur) }
[ "function", "patchDisplay", "(", "cm", ",", "updateNumbersFrom", ",", "dims", ")", "{", "let", "display", "=", "cm", ".", "display", ",", "lineNumbers", "=", "cm", ".", "options", ".", "lineNumbers", "let", "container", "=", "display", ".", "lineDiv", ",",...
Sync the actual display DOM structure with display.view, removing nodes for lines that are no longer in view, and creating the ones that are not there yet, and updating the ones that are out of date.
[ "Sync", "the", "actual", "display", "DOM", "structure", "with", "display", ".", "view", "removing", "nodes", "for", "lines", "that", "are", "no", "longer", "in", "view", "and", "creating", "the", "ones", "that", "are", "not", "there", "yet", "and", "updati...
dab6f676107c10ba8d16c654a42f66cae3f27db1
https://github.com/codemirror/CodeMirror/blob/dab6f676107c10ba8d16c654a42f66cae3f27db1/src/display/update_display.js#L209-L249
train
Patch the display with the line number and dimensions
[ 30522, 3853, 8983, 10521, 13068, 1006, 4642, 1010, 10651, 19172, 17198, 19699, 5358, 1010, 11737, 2015, 1007, 1063, 2292, 4653, 1027, 4642, 1012, 4653, 1010, 17517, 29440, 2015, 1027, 4642, 1012, 7047, 1012, 17517, 29440, 2015, 2292, 11661, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
BlackrockDigital/startbootstrap-sb-admin-2
vendor/chart.js/Chart.js
function(label) { var me = this; var ticksOpts = me.options.ticks; var tickLabelWidth = me.ctx.measureText(label).width; var angle = helpers$1.toRadians(ticksOpts.maxRotation); var cosRotation = Math.cos(angle); var sinRotation = Math.sin(angle); var tickFontSize = valueOrDefault$c(ticksOpts.fontSize, core_defaults.global.defaultFontSize); return (tickLabelWidth * cosRotation) + (tickFontSize * sinRotation); }
javascript
function(label) { var me = this; var ticksOpts = me.options.ticks; var tickLabelWidth = me.ctx.measureText(label).width; var angle = helpers$1.toRadians(ticksOpts.maxRotation); var cosRotation = Math.cos(angle); var sinRotation = Math.sin(angle); var tickFontSize = valueOrDefault$c(ticksOpts.fontSize, core_defaults.global.defaultFontSize); return (tickLabelWidth * cosRotation) + (tickFontSize * sinRotation); }
[ "function", "(", "label", ")", "{", "var", "me", "=", "this", ";", "var", "ticksOpts", "=", "me", ".", "options", ".", "ticks", ";", "var", "tickLabelWidth", "=", "me", ".", "ctx", ".", "measureText", "(", "label", ")", ".", "width", ";", "var", "a...
Crude approximation of what the label width might be @private
[ "Crude", "approximation", "of", "what", "the", "label", "width", "might", "be" ]
ddfaceb4a8e65a41f163e2fdc4eab49384b810a1
https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/ddfaceb4a8e65a41f163e2fdc4eab49384b810a1/vendor/chart.js/Chart.js#L13279-L13289
train
Calculate the width of the tick label
[ 30522, 3853, 1006, 3830, 1007, 1063, 13075, 2033, 1027, 2023, 1025, 13075, 16356, 28793, 3215, 1027, 2033, 1012, 7047, 1012, 16356, 2015, 30524, 13075, 2522, 21338, 17287, 3508, 1027, 8785, 1012, 2522, 2015, 1006, 6466, 1007, 1025, 13075, 8...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Requestor.js
function (aRequests) { aRequests.forEach(function (oRequest) { if (Array.isArray(oRequest)) { _Requestor.cleanBatch(oRequest); } else { oRequest.body = _Requestor.cleanPayload(oRequest.body); } }); return aRequests; }
javascript
function (aRequests) { aRequests.forEach(function (oRequest) { if (Array.isArray(oRequest)) { _Requestor.cleanBatch(oRequest); } else { oRequest.body = _Requestor.cleanPayload(oRequest.body); } }); return aRequests; }
[ "function", "(", "aRequests", ")", "{", "aRequests", ".", "forEach", "(", "function", "(", "oRequest", ")", "{", "if", "(", "Array", ".", "isArray", "(", "oRequest", ")", ")", "{", "_Requestor", ".", "cleanBatch", "(", "oRequest", ")", ";", "}", "else"...
Recursively cleans the payload of all contained requests via {@link #.cleanPayload}. Modifies the array in-place. @param {object[]} aRequests The requests @returns {object[]} The cleaned requests @private
[ "Recursively", "cleans", "the", "payload", "of", "all", "contained", "requests", "via", "{", "@link", "#", ".", "cleanPayload", "}", ".", "Modifies", "the", "array", "in", "-", "place", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Requestor.js#L1448-L1457
train
clean the request body
[ 30522, 3853, 1006, 2024, 15500, 2015, 1007, 1063, 2024, 15500, 2015, 1012, 18921, 6776, 1006, 3853, 1006, 10848, 15500, 1007, 1063, 2065, 1006, 9140, 1012, 18061, 11335, 2100, 1006, 10848, 15500, 1007, 1007, 1063, 1035, 5227, 2953, 1012, 45...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aws/aws-sdk-js
lib/services/s3.js
willComputeChecksums
function willComputeChecksums(req) { if (this.computableChecksumOperations[req.operation]) return true; if (!this.config.computeChecksums) return false; // TODO: compute checksums for Stream objects if (!AWS.util.Buffer.isBuffer(req.httpRequest.body) && typeof req.httpRequest.body !== 'string') { return false; } var rules = req.service.api.operations[req.operation].input.members; // Sha256 signing disabled, and not a presigned url if (req.service.shouldDisableBodySigning(req) && !Object.prototype.hasOwnProperty.call(req.httpRequest.headers, 'presigned-expires')) { if (rules.ContentMD5 && !req.params.ContentMD5) { return true; } } // V4 signer uses SHA256 signatures so only compute MD5 if it is required if (req.service.getSignerClass(req) === AWS.Signers.V4) { if (rules.ContentMD5 && !rules.ContentMD5.required) return false; } if (rules.ContentMD5 && !req.params.ContentMD5) return true; }
javascript
function willComputeChecksums(req) { if (this.computableChecksumOperations[req.operation]) return true; if (!this.config.computeChecksums) return false; // TODO: compute checksums for Stream objects if (!AWS.util.Buffer.isBuffer(req.httpRequest.body) && typeof req.httpRequest.body !== 'string') { return false; } var rules = req.service.api.operations[req.operation].input.members; // Sha256 signing disabled, and not a presigned url if (req.service.shouldDisableBodySigning(req) && !Object.prototype.hasOwnProperty.call(req.httpRequest.headers, 'presigned-expires')) { if (rules.ContentMD5 && !req.params.ContentMD5) { return true; } } // V4 signer uses SHA256 signatures so only compute MD5 if it is required if (req.service.getSignerClass(req) === AWS.Signers.V4) { if (rules.ContentMD5 && !rules.ContentMD5.required) return false; } if (rules.ContentMD5 && !req.params.ContentMD5) return true; }
[ "function", "willComputeChecksums", "(", "req", ")", "{", "if", "(", "this", ".", "computableChecksumOperations", "[", "req", ".", "operation", "]", ")", "return", "true", ";", "if", "(", "!", "this", ".", "config", ".", "computeChecksums", ")", "return", ...
Checks whether checksums should be computed for the request. If the request requires checksums to be computed, this will always return true, otherwise it depends on whether {AWS.Config.computeChecksums} is set. @param req [AWS.Request] the request to check against @return [Boolean] whether to compute checksums for a request. @api private
[ "Checks", "whether", "checksums", "should", "be", "computed", "for", "the", "request", ".", "If", "the", "request", "requires", "checksums", "to", "be", "computed", "this", "will", "always", "return", "true", "otherwise", "it", "depends", "on", "whether", "{",...
c23e5f0edd150f8885267e5f7c8a564f8e6e8562
https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/services/s3.js#L325-L350
train
Compute checksums for the given request
[ 30522, 3853, 2097, 9006, 18780, 27635, 10603, 18163, 1006, 2128, 4160, 1007, 1063, 2065, 1006, 2023, 1012, 4012, 18780, 3085, 5403, 10603, 2819, 25918, 10708, 1031, 2128, 4160, 1012, 3169, 1033, 1007, 2709, 2995, 1025, 2065, 1006, 999, 2023...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
material-components/material-components-web
scripts/cp-pkgs.js
dtsBundler
function dtsBundler() { const packageDirectories = fs.readdirSync(D_TS_DIRECTORY); packageDirectories.forEach((packageDirectory) => { const packagePath = path.join(PACKAGES_DIRECTORY, packageDirectory); const name = JSON.parse(fs.readFileSync(path.join(packagePath, 'package.json'), 'utf8')).name; const main = path.join(D_TS_DIRECTORY, packageDirectory, './index.d.ts'); const isAllInOne = packageDirectory === ALL_IN_ONE_PACKAGE; const destBasename = isAllInOne ? packageDirectory : `mdc.${toCamelCase(packageDirectory.replace(/^mdc-/, ''))}`; const destFilename = path.join(packagePath, 'dist', `${destBasename}.d.ts`); console.log(`Writing UMD declarations in ${destFilename.replace(process.cwd() + '/', '')}`); dts.bundle({ name, main, out: destFilename, }); }); }
javascript
function dtsBundler() { const packageDirectories = fs.readdirSync(D_TS_DIRECTORY); packageDirectories.forEach((packageDirectory) => { const packagePath = path.join(PACKAGES_DIRECTORY, packageDirectory); const name = JSON.parse(fs.readFileSync(path.join(packagePath, 'package.json'), 'utf8')).name; const main = path.join(D_TS_DIRECTORY, packageDirectory, './index.d.ts'); const isAllInOne = packageDirectory === ALL_IN_ONE_PACKAGE; const destBasename = isAllInOne ? packageDirectory : `mdc.${toCamelCase(packageDirectory.replace(/^mdc-/, ''))}`; const destFilename = path.join(packagePath, 'dist', `${destBasename}.d.ts`); console.log(`Writing UMD declarations in ${destFilename.replace(process.cwd() + '/', '')}`); dts.bundle({ name, main, out: destFilename, }); }); }
[ "function", "dtsBundler", "(", ")", "{", "const", "packageDirectories", "=", "fs", ".", "readdirSync", "(", "D_TS_DIRECTORY", ")", ";", "packageDirectories", ".", "forEach", "(", "(", "packageDirectory", ")", "=>", "{", "const", "packagePath", "=", "path", "."...
Imports all files in index.d.ts and compiles a bundled .d.ts file for UMD bundles.
[ "Imports", "all", "files", "in", "index", ".", "d", ".", "ts", "and", "compiles", "a", "bundled", ".", "d", ".", "ts", "file", "for", "UMD", "bundles", "." ]
9f8b9ae5103ff86de4f6a5cb02e700d6eb851e5f
https://github.com/material-components/material-components-web/blob/9f8b9ae5103ff86de4f6a5cb02e700d6eb851e5f/scripts/cp-pkgs.js#L112-L129
train
Bundle all the UMD declarations in the package. json
[ 30522, 3853, 26718, 19022, 8630, 3917, 1006, 1007, 1063, 9530, 3367, 21972, 7442, 16761, 3111, 1027, 1042, 2015, 1012, 3191, 4305, 2869, 6038, 2278, 1006, 1040, 1035, 24529, 1035, 14176, 1007, 1025, 21972, 7442, 16761, 3111, 1012, 18921, 67...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/type/DateTimeBase.js
setConstraints
function setConstraints(oType, oConstraints) { var vNullable, iPrecision; oType.oConstraints = undefined; if (oConstraints) { vNullable = oConstraints.nullable; if (vNullable === false || vNullable === "false") { oType.oConstraints = {nullable : false}; } else if (vNullable !== undefined && vNullable !== true && vNullable !== "true") { Log.warning("Illegal nullable: " + vNullable, null, oType.getName()); } if (oConstraints.isDateOnly === true) { oType.oConstraints = oType.oConstraints || {}; oType.oConstraints.isDateOnly = true; } iPrecision = oConstraints.precision; if (iPrecision !== undefined) { if (iPrecision === Math.floor(iPrecision) && iPrecision >= 1 && iPrecision <= 12) { oType.oConstraints = oType.oConstraints || {}; oType.oConstraints.precision = iPrecision; } else if (iPrecision !== 0) { Log.warning("Illegal precision: " + iPrecision, null, oType.getName()); } // else: 0 is the default! } } oType._handleLocalizationChange(); }
javascript
function setConstraints(oType, oConstraints) { var vNullable, iPrecision; oType.oConstraints = undefined; if (oConstraints) { vNullable = oConstraints.nullable; if (vNullable === false || vNullable === "false") { oType.oConstraints = {nullable : false}; } else if (vNullable !== undefined && vNullable !== true && vNullable !== "true") { Log.warning("Illegal nullable: " + vNullable, null, oType.getName()); } if (oConstraints.isDateOnly === true) { oType.oConstraints = oType.oConstraints || {}; oType.oConstraints.isDateOnly = true; } iPrecision = oConstraints.precision; if (iPrecision !== undefined) { if (iPrecision === Math.floor(iPrecision) && iPrecision >= 1 && iPrecision <= 12) { oType.oConstraints = oType.oConstraints || {}; oType.oConstraints.precision = iPrecision; } else if (iPrecision !== 0) { Log.warning("Illegal precision: " + iPrecision, null, oType.getName()); } // else: 0 is the default! } } oType._handleLocalizationChange(); }
[ "function", "setConstraints", "(", "oType", ",", "oConstraints", ")", "{", "var", "vNullable", ",", "iPrecision", ";", "oType", ".", "oConstraints", "=", "undefined", ";", "if", "(", "oConstraints", ")", "{", "vNullable", "=", "oConstraints", ".", "nullable", ...
/* Sets the constraints. @param {sap.ui.model.odata.type.DateTimeBase} oType The type instance @param {object} [oConstraints] Constraints, see {@link #constructor}
[ "/", "*", "Sets", "the", "constraints", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/type/DateTimeBase.js#L76-L105
train
Sets constraints for the given type
[ 30522, 3853, 2275, 8663, 20528, 18447, 2015, 1006, 27178, 18863, 1010, 1051, 8663, 20528, 18447, 2015, 1007, 1063, 13075, 1058, 11231, 4571, 3468, 1010, 12997, 2890, 28472, 1025, 27178, 18863, 1012, 1051, 8663, 20528, 18447, 2015, 1027, 6151,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/SearchPage.controller.js
function () { var oView = this.getView(), // Collect all possible items from all lists aItems = [].concat( oView.byId("allList").getItems(), oView.byId("apiList").getItems(), oView.byId("documentationList").getItems(), oView.byId("samplesList").getItems() ), iLen = aItems.length, oItem; while (iLen--) { oItem = aItems[iLen]; // Access control lazy loading method if available if (oItem._getLinkSender) { // Set link href to allow open in new window functionality oItem._getLinkSender().setHref("#/" + oItem.getCustomData()[0].getValue()); } } }
javascript
function () { var oView = this.getView(), // Collect all possible items from all lists aItems = [].concat( oView.byId("allList").getItems(), oView.byId("apiList").getItems(), oView.byId("documentationList").getItems(), oView.byId("samplesList").getItems() ), iLen = aItems.length, oItem; while (iLen--) { oItem = aItems[iLen]; // Access control lazy loading method if available if (oItem._getLinkSender) { // Set link href to allow open in new window functionality oItem._getLinkSender().setHref("#/" + oItem.getCustomData()[0].getValue()); } } }
[ "function", "(", ")", "{", "var", "oView", "=", "this", ".", "getView", "(", ")", ",", "// Collect all possible items from all lists", "aItems", "=", "[", "]", ".", "concat", "(", "oView", ".", "byId", "(", "\"allList\"", ")", ".", "getItems", "(", ")", ...
Modify all search result links @private
[ "Modify", "all", "search", "result", "links" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/SearchPage.controller.js#L232-L252
train
This method is called when the list is empty
[ 30522, 3853, 1006, 1007, 1063, 13075, 1051, 8584, 1027, 2023, 1012, 2131, 8584, 1006, 1007, 1010, 1013, 1013, 8145, 2035, 2825, 5167, 2013, 2035, 7201, 9932, 18532, 2015, 1027, 1031, 1033, 1012, 9530, 11266, 1006, 1051, 8584, 1012, 2011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/WorkspaceManager.js
calcAvailableHeight
function calcAvailableHeight() { var availableHt = $windowContent.height(); $editorHolder.siblings().each(function (i, elem) { var $elem = $(elem); if ($elem.css("display") !== "none" && $elem.css("position") !== "absolute") { availableHt -= $elem.outerHeight(); } }); // Clip value to 0 (it could be negative if a panel wants more space than we have) return Math.max(availableHt, 0); }
javascript
function calcAvailableHeight() { var availableHt = $windowContent.height(); $editorHolder.siblings().each(function (i, elem) { var $elem = $(elem); if ($elem.css("display") !== "none" && $elem.css("position") !== "absolute") { availableHt -= $elem.outerHeight(); } }); // Clip value to 0 (it could be negative if a panel wants more space than we have) return Math.max(availableHt, 0); }
[ "function", "calcAvailableHeight", "(", ")", "{", "var", "availableHt", "=", "$windowContent", ".", "height", "(", ")", ";", "$editorHolder", ".", "siblings", "(", ")", ".", "each", "(", "function", "(", "i", ",", "elem", ")", "{", "var", "$elem", "=", ...
Calculates the available height for the full-size Editor (or the no-editor placeholder), accounting for the current size of all visible panels, toolbar, & status bar. @return {number}
[ "Calculates", "the", "available", "height", "for", "the", "full", "-", "size", "Editor", "(", "or", "the", "no", "-", "editor", "placeholder", ")", "accounting", "for", "the", "current", "size", "of", "all", "visible", "panels", "toolbar", "&", "status", "...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/WorkspaceManager.js#L76-L88
train
Calculate available height of the editor
[ 30522, 3853, 10250, 3540, 3567, 11733, 3468, 26036, 13900, 1006, 1007, 1063, 13075, 2800, 11039, 1027, 1002, 3332, 8663, 6528, 2102, 1012, 4578, 1006, 1007, 1025, 1002, 3559, 14528, 1012, 9504, 1006, 1007, 30524, 1004, 1004, 1002, 3449, 663...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ColorlibHQ/AdminLTE
plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js
function() { var ranges = [], r = this.getRange(), tmpRanges; if (r) { ranges.push(r); } if (this.unselectableClass && this.contain && r) { var uneditables = this.getOwnUneditables(), tmpRange; if (uneditables.length > 0) { for (var i = 0, imax = uneditables.length; i < imax; i++) { tmpRanges = []; for (var j = 0, jmax = ranges.length; j < jmax; j++) { if (ranges[j]) { switch (ranges[j].compareNode(uneditables[i])) { case 2: // all selection inside uneditable. remove break; case 3: //section begins before and ends after uneditable. spilt tmpRange = ranges[j].cloneRange(); tmpRange.setEndBefore(uneditables[i]); tmpRanges.push(tmpRange); tmpRange = ranges[j].cloneRange(); tmpRange.setStartAfter(uneditables[i]); tmpRanges.push(tmpRange); break; default: // in all other cases uneditable does not touch selection. dont modify tmpRanges.push(ranges[j]); } } ranges = tmpRanges; } } } } return ranges; }
javascript
function() { var ranges = [], r = this.getRange(), tmpRanges; if (r) { ranges.push(r); } if (this.unselectableClass && this.contain && r) { var uneditables = this.getOwnUneditables(), tmpRange; if (uneditables.length > 0) { for (var i = 0, imax = uneditables.length; i < imax; i++) { tmpRanges = []; for (var j = 0, jmax = ranges.length; j < jmax; j++) { if (ranges[j]) { switch (ranges[j].compareNode(uneditables[i])) { case 2: // all selection inside uneditable. remove break; case 3: //section begins before and ends after uneditable. spilt tmpRange = ranges[j].cloneRange(); tmpRange.setEndBefore(uneditables[i]); tmpRanges.push(tmpRange); tmpRange = ranges[j].cloneRange(); tmpRange.setStartAfter(uneditables[i]); tmpRanges.push(tmpRange); break; default: // in all other cases uneditable does not touch selection. dont modify tmpRanges.push(ranges[j]); } } ranges = tmpRanges; } } } } return ranges; }
[ "function", "(", ")", "{", "var", "ranges", "=", "[", "]", ",", "r", "=", "this", ".", "getRange", "(", ")", ",", "tmpRanges", ";", "if", "(", "r", ")", "{", "ranges", ".", "push", "(", "r", ")", ";", "}", "if", "(", "this", ".", "unselectabl...
Returns an array of ranges that belong only to this editable Needed as uneditable block in contenteditabel can split range into pieces If manipulating content reverse loop is usually needed as manipulation can shift subsequent ranges
[ "Returns", "an", "array", "of", "ranges", "that", "belong", "only", "to", "this", "editable", "Needed", "as", "uneditable", "block", "in", "contenteditabel", "can", "split", "range", "into", "pieces", "If", "manipulating", "content", "reverse", "loop", "is", "...
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L9434-L9474
train
Returns an array of ranges
[ 30522, 3853, 1006, 1007, 1063, 13075, 8483, 1027, 1031, 1033, 1010, 1054, 1027, 2023, 1012, 2131, 24388, 2063, 1006, 1007, 1010, 1056, 8737, 24388, 2229, 1025, 2065, 1006, 1054, 1007, 1063, 8483, 1012, 5245, 1006, 1054, 1007, 1025, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
grunt/config/connect.js
function(connect, options, middlewares) { // make sure to put the middleware after "cors" // if "watch" is enabled, there will be another livereload middleware in between middlewares.splice(grunt.option('watch') ? 3 : 2, 0, [ '/' + testsuiteName + '/resources/sap/ui/Global.js', function(req, res, next) { fs.readFile(sapUiCoreBasePath + '/src/sap/ui/Global.js', { encoding: 'utf-8' } , function(err, data) { if (err) { res.writeHead(404); res.end(); } else { res.writeHead(200, { 'Content-Type': 'application/javascript' }); data = data.replace(/(?:\$\{version\}|@version@)/g, grunt.config("package.version")); data = data.replace(/(?:\$\{buildtime\}|@buildtime@)/g, sapUiBuildtime); res.write(data); res.end(); } }); } ], [ '/' + testsuiteName + '/resources/sap-ui-version.json', function(req, res, next) { var version = grunt.config('package.version'); var sapUiVersionJson = { name: testsuiteName, version: version, buildTimestamp: sapUiBuildtime, scmRevision: '', gav: 'com.sap.openui5:testsuite:' + version, libraries: config.allLibraries.map(function(library) { return { name: library.name, version: version, buildTimestamp: sapUiBuildtime, scmRevision: '' }; }) }; var data = JSON.stringify(sapUiVersionJson, null, "\t"); res.writeHead(200, { 'Content-Type': 'application/json' }); res.write(data); res.end(); } ]); var oCspConfig = { allowDynamicPolicySelection: true, allowDynamicPolicyDefinition: true, defaultPolicyIsReportOnly: true, definedPolicies: { "sap-target-level-1": "default-src 'self'; " + "script-src 'self' 'unsafe-eval'; " + "style-src 'self' 'unsafe-inline'; " + "font-src 'self' data:; " + "img-src 'self' * data: blob:; " + "frame-src 'self' https: data: blob:; " + "child-src 'self' https: data: blob:; " + "connect-src 'self' https: wss:;", "sap-target-level-2": "default-src 'self'; " + "script-src 'self'; " + "style-src 'self' 'unsafe-inline'; " + "font-src 'self' data:; " + "img-src 'self' * data: blob:; " + "frame-src 'self' https: data: blob:; " + "child-src 'self' https: data: blob:; " + "connect-src 'self' https: wss:;" } }; middlewares.unshift(cspMiddleware("sap-ui-xx-csp-policy", oCspConfig)); // Make sure .xml files are served with Content-Type application/xml instead of text/xml // as it causes issues with OData / datajs. // The new tooling (https://github.com/SAP/ui5-tooling) already uses the correct header. middlewares.unshift(function(req, res, next) { var sFilePath = url.parse(req.url).pathname; if (sFilePath && sFilePath.endsWith(".xml")) { res.setHeader("Content-Type", "application/xml"); } next(); }); return middlewares; }
javascript
function(connect, options, middlewares) { // make sure to put the middleware after "cors" // if "watch" is enabled, there will be another livereload middleware in between middlewares.splice(grunt.option('watch') ? 3 : 2, 0, [ '/' + testsuiteName + '/resources/sap/ui/Global.js', function(req, res, next) { fs.readFile(sapUiCoreBasePath + '/src/sap/ui/Global.js', { encoding: 'utf-8' } , function(err, data) { if (err) { res.writeHead(404); res.end(); } else { res.writeHead(200, { 'Content-Type': 'application/javascript' }); data = data.replace(/(?:\$\{version\}|@version@)/g, grunt.config("package.version")); data = data.replace(/(?:\$\{buildtime\}|@buildtime@)/g, sapUiBuildtime); res.write(data); res.end(); } }); } ], [ '/' + testsuiteName + '/resources/sap-ui-version.json', function(req, res, next) { var version = grunt.config('package.version'); var sapUiVersionJson = { name: testsuiteName, version: version, buildTimestamp: sapUiBuildtime, scmRevision: '', gav: 'com.sap.openui5:testsuite:' + version, libraries: config.allLibraries.map(function(library) { return { name: library.name, version: version, buildTimestamp: sapUiBuildtime, scmRevision: '' }; }) }; var data = JSON.stringify(sapUiVersionJson, null, "\t"); res.writeHead(200, { 'Content-Type': 'application/json' }); res.write(data); res.end(); } ]); var oCspConfig = { allowDynamicPolicySelection: true, allowDynamicPolicyDefinition: true, defaultPolicyIsReportOnly: true, definedPolicies: { "sap-target-level-1": "default-src 'self'; " + "script-src 'self' 'unsafe-eval'; " + "style-src 'self' 'unsafe-inline'; " + "font-src 'self' data:; " + "img-src 'self' * data: blob:; " + "frame-src 'self' https: data: blob:; " + "child-src 'self' https: data: blob:; " + "connect-src 'self' https: wss:;", "sap-target-level-2": "default-src 'self'; " + "script-src 'self'; " + "style-src 'self' 'unsafe-inline'; " + "font-src 'self' data:; " + "img-src 'self' * data: blob:; " + "frame-src 'self' https: data: blob:; " + "child-src 'self' https: data: blob:; " + "connect-src 'self' https: wss:;" } }; middlewares.unshift(cspMiddleware("sap-ui-xx-csp-policy", oCspConfig)); // Make sure .xml files are served with Content-Type application/xml instead of text/xml // as it causes issues with OData / datajs. // The new tooling (https://github.com/SAP/ui5-tooling) already uses the correct header. middlewares.unshift(function(req, res, next) { var sFilePath = url.parse(req.url).pathname; if (sFilePath && sFilePath.endsWith(".xml")) { res.setHeader("Content-Type", "application/xml"); } next(); }); return middlewares; }
[ "function", "(", "connect", ",", "options", ",", "middlewares", ")", "{", "// make sure to put the middleware after \"cors\"", "// if \"watch\" is enabled, there will be another livereload middleware in between", "middlewares", ".", "splice", "(", "grunt", ".", "option", "(", "...
hacky solution to replace the "version" placeholder in sap/ui/Global.js to enable version comparison the file won't be cached
[ "hacky", "solution", "to", "replace", "the", "version", "placeholder", "in", "sap", "/", "ui", "/", "Global", ".", "js", "to", "enable", "version", "comparison", "the", "file", "won", "t", "be", "cached" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/grunt/config/connect.js#L49-L134
train
This function is called by the sap - ui - plugin to load the sap - ui - core. js and the sap - ui - version. json files
[ 30522, 3853, 1006, 7532, 1010, 7047, 1010, 2690, 8059, 2015, 1007, 1063, 1013, 1013, 2191, 2469, 2000, 2404, 1996, 2690, 8059, 2044, 1000, 2522, 2869, 1000, 1013, 1013, 2065, 1000, 3422, 1000, 2003, 9124, 1010, 2045, 2097, 2022, 2178, 112...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
bin/moleculer-runner.js
loadConfigFile
function loadConfigFile() { let filePath; if (flags.config) { filePath = path.isAbsolute(flags.config) ? flags.config : path.resolve(process.cwd(), flags.config); } if (!filePath && fs.existsSync(path.resolve(process.cwd(), "moleculer.config.js"))) { filePath = path.resolve(process.cwd(), "moleculer.config.js"); } if (!filePath && fs.existsSync(path.resolve(process.cwd(), "moleculer.config.json"))) { filePath = path.resolve(process.cwd(), "moleculer.config.json"); } if (filePath) { if (!fs.existsSync(filePath)) return Promise.reject(new Error(`Config file not found: ${filePath}`)); const ext = path.extname(filePath); switch (ext) { case ".json": case ".js": case ".ts": { configFile = require(filePath); break; } default: return Promise.reject(new Error(`Not supported file extension: ${ext}`)); } } }
javascript
function loadConfigFile() { let filePath; if (flags.config) { filePath = path.isAbsolute(flags.config) ? flags.config : path.resolve(process.cwd(), flags.config); } if (!filePath && fs.existsSync(path.resolve(process.cwd(), "moleculer.config.js"))) { filePath = path.resolve(process.cwd(), "moleculer.config.js"); } if (!filePath && fs.existsSync(path.resolve(process.cwd(), "moleculer.config.json"))) { filePath = path.resolve(process.cwd(), "moleculer.config.json"); } if (filePath) { if (!fs.existsSync(filePath)) return Promise.reject(new Error(`Config file not found: ${filePath}`)); const ext = path.extname(filePath); switch (ext) { case ".json": case ".js": case ".ts": { configFile = require(filePath); break; } default: return Promise.reject(new Error(`Not supported file extension: ${ext}`)); } } }
[ "function", "loadConfigFile", "(", ")", "{", "let", "filePath", ";", "if", "(", "flags", ".", "config", ")", "{", "filePath", "=", "path", ".", "isAbsolute", "(", "flags", ".", "config", ")", "?", "flags", ".", "config", ":", "path", ".", "resolve", ...
Load configuration file Try to load a configuration file in order to: - load file which is defined in CLI option with --config - try to load the `moleculer.config.js` file if exist in the cwd - try to load the `moleculer.config.json` file if exist in the cwd
[ "Load", "configuration", "file" ]
f95aadc2d61b0d0e3c643a43c3ed28bca6425cde
https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/bin/moleculer-runner.js#L125-L152
train
Load the config file
[ 30522, 3853, 7170, 8663, 8873, 25708, 9463, 1006, 1007, 1063, 2292, 5371, 15069, 1025, 2065, 1006, 9245, 1012, 9530, 8873, 2290, 1007, 1063, 5371, 15069, 1027, 4130, 1012, 18061, 5910, 4747, 10421, 1006, 9245, 1012, 9530, 8873, 2290, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js
reportAndThrowError
function reportAndThrowError(oMetaModel, sMessage, sDetails) { var oError = new Error(sDetails + ": " + sMessage); oMetaModel.oModel.reportError(sMessage, sODataMetaModel, oError); throw oError; }
javascript
function reportAndThrowError(oMetaModel, sMessage, sDetails) { var oError = new Error(sDetails + ": " + sMessage); oMetaModel.oModel.reportError(sMessage, sODataMetaModel, oError); throw oError; }
[ "function", "reportAndThrowError", "(", "oMetaModel", ",", "sMessage", ",", "sDetails", ")", "{", "var", "oError", "=", "new", "Error", "(", "sDetails", "+", "\": \"", "+", "sMessage", ")", ";", "oMetaModel", ".", "oModel", ".", "reportError", "(", "sMessage...
Reports an error with the given message and details and throws it. @param {sap.ui.model.odata.v4.ODataMetaModel} oMetaModel The OData metadata model @param {string} sMessage Error message @param {string} sDetails Error details @throws {Error}
[ "Reports", "an", "error", "with", "the", "given", "message", "and", "details", "and", "throws", "it", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L316-L321
train
Reports an error and throws it.
[ 30522, 3853, 3189, 5685, 2705, 10524, 2121, 29165, 1006, 18168, 12928, 5302, 9247, 1010, 15488, 7971, 4270, 1010, 17371, 12928, 12146, 1007, 1063, 13075, 1051, 2121, 29165, 1027, 2047, 7561, 1006, 17371, 12928, 12146, 1009, 1000, 1024, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ManagedObject.js
removeBinding
function removeBinding(oBindingInfo) { // Also tell the Control that the messages have been removed (if any) if (that.refreshDataState) { that.refreshDataState(sName, oBindingInfo.binding.getDataState()); } oBindingInfo.binding.detachChange(oBindingInfo.modelChangeHandler); if (oBindingInfo.modelRefreshHandler) { // only list bindings currently have a refresh handler attached oBindingInfo.binding.detachRefresh(oBindingInfo.modelRefreshHandler); } oBindingInfo.binding.detachEvents(oBindingInfo.events); oBindingInfo.binding.destroy(); // remove all binding related data from the binding info delete oBindingInfo.binding; delete oBindingInfo.modelChangeHandler; delete oBindingInfo.dataStateChangeHandler; delete oBindingInfo.modelRefreshHandler; }
javascript
function removeBinding(oBindingInfo) { // Also tell the Control that the messages have been removed (if any) if (that.refreshDataState) { that.refreshDataState(sName, oBindingInfo.binding.getDataState()); } oBindingInfo.binding.detachChange(oBindingInfo.modelChangeHandler); if (oBindingInfo.modelRefreshHandler) { // only list bindings currently have a refresh handler attached oBindingInfo.binding.detachRefresh(oBindingInfo.modelRefreshHandler); } oBindingInfo.binding.detachEvents(oBindingInfo.events); oBindingInfo.binding.destroy(); // remove all binding related data from the binding info delete oBindingInfo.binding; delete oBindingInfo.modelChangeHandler; delete oBindingInfo.dataStateChangeHandler; delete oBindingInfo.modelRefreshHandler; }
[ "function", "removeBinding", "(", "oBindingInfo", ")", "{", "// Also tell the Control that the messages have been removed (if any)", "if", "(", "that", ".", "refreshDataState", ")", "{", "that", ".", "refreshDataState", "(", "sName", ",", "oBindingInfo", ".", "binding", ...
/* Remove binding, detach all events and destroy binding object
[ "/", "*", "Remove", "binding", "detach", "all", "events", "and", "destroy", "binding", "object" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObject.js#L4207-L4224
train
Removes the binding from the control
[ 30522, 3853, 6366, 8428, 4667, 1006, 27885, 22254, 2075, 2378, 14876, 1007, 1063, 1013, 1013, 2036, 2425, 1996, 2491, 2008, 1996, 7696, 2031, 2042, 3718, 1006, 2065, 2151, 1007, 2065, 1006, 2008, 1012, 25416, 21898, 2850, 10230, 12259, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/changeHandler/BaseRename.js
function(oChange, oControl, mPropertyBag) { var oModifier = mPropertyBag.modifier; var sPropertyName = mRenameSettings.propertyName; var oChangeDefinition = oChange.getDefinition(); var sText = oChangeDefinition.texts[mRenameSettings.changePropertyName]; var sValue = sText.value; if (oChangeDefinition.texts && sText && typeof (sValue) === "string") { oChange.setRevertData(oModifier.getPropertyBindingOrProperty(oControl, sPropertyName)); oModifier.setPropertyBindingOrProperty(oControl, sPropertyName, sValue); return true; } else { Utils.log.error("Change does not contain sufficient information to be applied: [" + oChangeDefinition.layer + "]" + oChangeDefinition.namespace + "/" + oChangeDefinition.fileName + "." + oChangeDefinition.fileType); //however subsequent changes should be applied } }
javascript
function(oChange, oControl, mPropertyBag) { var oModifier = mPropertyBag.modifier; var sPropertyName = mRenameSettings.propertyName; var oChangeDefinition = oChange.getDefinition(); var sText = oChangeDefinition.texts[mRenameSettings.changePropertyName]; var sValue = sText.value; if (oChangeDefinition.texts && sText && typeof (sValue) === "string") { oChange.setRevertData(oModifier.getPropertyBindingOrProperty(oControl, sPropertyName)); oModifier.setPropertyBindingOrProperty(oControl, sPropertyName, sValue); return true; } else { Utils.log.error("Change does not contain sufficient information to be applied: [" + oChangeDefinition.layer + "]" + oChangeDefinition.namespace + "/" + oChangeDefinition.fileName + "." + oChangeDefinition.fileType); //however subsequent changes should be applied } }
[ "function", "(", "oChange", ",", "oControl", ",", "mPropertyBag", ")", "{", "var", "oModifier", "=", "mPropertyBag", ".", "modifier", ";", "var", "sPropertyName", "=", "mRenameSettings", ".", "propertyName", ";", "var", "oChangeDefinition", "=", "oChange", ".", ...
Renames a control. @param {sap.ui.fl.Change} oChange change wrapper object with instructions to be applied on the control map @param {sap.ui.core.Control} oControl Control that matches the change selector for applying the change @param {object} mPropertyBag property bag @param {object} mPropertyBag.modifier modifier for the controls @returns {boolean} true if successful @public
[ "Renames", "a", "control", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/changeHandler/BaseRename.js#L46-L61
train
Applies a rename change to the control
[ 30522, 3853, 1006, 28166, 22043, 1010, 1051, 8663, 13181, 2140, 1010, 6131, 18981, 15010, 16078, 1007, 1063, 13075, 18168, 7716, 18095, 1027, 6131, 18981, 15010, 16078, 1012, 16913, 18095, 1025, 13075, 11867, 18981, 15010, 18442, 1027, 2720, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/AutoUpdate/main.js
showErrorMessage
function showErrorMessage(message) { var analyticsDescriptionMessage = ""; switch (message) { case _nodeErrorMessages.UPDATEDIR_READ_FAILED: analyticsDescriptionMessage = "Update directory could not be read."; break; case _nodeErrorMessages.UPDATEDIR_CLEAN_FAILED: analyticsDescriptionMessage = "Update directory could not be cleaned."; break; } console.log("AutoUpdate : Clean-up failed! Reason : " + analyticsDescriptionMessage + ".\n"); HealthLogger.sendAnalyticsData( autoUpdateEventNames.AUTOUPDATE_CLEANUP_FAILED, "autoUpdate", "cleanUp", "fail", analyticsDescriptionMessage ); }
javascript
function showErrorMessage(message) { var analyticsDescriptionMessage = ""; switch (message) { case _nodeErrorMessages.UPDATEDIR_READ_FAILED: analyticsDescriptionMessage = "Update directory could not be read."; break; case _nodeErrorMessages.UPDATEDIR_CLEAN_FAILED: analyticsDescriptionMessage = "Update directory could not be cleaned."; break; } console.log("AutoUpdate : Clean-up failed! Reason : " + analyticsDescriptionMessage + ".\n"); HealthLogger.sendAnalyticsData( autoUpdateEventNames.AUTOUPDATE_CLEANUP_FAILED, "autoUpdate", "cleanUp", "fail", analyticsDescriptionMessage ); }
[ "function", "showErrorMessage", "(", "message", ")", "{", "var", "analyticsDescriptionMessage", "=", "\"\"", ";", "switch", "(", "message", ")", "{", "case", "_nodeErrorMessages", ".", "UPDATEDIR_READ_FAILED", ":", "analyticsDescriptionMessage", "=", "\"Update directory...
Handles the error messages from Node, in a popup displayed to the user. @param {string} message - error string
[ "Handles", "the", "error", "messages", "from", "Node", "in", "a", "popup", "displayed", "to", "the", "user", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/main.js#L778-L797
train
Show an error message
[ 30522, 3853, 6457, 29165, 7834, 3736, 3351, 1006, 4471, 1007, 1063, 13075, 25095, 6155, 23235, 3258, 7834, 3736, 3351, 1027, 1000, 1000, 1025, 6942, 1006, 4471, 1007, 1063, 2553, 1035, 13045, 2121, 29165, 7834, 3736, 8449, 1012, 7172, 4313,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
wangfupeng1988/wangEditor
src/js/menus/link/index.js
function (text, link) { const editor = this.editor const config = editor.config const linkCheck = config.linkCheck let checkResult = true // 默认为 true if (linkCheck && typeof linkCheck === 'function') { checkResult = linkCheck(text, link) } if (checkResult === true) { editor.cmd.do('insertHTML', `<a href="${link}" target="_blank">${text}</a>`) } else { alert(checkResult) } }
javascript
function (text, link) { const editor = this.editor const config = editor.config const linkCheck = config.linkCheck let checkResult = true // 默认为 true if (linkCheck && typeof linkCheck === 'function') { checkResult = linkCheck(text, link) } if (checkResult === true) { editor.cmd.do('insertHTML', `<a href="${link}" target="_blank">${text}</a>`) } else { alert(checkResult) } }
[ "function", "(", "text", ",", "link", ")", "{", "const", "editor", "=", "this", ".", "editor", "const", "config", "=", "editor", ".", "config", "const", "linkCheck", "=", "config", ".", "linkCheck", "let", "checkResult", "=", "true", "// 默认为 true", "if", ...
插入链接
[ "插入链接" ]
b77696f5e81c8ec13d9d341252d6b9fa8a22db18
https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/menus/link/index.js#L135-L148
train
Link Text
[ 30522, 3853, 1006, 3793, 1010, 4957, 1007, 1063, 9530, 3367, 3559, 1027, 2023, 1012, 3559, 9530, 3367, 9530, 8873, 2290, 1027, 3559, 1012, 9530, 8873, 2290, 9530, 3367, 4957, 5403, 3600, 1027, 9530, 8873, 2290, 1012, 4957, 5403, 3600, 229...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/spaced-comment.js
checkCommentForSpace
function checkCommentForSpace(node) { const type = node.type.toLowerCase(), rule = styleRules[type], commentIdentifier = type === "block" ? "/*" : "//"; // Ignores empty comments. if (node.value.length === 0) { return; } const beginMatch = rule.beginRegex.exec(node.value); const endMatch = rule.endRegex.exec(node.value); // Checks. if (requireSpace) { if (!beginMatch) { const hasMarker = rule.markers.exec(node.value); const marker = hasMarker ? commentIdentifier + hasMarker[0] : commentIdentifier; if (rule.hasExceptions) { reportBegin(node, "Expected exception block, space or tab after '{{refChar}}' in comment.", hasMarker, marker); } else { reportBegin(node, "Expected space or tab after '{{refChar}}' in comment.", hasMarker, marker); } } if (balanced && type === "block" && !endMatch) { reportEnd(node, "Expected space or tab before '*/' in comment."); } } else { if (beginMatch) { if (!beginMatch[1]) { reportBegin(node, "Unexpected space or tab after '{{refChar}}' in comment.", beginMatch, commentIdentifier); } else { reportBegin(node, "Unexpected space or tab after marker ({{refChar}}) in comment.", beginMatch, beginMatch[1]); } } if (balanced && type === "block" && endMatch) { reportEnd(node, "Unexpected space or tab before '*/' in comment.", endMatch); } } }
javascript
function checkCommentForSpace(node) { const type = node.type.toLowerCase(), rule = styleRules[type], commentIdentifier = type === "block" ? "/*" : "//"; // Ignores empty comments. if (node.value.length === 0) { return; } const beginMatch = rule.beginRegex.exec(node.value); const endMatch = rule.endRegex.exec(node.value); // Checks. if (requireSpace) { if (!beginMatch) { const hasMarker = rule.markers.exec(node.value); const marker = hasMarker ? commentIdentifier + hasMarker[0] : commentIdentifier; if (rule.hasExceptions) { reportBegin(node, "Expected exception block, space or tab after '{{refChar}}' in comment.", hasMarker, marker); } else { reportBegin(node, "Expected space or tab after '{{refChar}}' in comment.", hasMarker, marker); } } if (balanced && type === "block" && !endMatch) { reportEnd(node, "Expected space or tab before '*/' in comment."); } } else { if (beginMatch) { if (!beginMatch[1]) { reportBegin(node, "Unexpected space or tab after '{{refChar}}' in comment.", beginMatch, commentIdentifier); } else { reportBegin(node, "Unexpected space or tab after marker ({{refChar}}) in comment.", beginMatch, beginMatch[1]); } } if (balanced && type === "block" && endMatch) { reportEnd(node, "Unexpected space or tab before '*/' in comment.", endMatch); } } }
[ "function", "checkCommentForSpace", "(", "node", ")", "{", "const", "type", "=", "node", ".", "type", ".", "toLowerCase", "(", ")", ",", "rule", "=", "styleRules", "[", "type", "]", ",", "commentIdentifier", "=", "type", "===", "\"block\"", "?", "\"/*\"", ...
Reports a given comment if it's invalid. @param {ASTNode} node - a comment node to check. @returns {void}
[ "Reports", "a", "given", "comment", "if", "it", "s", "invalid", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/spaced-comment.js#L323-L365
train
Checks if a comment is a space or tab.
[ 30522, 3853, 4638, 9006, 3672, 29278, 23058, 1006, 13045, 1007, 1063, 9530, 3367, 2828, 1027, 13045, 1012, 2828, 1012, 2000, 27663, 18992, 3366, 1006, 1007, 1010, 3627, 1027, 2806, 6820, 4244, 1031, 2828, 1033, 1010, 7615, 5178, 16778, 8873...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
moment/luxon
src/impl/regexParser.js
combineRegexes
function combineRegexes(...regexes) { const full = regexes.reduce((f, r) => f + r.source, ""); return RegExp(`^${full}$`); }
javascript
function combineRegexes(...regexes) { const full = regexes.reduce((f, r) => f + r.source, ""); return RegExp(`^${full}$`); }
[ "function", "combineRegexes", "(", "...", "regexes", ")", "{", "const", "full", "=", "regexes", ".", "reduce", "(", "(", "f", ",", "r", ")", "=>", "f", "+", "r", ".", "source", ",", "\"\"", ")", ";", "return", "RegExp", "(", "`", "${", "full", "}...
/* This file handles parsing for well-specified formats. Here's how it works: Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match. An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence. Extractors can take a "cursor" representing the offset in the match to look at. This makes it easy to combine extractors. combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions. Some extractions are super dumb and simpleParse and fromStrings help DRY them.
[ "/", "*", "This", "file", "handles", "parsing", "for", "well", "-", "specified", "formats", ".", "Here", "s", "how", "it", "works", ":", "Two", "things", "go", "into", "parsing", ":", "a", "regex", "to", "match", "with", "and", "an", "extractor", "to",...
236f2badea297ee73421aa39a83e06177c1be6d0
https://github.com/moment/luxon/blob/236f2badea297ee73421aa39a83e06177c1be6d0/src/impl/regexParser.js#L16-L19
train
Combine multiple regular expressions into one
[ 30522, 3853, 11506, 2890, 3351, 20156, 1006, 1012, 1012, 1012, 19723, 10288, 2229, 1007, 1063, 9530, 3367, 2440, 1027, 19723, 10288, 2229, 1012, 5547, 1006, 1006, 1042, 1010, 1054, 1007, 1027, 1028, 1042, 1009, 1054, 1012, 3120, 1010, 1000,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
third_party/closure/goog/module/modulemanager.js
function(requestedId) { var requestedDeps = this.getNotYetLoadedTransitiveDepIds_(requestedId); return goog.array.some(failedIds, function(id) { return goog.array.contains(requestedDeps, id); }); }
javascript
function(requestedId) { var requestedDeps = this.getNotYetLoadedTransitiveDepIds_(requestedId); return goog.array.some(failedIds, function(id) { return goog.array.contains(requestedDeps, id); }); }
[ "function", "(", "requestedId", ")", "{", "var", "requestedDeps", "=", "this", ".", "getNotYetLoadedTransitiveDepIds_", "(", "requestedId", ")", ";", "return", "goog", ".", "array", ".", "some", "(", "failedIds", ",", "function", "(", "id", ")", "{", "return...
Returns true if the requestedId has dependencies on the modules that just failed to load. @param {string} requestedId The module to check for dependencies. @return {boolean} True if the module depends on failed modules.
[ "Returns", "true", "if", "the", "requestedId", "has", "dependencies", "on", "the", "modules", "that", "just", "failed", "to", "load", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/closure/goog/module/modulemanager.js#L1220-L1226
train
Returns true if the requested id is not a dependency of any other dependency.
[ 30522, 3853, 1006, 7303, 3593, 1007, 1063, 13075, 7303, 3207, 4523, 1027, 2023, 1012, 2131, 17048, 6672, 19646, 10441, 5732, 6494, 3619, 13043, 3207, 23267, 2015, 1035, 1006, 7303, 3593, 1007, 1025, 2709, 27571, 2290, 1012, 9140, 1012, 2070...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
BrainJS/brain.js
dist/recurrent/matrix/add.js
add
function add(product, left, right) { for (var i = 0; i < left.weights.length; i++) { product.weights[i] = left.weights[i] + right.weights[i]; product.deltas[i] = 0; } }
javascript
function add(product, left, right) { for (var i = 0; i < left.weights.length; i++) { product.weights[i] = left.weights[i] + right.weights[i]; product.deltas[i] = 0; } }
[ "function", "add", "(", "product", ",", "left", ",", "right", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "left", ".", "weights", ".", "length", ";", "i", "++", ")", "{", "product", ".", "weights", "[", "i", "]", "=", "left", "...
add {left} and {right} matrix weights into {into} @param {Matrix} product @param {Matrix} left @param {Matrix} right
[ "add", "{", "left", "}", "and", "{", "right", "}", "matrix", "weights", "into", "{", "into", "}" ]
ab09bfc74a0d29d4731dcbdebfa17aeba7f7b1ef
https://github.com/BrainJS/brain.js/blob/ab09bfc74a0d29d4731dcbdebfa17aeba7f7b1ef/dist/recurrent/matrix/add.js#L13-L18
train
Adds two centric terms
[ 30522, 3853, 5587, 1006, 4031, 1010, 2187, 1010, 2157, 1007, 1063, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 1026, 2187, 1012, 15871, 1012, 3091, 1025, 1045, 1009, 1009, 1007, 1063, 4031, 1012, 15871, 1031, 1045, 1033, 1027, 2187, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jquery/jquery
src/css/finalPropName.js
finalPropName
function finalPropName( name ) { var final = vendorProps[ name ]; if ( final ) { return final; } if ( name in emptyStyle ) { return name; } return vendorProps[ name ] = vendorPropName( name ) || name; }
javascript
function finalPropName( name ) { var final = vendorProps[ name ]; if ( final ) { return final; } if ( name in emptyStyle ) { return name; } return vendorProps[ name ] = vendorPropName( name ) || name; }
[ "function", "finalPropName", "(", "name", ")", "{", "var", "final", "=", "vendorProps", "[", "name", "]", ";", "if", "(", "final", ")", "{", "return", "final", ";", "}", "if", "(", "name", "in", "emptyStyle", ")", "{", "return", "name", ";", "}", "...
Return a potentially-mapped vendor prefixed property
[ "Return", "a", "potentially", "-", "mapped", "vendor", "prefixed", "property" ]
ccbd6b93424cbdbf86f07a86c2e55cbab497d7a3
https://github.com/jquery/jquery/blob/ccbd6b93424cbdbf86f07a86c2e55cbab497d7a3/src/css/finalPropName.js#L27-L37
train
Returns the final property name
[ 30522, 3853, 2345, 21572, 2361, 18442, 1006, 2171, 1007, 1063, 13075, 2345, 1027, 21431, 21572, 4523, 1031, 2171, 1033, 1025, 2065, 1006, 2345, 1007, 1063, 2709, 2345, 1025, 1065, 2065, 1006, 2171, 1999, 4064, 21756, 2571, 1007, 1063, 2709,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ecomfe/zrender
src/animation/Animator.js
function (forwardToLast) { var clipList = this._clipList; var animation = this.animation; for (var i = 0; i < clipList.length; i++) { var clip = clipList[i]; if (forwardToLast) { // Move to last frame before stop clip.onframe(this._target, 1); } animation && animation.removeClip(clip); } clipList.length = 0; }
javascript
function (forwardToLast) { var clipList = this._clipList; var animation = this.animation; for (var i = 0; i < clipList.length; i++) { var clip = clipList[i]; if (forwardToLast) { // Move to last frame before stop clip.onframe(this._target, 1); } animation && animation.removeClip(clip); } clipList.length = 0; }
[ "function", "(", "forwardToLast", ")", "{", "var", "clipList", "=", "this", ".", "_clipList", ";", "var", "animation", "=", "this", ".", "animation", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "clipList", ".", "length", ";", "i", "++", "...
停止动画 @param {boolean} forwardToLast If move to last frame before stop
[ "停止动画" ]
30321b57cba3149c30eacb0c1e18276f0f001b9f
https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/animation/Animator.js#L610-L622
train
Stop the dialog
[ 30522, 3853, 1006, 2830, 3406, 8523, 2102, 1007, 1063, 13075, 12528, 9863, 1027, 2023, 1012, 1035, 12528, 9863, 1025, 13075, 7284, 1027, 2023, 1012, 7284, 1025, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 1026, 12528, 9863, 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...
google/code-prettify
js-modules/numberLines.js
numberLines
function numberLines(node, startLineNum, isPreformatted) { var nocode = /(?:^|\s)nocode(?:\s|$)/; var lineBreak = /\r\n?|\n/; var document = node.ownerDocument; var li = document.createElement('li'); while (node.firstChild) { li.appendChild(node.firstChild); } // An array of lines. We split below, so this is initialized to one // un-split line. var listItems = [li]; function walk(node) { var type = node.nodeType; if (type == 1 && !nocode.test(node.className)) { // Element if ('br' === node.nodeName.toLowerCase()) { breakAfter(node); // Discard the <BR> since it is now flush against a </LI>. if (node.parentNode) { node.parentNode.removeChild(node); } } else { for (var child = node.firstChild; child; child = child.nextSibling) { walk(child); } } } else if ((type == 3 || type == 4) && isPreformatted) { // Text var text = node.nodeValue; var match = text.match(lineBreak); if (match) { var firstLine = text.substring(0, match.index); node.nodeValue = firstLine; var tail = text.substring(match.index + match[0].length); if (tail) { var parent = node.parentNode; parent.insertBefore( document.createTextNode(tail), node.nextSibling); } breakAfter(node); if (!firstLine) { // Don't leave blank text nodes in the DOM. node.parentNode.removeChild(node); } } } } // Split a line after the given node. function breakAfter(lineEndNode) { // If there's nothing to the right, then we can skip ending the line // here, and move root-wards since splitting just before an end-tag // would require us to create a bunch of empty copies. while (!lineEndNode.nextSibling) { lineEndNode = lineEndNode.parentNode; if (!lineEndNode) { return; } } function breakLeftOf(limit, copy) { // Clone shallowly if this node needs to be on both sides of the break. var rightSide = copy ? limit.cloneNode(false) : limit; var parent = limit.parentNode; if (parent) { // We clone the parent chain. // This helps us resurrect important styling elements that cross lines. // E.g. in <i>Foo<br>Bar</i> // should be rewritten to <li><i>Foo</i></li><li><i>Bar</i></li>. var parentClone = breakLeftOf(parent, 1); // Move the clone and everything to the right of the original // onto the cloned parent. var next = limit.nextSibling; parentClone.appendChild(rightSide); for (var sibling = next; sibling; sibling = next) { next = sibling.nextSibling; parentClone.appendChild(sibling); } } return rightSide; } var copiedListItem = breakLeftOf(lineEndNode.nextSibling, 0); // Walk the parent chain until we reach an unattached LI. for (var parent; // Check nodeType since IE invents document fragments. (parent = copiedListItem.parentNode) && parent.nodeType === 1;) { copiedListItem = parent; } // Put it on the list of lines for later processing. listItems.push(copiedListItem); } // Split lines while there are lines left to split. for (var i = 0; // Number of lines that have been split so far. i < listItems.length; // length updated by breakAfter calls. ++i) { walk(listItems[i]); } // Make sure numeric indices show correctly. if (startLineNum === (startLineNum|0)) { listItems[0].setAttribute('value', startLineNum); } var ol = document.createElement('ol'); ol.className = 'linenums'; var offset = Math.max(0, ((startLineNum - 1 /* zero index */)) | 0) || 0; for (var i = 0, n = listItems.length; i < n; ++i) { li = listItems[i]; // Stick a class on the LIs so that stylesheets can // color odd/even rows, or any other row pattern that // is co-prime with 10. li.className = 'L' + ((i + offset) % 10); if (!li.firstChild) { li.appendChild(document.createTextNode('\xA0')); } ol.appendChild(li); } node.appendChild(ol); }
javascript
function numberLines(node, startLineNum, isPreformatted) { var nocode = /(?:^|\s)nocode(?:\s|$)/; var lineBreak = /\r\n?|\n/; var document = node.ownerDocument; var li = document.createElement('li'); while (node.firstChild) { li.appendChild(node.firstChild); } // An array of lines. We split below, so this is initialized to one // un-split line. var listItems = [li]; function walk(node) { var type = node.nodeType; if (type == 1 && !nocode.test(node.className)) { // Element if ('br' === node.nodeName.toLowerCase()) { breakAfter(node); // Discard the <BR> since it is now flush against a </LI>. if (node.parentNode) { node.parentNode.removeChild(node); } } else { for (var child = node.firstChild; child; child = child.nextSibling) { walk(child); } } } else if ((type == 3 || type == 4) && isPreformatted) { // Text var text = node.nodeValue; var match = text.match(lineBreak); if (match) { var firstLine = text.substring(0, match.index); node.nodeValue = firstLine; var tail = text.substring(match.index + match[0].length); if (tail) { var parent = node.parentNode; parent.insertBefore( document.createTextNode(tail), node.nextSibling); } breakAfter(node); if (!firstLine) { // Don't leave blank text nodes in the DOM. node.parentNode.removeChild(node); } } } } // Split a line after the given node. function breakAfter(lineEndNode) { // If there's nothing to the right, then we can skip ending the line // here, and move root-wards since splitting just before an end-tag // would require us to create a bunch of empty copies. while (!lineEndNode.nextSibling) { lineEndNode = lineEndNode.parentNode; if (!lineEndNode) { return; } } function breakLeftOf(limit, copy) { // Clone shallowly if this node needs to be on both sides of the break. var rightSide = copy ? limit.cloneNode(false) : limit; var parent = limit.parentNode; if (parent) { // We clone the parent chain. // This helps us resurrect important styling elements that cross lines. // E.g. in <i>Foo<br>Bar</i> // should be rewritten to <li><i>Foo</i></li><li><i>Bar</i></li>. var parentClone = breakLeftOf(parent, 1); // Move the clone and everything to the right of the original // onto the cloned parent. var next = limit.nextSibling; parentClone.appendChild(rightSide); for (var sibling = next; sibling; sibling = next) { next = sibling.nextSibling; parentClone.appendChild(sibling); } } return rightSide; } var copiedListItem = breakLeftOf(lineEndNode.nextSibling, 0); // Walk the parent chain until we reach an unattached LI. for (var parent; // Check nodeType since IE invents document fragments. (parent = copiedListItem.parentNode) && parent.nodeType === 1;) { copiedListItem = parent; } // Put it on the list of lines for later processing. listItems.push(copiedListItem); } // Split lines while there are lines left to split. for (var i = 0; // Number of lines that have been split so far. i < listItems.length; // length updated by breakAfter calls. ++i) { walk(listItems[i]); } // Make sure numeric indices show correctly. if (startLineNum === (startLineNum|0)) { listItems[0].setAttribute('value', startLineNum); } var ol = document.createElement('ol'); ol.className = 'linenums'; var offset = Math.max(0, ((startLineNum - 1 /* zero index */)) | 0) || 0; for (var i = 0, n = listItems.length; i < n; ++i) { li = listItems[i]; // Stick a class on the LIs so that stylesheets can // color odd/even rows, or any other row pattern that // is co-prime with 10. li.className = 'L' + ((i + offset) % 10); if (!li.firstChild) { li.appendChild(document.createTextNode('\xA0')); } ol.appendChild(li); } node.appendChild(ol); }
[ "function", "numberLines", "(", "node", ",", "startLineNum", ",", "isPreformatted", ")", "{", "var", "nocode", "=", "/", "(?:^|\\s)nocode(?:\\s|$)", "/", ";", "var", "lineBreak", "=", "/", "\\r\\n?|\\n", "/", ";", "var", "document", "=", "node", ".", "ownerD...
Given a DOM subtree, wraps it in a list, and puts each line into its own list item. @param {Node} node modified in place. Its content is pulled into an HTMLOListElement, and each line is moved into a separate list item. This requires cloning elements, so the input might not have unique IDs after numbering. @param {number|null|boolean} startLineNum If truthy, coerced to an integer which is the 1-indexed line number of the first line of code. The number of the first line will be attached to the list. @param {boolean} isPreformatted true iff white-space in text nodes should be treated as significant.
[ "Given", "a", "DOM", "subtree", "wraps", "it", "in", "a", "list", "and", "puts", "each", "line", "into", "its", "own", "list", "item", "." ]
e14ed1c3c40f78fca2a11af4cb0fa251f6f997fc
https://github.com/google/code-prettify/blob/e14ed1c3c40f78fca2a11af4cb0fa251f6f997fc/js-modules/numberLines.js#L16-L137
train
Returns an array of lines from the given node.
[ 30522, 3853, 2193, 12735, 1006, 13045, 1010, 2707, 4179, 19172, 1010, 2003, 28139, 14192, 19321, 2098, 1007, 1063, 13075, 2053, 16044, 1027, 1013, 30524, 5622, 1027, 6254, 1012, 3443, 12260, 3672, 1006, 1005, 5622, 1005, 1007, 1025, 2096, 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/model/odata/v4/lib/_Helper.js
function (jqXHR, sMessage, sRequestUrl, sResourcePath) { var sBody = jqXHR.responseText, sContentType = jqXHR.getResponseHeader("Content-Type"), oResult = new Error(sMessage + ": " + jqXHR.status + " " + jqXHR.statusText); oResult.status = jqXHR.status; oResult.statusText = jqXHR.statusText; oResult.requestUrl = sRequestUrl; oResult.resourcePath = sResourcePath; if (jqXHR.status === 0) { oResult.message = "Network error"; return oResult; } if (sContentType) { sContentType = sContentType.split(";")[0]; } if (jqXHR.status === 412) { oResult.isConcurrentModification = true; } if (sContentType === "application/json") { try { // "The error response MUST be a single JSON object. This object MUST have a // single name/value pair named error. The value must be a JSON object." oResult.error = JSON.parse(sBody).error; oResult.message = oResult.error.message; if (typeof oResult.message === "object") { // oResult.message is in OData V2 an object containing the human readable // error message in the property value oResult.message = oResult.error.message.value; } } catch (e) { Log.warning(e.toString(), sBody, sClassName); } } else if (sContentType === "text/plain") { oResult.message = sBody; } return oResult; }
javascript
function (jqXHR, sMessage, sRequestUrl, sResourcePath) { var sBody = jqXHR.responseText, sContentType = jqXHR.getResponseHeader("Content-Type"), oResult = new Error(sMessage + ": " + jqXHR.status + " " + jqXHR.statusText); oResult.status = jqXHR.status; oResult.statusText = jqXHR.statusText; oResult.requestUrl = sRequestUrl; oResult.resourcePath = sResourcePath; if (jqXHR.status === 0) { oResult.message = "Network error"; return oResult; } if (sContentType) { sContentType = sContentType.split(";")[0]; } if (jqXHR.status === 412) { oResult.isConcurrentModification = true; } if (sContentType === "application/json") { try { // "The error response MUST be a single JSON object. This object MUST have a // single name/value pair named error. The value must be a JSON object." oResult.error = JSON.parse(sBody).error; oResult.message = oResult.error.message; if (typeof oResult.message === "object") { // oResult.message is in OData V2 an object containing the human readable // error message in the property value oResult.message = oResult.error.message.value; } } catch (e) { Log.warning(e.toString(), sBody, sClassName); } } else if (sContentType === "text/plain") { oResult.message = sBody; } return oResult; }
[ "function", "(", "jqXHR", ",", "sMessage", ",", "sRequestUrl", ",", "sResourcePath", ")", "{", "var", "sBody", "=", "jqXHR", ".", "responseText", ",", "sContentType", "=", "jqXHR", ".", "getResponseHeader", "(", "\"Content-Type\"", ")", ",", "oResult", "=", ...
Returns an <code>Error</code> instance from a jQuery XHR wrapper. @param {object} jqXHR A jQuery XHR wrapper as received by a failure handler @param {function} jqXHR.getResponseHeader Used to access the HTTP response header "Content-Type" @param {string} jqXHR.responseText HTTP response body, sometimes in JSON format ("Content-Type" : "application/json") according to OData "19 Error Response" specification, sometimes plain text ("Content-Type" : "text/plain"); other formats are ignored @param {number} jqXHR.status HTTP status code @param {string} jqXHR.statusText HTTP status text @param {string} sMessage The message for the <code>Error</code> instance; code and status text of the HTTP error are appended @param {string} [sRequestUrl] The request URL @param {string} [sResourcePath] The path by which this resource has originally been requested @returns {Error} An <code>Error</code> instance with the following properties: <ul> <li><code>error</code>: The "error" value from the OData V4 error response JSON object (if available) <li><code>isConcurrentModification</code>: <code>true</code> In case of a concurrent modification detected via ETags (i.e. HTTP status code 412) <li><code>message</code>: Error message <li><code>requestUrl</code>: The request URL <li><code>resourcePath</code>: The path by which this resource has originally been requested <li><code>status</code>: HTTP status code <li><code>statusText</code>: (optional) HTTP status text </ul> @see <a href= "http://docs.oasis-open.org/odata/odata-json-format/v4.0/os/odata-json-format-v4.0-os.html" >"19 Error Response"</a>
[ "Returns", "an", "<code", ">", "Error<", "/", "code", ">", "instance", "from", "a", "jQuery", "XHR", "wrapper", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L232-L270
train
This function is called when an error is received from the server.
[ 30522, 3853, 1006, 1046, 4160, 2595, 8093, 1010, 15488, 7971, 4270, 1010, 5034, 2063, 15500, 3126, 2140, 1010, 5034, 2229, 8162, 3401, 15069, 1007, 1063, 13075, 24829, 7716, 2100, 1027, 1046, 4160, 2595, 8093, 1012, 3433, 18209, 1010, 8040,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js
function (bExplicitClose) { if (this.getPopover()) { if (bExplicitClose) { this.getPopover(true).close(); this.getPopover(false).close(); } // deletes the overflow button if there is one if (this.getProperty("buttons").length > this.getProperty("maxButtonsDisplayed")) { this.setProperty("buttons", this.getProperty("buttons").splice(0, this.getProperty("buttons").length - 1)); this.getFlexbox().removeItem(this.getButtons().length - 1); } } return this; }
javascript
function (bExplicitClose) { if (this.getPopover()) { if (bExplicitClose) { this.getPopover(true).close(); this.getPopover(false).close(); } // deletes the overflow button if there is one if (this.getProperty("buttons").length > this.getProperty("maxButtonsDisplayed")) { this.setProperty("buttons", this.getProperty("buttons").splice(0, this.getProperty("buttons").length - 1)); this.getFlexbox().removeItem(this.getButtons().length - 1); } } return this; }
[ "function", "(", "bExplicitClose", ")", "{", "if", "(", "this", ".", "getPopover", "(", ")", ")", "{", "if", "(", "bExplicitClose", ")", "{", "this", ".", "getPopover", "(", "true", ")", ".", "close", "(", ")", ";", "this", ".", "getPopover", "(", ...
Closes the ContextMenu. @param {boolean} bExplicitClose true if the popover has to be closed explicitly from the contextMenu. Otherwhise the closing is handled by the popover itself @return {sap.m.ContextMenu} Reference to this in order to allow method chaining @public
[ "Closes", "the", "ContextMenu", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ContextMenuControl.js#L619-L634
train
Close the popup if the maxButtonsDisplayed is reached
[ 30522, 3853, 1006, 2022, 2595, 24759, 28775, 13535, 10483, 2063, 1007, 1063, 2065, 1006, 2023, 1012, 2131, 16340, 7840, 1006, 1007, 1007, 1063, 2065, 1006, 2022, 2595, 24759, 28775, 13535, 10483, 2063, 1007, 1063, 2023, 1012, 30524, 2023, 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...
fex-team/webuploader
dist/webuploader.withoutimage.js
function( status ) { var len = this._queue.length, i, file; status = status || STATUS.QUEUED; for ( i = 0; i < len; i++ ) { file = this._queue[ i ]; if ( status === file.getStatus() ) { return file; } } return null; }
javascript
function( status ) { var len = this._queue.length, i, file; status = status || STATUS.QUEUED; for ( i = 0; i < len; i++ ) { file = this._queue[ i ]; if ( status === file.getStatus() ) { return file; } } return null; }
[ "function", "(", "status", ")", "{", "var", "len", "=", "this", ".", "_queue", ".", "length", ",", "i", ",", "file", ";", "status", "=", "status", "||", "STATUS", ".", "QUEUED", ";", "for", "(", "i", "=", "0", ";", "i", "<", "len", ";", "i", ...
从队列中取出一个指定状态的文件。 @grammar fetch( status ) => File @method fetch @param {String} status [文件状态值](#WebUploader:File:File.Status) @return {File} [File](#WebUploader:File)
[ "从队列中取出一个指定状态的文件。" ]
7094e4476c5af3b06993d91dde2d223200b9feb7
https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/dist/webuploader.withoutimage.js#L2234-L2249
train
Returns the first file in the queue that matches the status
[ 30522, 3853, 1006, 3570, 1007, 1063, 13075, 18798, 1027, 2023, 1012, 1035, 24240, 1012, 3091, 1010, 1045, 1010, 5371, 1025, 3570, 1027, 3570, 1064, 1064, 3570, 1012, 24240, 2094, 1025, 2005, 1006, 1045, 1027, 1014, 1025, 1045, 1026, 18798, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
mdn/browser-compat-data
scripts/render.js
writeFlagsNote
function writeFlagsNote(supportData, browserId) { let output = ''; const firefoxPrefs = 'To change preferences in Firefox, visit about:config.'; const chromePrefs = 'To change preferences in Chrome, visit chrome://flags.'; if (typeof(supportData.version_added) === 'string') { output = `From version ${supportData.version_added}`; } if (typeof(supportData.version_removed) === 'string') { if (output) { output += ` until version ${supportData.version_removed} (exclusive)`; } else { output = `Until version ${supportData.version_removed} (exclusive)`; } } let flagTextStart = 'This'; if (output) { output += ':'; flagTextStart = ' this'; } let flagText = `${flagTextStart} feature is behind the <code>${supportData.flag.name}</code>`; // value_to_set is optional let valueToSet = ''; if (supportData.flag.value_to_set) { valueToSet = ` (needs to be set to <code>${supportData.flag.value_to_set}</code>)`; } if (supportData.flag.type === 'preference') { let prefSettings = ''; switch (browserId) { case 'firefox': case 'firefox_android': prefSettings = firefoxPrefs; break; case 'chrome': case 'chrome_android': prefSettings = chromePrefs; break; } output += `${flagText} preference${valueToSet}. ${prefSettings}`; } return output; }
javascript
function writeFlagsNote(supportData, browserId) { let output = ''; const firefoxPrefs = 'To change preferences in Firefox, visit about:config.'; const chromePrefs = 'To change preferences in Chrome, visit chrome://flags.'; if (typeof(supportData.version_added) === 'string') { output = `From version ${supportData.version_added}`; } if (typeof(supportData.version_removed) === 'string') { if (output) { output += ` until version ${supportData.version_removed} (exclusive)`; } else { output = `Until version ${supportData.version_removed} (exclusive)`; } } let flagTextStart = 'This'; if (output) { output += ':'; flagTextStart = ' this'; } let flagText = `${flagTextStart} feature is behind the <code>${supportData.flag.name}</code>`; // value_to_set is optional let valueToSet = ''; if (supportData.flag.value_to_set) { valueToSet = ` (needs to be set to <code>${supportData.flag.value_to_set}</code>)`; } if (supportData.flag.type === 'preference') { let prefSettings = ''; switch (browserId) { case 'firefox': case 'firefox_android': prefSettings = firefoxPrefs; break; case 'chrome': case 'chrome_android': prefSettings = chromePrefs; break; } output += `${flagText} preference${valueToSet}. ${prefSettings}`; } return output; }
[ "function", "writeFlagsNote", "(", "supportData", ",", "browserId", ")", "{", "let", "output", "=", "''", ";", "const", "firefoxPrefs", "=", "'To change preferences in Firefox, visit about:config.'", ";", "const", "chromePrefs", "=", "'To change preferences in Chrome, visit...
/* Generate the note for a browser flag or preference First checks version_added and version_removed to create a string indicating when a preference setting is present. Then creates a (browser specific) string for either a preference flag or a compile flag. `supportData` is a support_statement `browserId` is a compat_block browser ID
[ "/", "*", "Generate", "the", "note", "for", "a", "browser", "flag", "or", "preference", "First", "checks", "version_added", "and", "version_removed", "to", "create", "a", "string", "indicating", "when", "a", "preference", "setting", "is", "present", ".", "Then...
6ca59b232e8fe080f441c7cb625d2bfd1a6fbe2b
https://github.com/mdn/browser-compat-data/blob/6ca59b232e8fe080f441c7cb625d2bfd1a6fbe2b/scripts/render.js#L141-L189
train
Writes a note to the console.
[ 30522, 3853, 4339, 10258, 26454, 22074, 1006, 2490, 2850, 2696, 1010, 16602, 3593, 1007, 1063, 2292, 6434, 1027, 1005, 1005, 1025, 9530, 3367, 2543, 14876, 2595, 28139, 10343, 1027, 1005, 2000, 2689, 18394, 1999, 2543, 14876, 2595, 1010, 39...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
babel/babel
packages/babel-plugin-proposal-object-rest-spread/src/index.js
extractNormalizedKeys
function extractNormalizedKeys(path) { const props = path.node.properties; const keys = []; let allLiteral = true; for (const prop of props) { if (t.isIdentifier(prop.key) && !prop.computed) { // since a key {a: 3} is equivalent to {"a": 3}, use the latter keys.push(t.stringLiteral(prop.key.name)); } else if (t.isTemplateLiteral(prop.key)) { keys.push(t.cloneNode(prop.key)); } else if (t.isLiteral(prop.key)) { keys.push(t.stringLiteral(String(prop.key.value))); } else { keys.push(t.cloneNode(prop.key)); allLiteral = false; } } return { keys, allLiteral }; }
javascript
function extractNormalizedKeys(path) { const props = path.node.properties; const keys = []; let allLiteral = true; for (const prop of props) { if (t.isIdentifier(prop.key) && !prop.computed) { // since a key {a: 3} is equivalent to {"a": 3}, use the latter keys.push(t.stringLiteral(prop.key.name)); } else if (t.isTemplateLiteral(prop.key)) { keys.push(t.cloneNode(prop.key)); } else if (t.isLiteral(prop.key)) { keys.push(t.stringLiteral(String(prop.key.value))); } else { keys.push(t.cloneNode(prop.key)); allLiteral = false; } } return { keys, allLiteral }; }
[ "function", "extractNormalizedKeys", "(", "path", ")", "{", "const", "props", "=", "path", ".", "node", ".", "properties", ";", "const", "keys", "=", "[", "]", ";", "let", "allLiteral", "=", "true", ";", "for", "(", "const", "prop", "of", "props", ")",...
returns an array of all keys of an object, and a status flag indicating if all extracted keys were converted to stringLiterals or not e.g. extracts {keys: ["a", "b", "3", ++x], allLiteral: false } from ast of {a: "foo", b, 3: "bar", [++x]: "baz"}
[ "returns", "an", "array", "of", "all", "keys", "of", "an", "object", "and", "a", "status", "flag", "indicating", "if", "all", "extracted", "keys", "were", "converted", "to", "stringLiterals", "or", "not", "e", ".", "g", ".", "extracts", "{", "keys", ":",...
1969e6b6aa7d90be3fbb3aca98ea96849656a55a
https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-plugin-proposal-object-rest-spread/src/index.js#L70-L90
train
Extract normalized keys from a node
[ 30522, 3853, 14817, 12131, 9067, 3550, 14839, 2015, 1006, 4130, 1007, 1063, 9530, 3367, 24387, 1027, 4130, 1012, 13045, 1012, 5144, 1025, 9530, 3367, 6309, 1027, 1031, 1033, 1025, 2292, 2035, 22779, 7941, 1027, 2995, 1025, 2005, 1006, 9530,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/dialog/dialog.js
captureParentAndFromToElements
function captureParentAndFromToElements(options) { options.origin = angular.extend({ element: null, bounds: null, focus: angular.noop }, options.origin || {}); options.parent = getDomElement(options.parent, $rootElement); options.closeTo = getBoundingClientRect(getDomElement(options.closeTo)); options.openFrom = getBoundingClientRect(getDomElement(options.openFrom)); if (options.targetEvent) { options.origin = getBoundingClientRect(options.targetEvent.target, options.origin); options.originInteraction = $mdInteraction.getLastInteractionType(); } /** * Identify the bounding RECT for the target element * */ function getBoundingClientRect (element, orig) { var source = angular.element((element || {})); if (source && source.length) { // Compute and save the target element's bounding rect, so that if the // element is hidden when the dialog closes, we can shrink the dialog // back to the same position it expanded from. // // Checking if the source is a rect object or a DOM element var bounds = {top:0,left:0,height:0,width:0}; var hasFn = angular.isFunction(source[0].getBoundingClientRect); return angular.extend(orig || {}, { element : hasFn ? source : undefined, bounds : hasFn ? source[0].getBoundingClientRect() : angular.extend({}, bounds, source[0]), focus : angular.bind(source, source.focus), }); } } /** * If the specifier is a simple string selector, then query for * the DOM element. */ function getDomElement(element, defaultElement) { if (angular.isString(element)) { element = $document[0].querySelector(element); } // If we have a reference to a raw dom element, always wrap it in jqLite return angular.element(element || defaultElement); } }
javascript
function captureParentAndFromToElements(options) { options.origin = angular.extend({ element: null, bounds: null, focus: angular.noop }, options.origin || {}); options.parent = getDomElement(options.parent, $rootElement); options.closeTo = getBoundingClientRect(getDomElement(options.closeTo)); options.openFrom = getBoundingClientRect(getDomElement(options.openFrom)); if (options.targetEvent) { options.origin = getBoundingClientRect(options.targetEvent.target, options.origin); options.originInteraction = $mdInteraction.getLastInteractionType(); } /** * Identify the bounding RECT for the target element * */ function getBoundingClientRect (element, orig) { var source = angular.element((element || {})); if (source && source.length) { // Compute and save the target element's bounding rect, so that if the // element is hidden when the dialog closes, we can shrink the dialog // back to the same position it expanded from. // // Checking if the source is a rect object or a DOM element var bounds = {top:0,left:0,height:0,width:0}; var hasFn = angular.isFunction(source[0].getBoundingClientRect); return angular.extend(orig || {}, { element : hasFn ? source : undefined, bounds : hasFn ? source[0].getBoundingClientRect() : angular.extend({}, bounds, source[0]), focus : angular.bind(source, source.focus), }); } } /** * If the specifier is a simple string selector, then query for * the DOM element. */ function getDomElement(element, defaultElement) { if (angular.isString(element)) { element = $document[0].querySelector(element); } // If we have a reference to a raw dom element, always wrap it in jqLite return angular.element(element || defaultElement); } }
[ "function", "captureParentAndFromToElements", "(", "options", ")", "{", "options", ".", "origin", "=", "angular", ".", "extend", "(", "{", "element", ":", "null", ",", "bounds", ":", "null", ",", "focus", ":", "angular", ".", "noop", "}", ",", "options", ...
Capture originator/trigger/from/to element information (if available) and the parent container for the dialog; defaults to the $rootElement unless overridden in the options.parent
[ "Capture", "originator", "/", "trigger", "/", "from", "/", "to", "element", "information", "(", "if", "available", ")", "and", "the", "parent", "container", "for", "the", "dialog", ";", "defaults", "to", "the", "$rootElement", "unless", "overridden", "in", "...
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L891-L944
train
Capture the parent and from to elements
[ 30522, 3853, 5425, 19362, 4765, 5685, 19699, 5358, 3406, 12260, 8163, 1006, 7047, 1007, 1063, 7047, 1012, 4761, 1027, 16108, 1012, 7949, 1006, 1063, 5783, 1024, 19701, 1010, 19202, 1024, 19701, 1010, 3579, 1024, 16108, 1012, 2053, 7361, 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...
transloadit/uppy
packages/@uppy/transloadit/src/AssemblyOptions.js
validateParams
function validateParams (params) { if (!params) { throw new Error('Transloadit: The `params` option is required.') } if (typeof params === 'string') { try { params = JSON.parse(params) } catch (err) { // Tell the user that this is not an Uppy bug! err.message = 'Transloadit: The `params` option is a malformed JSON string: ' + err.message throw err } } if (!params.auth || !params.auth.key) { throw new Error('Transloadit: The `params.auth.key` option is required. ' + 'You can find your Transloadit API key at https://transloadit.com/account/api-settings.') } }
javascript
function validateParams (params) { if (!params) { throw new Error('Transloadit: The `params` option is required.') } if (typeof params === 'string') { try { params = JSON.parse(params) } catch (err) { // Tell the user that this is not an Uppy bug! err.message = 'Transloadit: The `params` option is a malformed JSON string: ' + err.message throw err } } if (!params.auth || !params.auth.key) { throw new Error('Transloadit: The `params.auth.key` option is required. ' + 'You can find your Transloadit API key at https://transloadit.com/account/api-settings.') } }
[ "function", "validateParams", "(", "params", ")", "{", "if", "(", "!", "params", ")", "{", "throw", "new", "Error", "(", "'Transloadit: The `params` option is required.'", ")", "}", "if", "(", "typeof", "params", "===", "'string'", ")", "{", "try", "{", "par...
Check that Assembly parameters are present and include all required fields.
[ "Check", "that", "Assembly", "parameters", "are", "present", "and", "include", "all", "required", "fields", "." ]
7ae18bf992d544a64da998f033258ec09a3de275
https://github.com/transloadit/uppy/blob/7ae18bf992d544a64da998f033258ec09a3de275/packages/@uppy/transloadit/src/AssemblyOptions.js#L4-L24
train
Validate the params
[ 30522, 3853, 9398, 3686, 28689, 5244, 1006, 11498, 5244, 1007, 1063, 2065, 1006, 999, 11498, 5244, 1007, 1063, 5466, 2047, 7561, 1006, 1005, 9099, 11066, 4183, 1024, 1996, 1036, 11498, 5244, 1036, 5724, 2003, 3223, 1012, 1005, 1007, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/search/FileFilters.js
_handleDeleteFilter
function _handleDeleteFilter(e) { // Remove the filter set from the preferences and // clear the active filter set index from view state. var filterSets = PreferencesManager.get("fileFilters") || [], activeFilterIndex = PreferencesManager.getViewState("activeFileFilter"), filterIndex = $(e.target).parent().data("index") - FIRST_FILTER_INDEX; // Don't let the click bubble upward. e.stopPropagation(); filterSets.splice(filterIndex, 1); PreferencesManager.set("fileFilters", filterSets); if (activeFilterIndex === filterIndex) { // Removing the active filter, so clear the active filter // both in the view state. setActiveFilter(null); } else if (activeFilterIndex > filterIndex) { // Adjust the active filter index after the removal of a filter set before it. --activeFilterIndex; setActiveFilter(filterSets[activeFilterIndex], activeFilterIndex); } _updatePicker(); _doPopulate(); _picker.refresh(); }
javascript
function _handleDeleteFilter(e) { // Remove the filter set from the preferences and // clear the active filter set index from view state. var filterSets = PreferencesManager.get("fileFilters") || [], activeFilterIndex = PreferencesManager.getViewState("activeFileFilter"), filterIndex = $(e.target).parent().data("index") - FIRST_FILTER_INDEX; // Don't let the click bubble upward. e.stopPropagation(); filterSets.splice(filterIndex, 1); PreferencesManager.set("fileFilters", filterSets); if (activeFilterIndex === filterIndex) { // Removing the active filter, so clear the active filter // both in the view state. setActiveFilter(null); } else if (activeFilterIndex > filterIndex) { // Adjust the active filter index after the removal of a filter set before it. --activeFilterIndex; setActiveFilter(filterSets[activeFilterIndex], activeFilterIndex); } _updatePicker(); _doPopulate(); _picker.refresh(); }
[ "function", "_handleDeleteFilter", "(", "e", ")", "{", "// Remove the filter set from the preferences and", "// clear the active filter set index from view state.", "var", "filterSets", "=", "PreferencesManager", ".", "get", "(", "\"fileFilters\"", ")", "||", "[", "]", ",", ...
Remove the target item from the filter dropdown list and update dropdown button and dropdown list UI. @param {!Event} e Mouse events
[ "Remove", "the", "target", "item", "from", "the", "filter", "dropdown", "list", "and", "update", "dropdown", "button", "and", "dropdown", "list", "UI", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FileFilters.js#L434-L460
train
Delete a filter set from the file picker
[ 30522, 3853, 1035, 8971, 12260, 2618, 8873, 21928, 1006, 1041, 1007, 1063, 1013, 1013, 6366, 1996, 11307, 2275, 2013, 1996, 18394, 1998, 1013, 1013, 3154, 1996, 3161, 11307, 2275, 5950, 2013, 3193, 2110, 1012, 13075, 17736, 8454, 1027, 1839...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
release.js
updateSite
function updateSite () { start('Adding new version of the docs site...'); const options = { cwd: './code.material.angularjs.org' }; writeDocsJson(); // build files for bower exec([ 'rm -rf dist', 'gulp docs' ]); replaceFilePaths(); // copy files over to site repo exec([ `cp -Rf ../dist/docs ${newVersion}`, 'rm -rf latest && cp -Rf ../dist/docs latest', 'git add -A', `git commit -m "release: version ${newVersion}"`, 'rm -rf ../dist' ], options); replaceBaseHref(newVersion); replaceBaseHref('latest'); // update firebase.json file updateFirebaseJson(); exec(['git commit --amend --no-edit -a'], options); done(); // add steps to push script pushCmds.push( comment('push the site'), 'cd ' + options.cwd, 'git pull --rebase --strategy=ours', 'git push', 'cd ..' ); function updateFirebaseJson () { fs.writeFileSync(options.cwd + '/firebase.json', getFirebaseJson()); function getFirebaseJson () { const json = require(options.cwd + '/firebase.json'); json.hosting.rewrites = json.hosting.rewrites || []; const rewrites = json.hosting.rewrites; switch (rewrites.length) { case 0: rewrites.push(getRewrite('HEAD')); case 1: rewrites.push(getRewrite('latest')); default: rewrites.push(getRewrite(newVersion)); } return JSON.stringify(json, null, 2); function getRewrite (str) { return { source: '/' + str + '/**/!(*.@(js|html|css|json|svg|png|jpg|jpeg))', destination: '/' + str + '/index.html' }; } } } function writeDocsJson () { const config = require(options.cwd + '/docs.json'); config.versions.unshift(newVersion); // only set to default if not a release candidate config.latest = newVersion; fs.writeFileSync(options.cwd + '/docs.json', JSON.stringify(config, null, 2)); } }
javascript
function updateSite () { start('Adding new version of the docs site...'); const options = { cwd: './code.material.angularjs.org' }; writeDocsJson(); // build files for bower exec([ 'rm -rf dist', 'gulp docs' ]); replaceFilePaths(); // copy files over to site repo exec([ `cp -Rf ../dist/docs ${newVersion}`, 'rm -rf latest && cp -Rf ../dist/docs latest', 'git add -A', `git commit -m "release: version ${newVersion}"`, 'rm -rf ../dist' ], options); replaceBaseHref(newVersion); replaceBaseHref('latest'); // update firebase.json file updateFirebaseJson(); exec(['git commit --amend --no-edit -a'], options); done(); // add steps to push script pushCmds.push( comment('push the site'), 'cd ' + options.cwd, 'git pull --rebase --strategy=ours', 'git push', 'cd ..' ); function updateFirebaseJson () { fs.writeFileSync(options.cwd + '/firebase.json', getFirebaseJson()); function getFirebaseJson () { const json = require(options.cwd + '/firebase.json'); json.hosting.rewrites = json.hosting.rewrites || []; const rewrites = json.hosting.rewrites; switch (rewrites.length) { case 0: rewrites.push(getRewrite('HEAD')); case 1: rewrites.push(getRewrite('latest')); default: rewrites.push(getRewrite(newVersion)); } return JSON.stringify(json, null, 2); function getRewrite (str) { return { source: '/' + str + '/**/!(*.@(js|html|css|json|svg|png|jpg|jpeg))', destination: '/' + str + '/index.html' }; } } } function writeDocsJson () { const config = require(options.cwd + '/docs.json'); config.versions.unshift(newVersion); // only set to default if not a release candidate config.latest = newVersion; fs.writeFileSync(options.cwd + '/docs.json', JSON.stringify(config, null, 2)); } }
[ "function", "updateSite", "(", ")", "{", "start", "(", "'Adding new version of the docs site...'", ")", ";", "const", "options", "=", "{", "cwd", ":", "'./code.material.angularjs.org'", "}", ";", "writeDocsJson", "(", ")", ";", "// build files for bower", "exec", "(...
builds the website for the new version
[ "builds", "the", "website", "for", "the", "new", "version" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L261-L331
train
update site
[ 30522, 3853, 14409, 4221, 1006, 1007, 1063, 2707, 1006, 1005, 5815, 2047, 2544, 1997, 1996, 9986, 2015, 2609, 1012, 1012, 1012, 1005, 1007, 1025, 9530, 3367, 7047, 1027, 1063, 19296, 2094, 1024, 1005, 1012, 1013, 3642, 1012, 3430, 1012, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/AnnotationHelper.js
function (oInterface, vRawValue) { if (arguments.length === 1) { vRawValue = oInterface.getObject(""); } return Expression.getExpression(oInterface, vRawValue, true); }
javascript
function (oInterface, vRawValue) { if (arguments.length === 1) { vRawValue = oInterface.getObject(""); } return Expression.getExpression(oInterface, vRawValue, true); }
[ "function", "(", "oInterface", ",", "vRawValue", ")", "{", "if", "(", "arguments", ".", "length", "===", "1", ")", "{", "vRawValue", "=", "oInterface", ".", "getObject", "(", "\"\"", ")", ";", "}", "return", "Expression", ".", "getExpression", "(", "oInt...
A formatter function to be used in a complex binding inside an XML template view in order to interpret OData V4 annotations. It knows about <ul> <li> the "14.4 Constant Expressions" for "edm:Bool", "edm:Date", "edm:DateTimeOffset", "edm:Decimal", "edm:Float", "edm:Guid", "edm:Int", "edm:TimeOfDay". <li> the constant "14.4.11 Expression edm:String": This is turned into a fixed text (e.g. <code>"Width"</code>) or into a data binding expression (e.g. <code> "{/##/dataServices/schema/0/entityType/1/com.sap.vocabularies.UI.v1.FieldGroup#Dimensions/Data/0/Label/String}" </code>). Data binding expressions are used in case XML template processing has been started with the setting <code>bindTexts : true</code>. The purpose is to reference translatable texts from OData V4 annotations, especially for XML template processing at design time. Since 1.31.0, string constants that contain a simple binding <code>"{@i18n>...}"</code> to the hard-coded model name "@i18n" with arbitrary path are not turned into a fixed text, but kept as a data binding expression; this allows local annotation files to refer to a resource bundle for internationalization. <li> the dynamic "14.5.1 Comparison and Logical Operators": These are turned into expression bindings to perform the operations at run-time. <li> the dynamic "14.5.3 Expression edm:Apply": <ul> <li> "14.5.3.1.1 Function odata.concat": This is turned into a data binding expression relative to an entity. <li> "14.5.3.1.2 Function odata.fillUriTemplate": This is turned into an expression binding to fill the template at run-time. <li> "14.5.3.1.3 Function odata.uriEncode": This is turned into an expression binding to encode the parameter at run-time. <li> Apply functions may be nested arbitrarily. </ul> <li> the dynamic "14.5.6 Expression edm:If": This is turned into an expression binding to be evaluated at run-time. The expression is a conditional expression like <code>"{=condition ? expression1 : expression2}"</code>. <li> the dynamic "14.5.10 Expression edm:Null": This is turned into a <code>null</code> value. In <code>odata.concat</code> it is ignored. <li> the dynamic "14.5.12 Expression edm:Path" and "14.5.13 Expression edm:PropertyPath": This is turned into a data binding relative to an entity, including type information and constraints as available from metadata, e.g. <code>"{path : 'Name', type : 'sap.ui.model.odata.type.String', constraints : {'maxLength':'255'}}"</code>. Depending on the used type, some additional constraints of this type are set: <ul> <li>Edm.DateTime: The "displayFormat" constraint is set to the value of the "sap:display-format" annotation of the referenced property. <li>Edm.Decimal: The "precision" and "scale" constraints are set to the values of the corresponding attributes of the referenced property. The "minimum", "maximum", "minimumExclusive" and "maximumExlusive" constraints are set to the values of the corresponding "Org.OData.Validation.V1" annotation of the referenced property; note that in this case only constant expressions are supported to determine the annotation value. <li>Edm.String: The "maxLength" constraint is set to the value of the corresponding attribute of the referenced property and the "isDigitSequence" constraint is set to the value of the "com.sap.vocabularies.Common.v1.IsDigitSequence" annotation of the referenced property; note that in this case only constant expressions are supported to determine the annotation value. </ul> </ul> Unsupported or incorrect values are turned into a string nevertheless, but indicated as such. Proper escaping is used to make sure that data binding syntax is not corrupted. An error describing the problem is logged to the console in such a case. Example: <pre> &lt;Text text="{path: 'meta>Value', formatter: 'sap.ui.model.odata.AnnotationHelper.format'}" /> </pre> @param {sap.ui.core.util.XMLPreprocessor.IContext|sap.ui.model.Context} oInterface the callback interface related to the current formatter call @param {any} [vRawValue] the raw value from the meta model, which is embedded within an entity set or entity type: <ul> <li>if this function is used as formatter the value is provided by the framework</li> <li>if this function is called directly, provide the parameter only if it is already calculated</li> <li>if the parameter is omitted, it is calculated automatically through <code>oInterface.getObject("")</code></li> </ul> @returns {string} the resulting string value to write into the processed XML @public
[ "A", "formatter", "function", "to", "be", "used", "in", "a", "complex", "binding", "inside", "an", "XML", "template", "view", "in", "order", "to", "interpret", "OData", "V4", "annotations", ".", "It", "knows", "about", "<ul", ">", "<li", ">", "the", "14"...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/AnnotationHelper.js#L279-L284
train
Returns the expression for the given interface.
[ 30522, 3853, 1006, 1051, 18447, 2121, 12172, 1010, 27830, 10376, 10175, 5657, 1007, 1063, 2065, 1006, 9918, 1012, 3091, 1027, 1027, 1027, 1015, 1007, 1063, 27830, 10376, 10175, 5657, 1027, 1051, 18447, 2121, 12172, 1012, 2131, 16429, 20614, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
mxConnectionConstraint
function mxConnectionConstraint(point, perimeter, name, dx, dy) { this.point = point; this.perimeter = (perimeter != null) ? perimeter : true; this.name = name; this.dx = dx? dx : 0; this.dy = dy? dy : 0; }
javascript
function mxConnectionConstraint(point, perimeter, name, dx, dy) { this.point = point; this.perimeter = (perimeter != null) ? perimeter : true; this.name = name; this.dx = dx? dx : 0; this.dy = dy? dy : 0; }
[ "function", "mxConnectionConstraint", "(", "point", ",", "perimeter", ",", "name", ",", "dx", ",", "dy", ")", "{", "this", ".", "point", "=", "point", ";", "this", ".", "perimeter", "=", "(", "perimeter", "!=", "null", ")", "?", "perimeter", ":", "true...
Copyright (c) 2006-2015, JGraph Ltd Copyright (c) 2006-2015, Gaudenz Alder Class: mxConnectionConstraint Defines an object that contains the constraints about how to connect one side of an edge to its terminal. Constructor: mxConnectionConstraint Constructs a new connection constraint for the given point and boolean arguments. Parameters: point - Optional <mxPoint> that specifies the fixed location of the point in relative coordinates. Default is null. perimeter - Optional boolean that specifies if the fixed point should be projected onto the perimeter of the terminal. Default is true.
[ "Copyright", "(", "c", ")", "2006", "-", "2015", "JGraph", "Ltd", "Copyright", "(", "c", ")", "2006", "-", "2015", "Gaudenz", "Alder", "Class", ":", "mxConnectionConstraint" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L69430-L69437
train
A constraint for a connection
[ 30522, 3853, 25630, 8663, 2638, 7542, 8663, 20528, 18447, 1006, 2391, 1010, 13443, 1010, 2171, 1010, 1040, 2595, 1010, 1040, 2100, 1007, 1063, 2023, 1012, 2391, 1027, 2391, 1025, 2023, 1012, 13443, 1027, 1006, 13443, 999, 1027, 19701, 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/code-prettify
js-modules/prettify.js
registerLangHandler
function registerLangHandler(handler, fileExtensions) { for (var i = fileExtensions.length; --i >= 0;) { var ext = fileExtensions[i]; if (!langHandlerRegistry.hasOwnProperty(ext)) { langHandlerRegistry[ext] = handler; } else if (win['console']) { console['warn']('cannot override language handler %s', ext); } } }
javascript
function registerLangHandler(handler, fileExtensions) { for (var i = fileExtensions.length; --i >= 0;) { var ext = fileExtensions[i]; if (!langHandlerRegistry.hasOwnProperty(ext)) { langHandlerRegistry[ext] = handler; } else if (win['console']) { console['warn']('cannot override language handler %s', ext); } } }
[ "function", "registerLangHandler", "(", "handler", ",", "fileExtensions", ")", "{", "for", "(", "var", "i", "=", "fileExtensions", ".", "length", ";", "--", "i", ">=", "0", ";", ")", "{", "var", "ext", "=", "fileExtensions", "[", "i", "]", ";", "if", ...
Register a language handler for the given file extensions. @param {function (JobT)} handler a function from source code to a list of decorations. Takes a single argument job which describes the state of the computation and attaches the decorations to it. @param {Array.<string>} fileExtensions
[ "Register", "a", "language", "handler", "for", "the", "given", "file", "extensions", "." ]
e14ed1c3c40f78fca2a11af4cb0fa251f6f997fc
https://github.com/google/code-prettify/blob/e14ed1c3c40f78fca2a11af4cb0fa251f6f997fc/js-modules/prettify.js#L679-L688
train
Register a language handler for a file extension
[ 30522, 3853, 4236, 25023, 11774, 3917, 1006, 28213, 1010, 5371, 10288, 29048, 2015, 1007, 1063, 2005, 1006, 13075, 1045, 1027, 5371, 10288, 29048, 2015, 1012, 3091, 1025, 1011, 1011, 1045, 1028, 1027, 1014, 1025, 1007, 1063, 13075, 4654, 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...
adobe/brackets
src/extensions/default/InlineTimingFunctionEditor/BezierCurveEditor.js
_curveClick
function _curveClick(e) { var self = e.target, bezierEditor = self.bezierEditor; var curveBoundingBox = bezierEditor._getCurveBoundingBox(), left = curveBoundingBox.left, top = curveBoundingBox.top, x = e.pageX - left, y = e.pageY - top - HEIGHT_ABOVE, $P1 = $(bezierEditor.P1), $P2 = $(bezierEditor.P2); // Helper function to calculate distance between 2-D points function distance(x1, y1, x2, y2) { return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2)); } // Find which point is closer var distP1 = distance(x, y, parseInt($P1.css("left"), 10), parseInt($P1.css("top"), 10)), distP2 = distance(x, y, parseInt($P2.css("left"), 10), parseInt($P2.css("top"), 10)), $P = (distP1 < distP2) ? $P1 : $P2; $P.css({ left: x + "px", top: y + "px" }); $P.get(0).focus(); // update coords bezierEditor._cubicBezierCoords = bezierEditor.bezierCanvas .offsetsToCoordinates(bezierEditor.P1) .concat(bezierEditor.bezierCanvas.offsetsToCoordinates(bezierEditor.P2)); bezierEditor._commitTimingFunction(); bezierEditor._updateCanvas(); }
javascript
function _curveClick(e) { var self = e.target, bezierEditor = self.bezierEditor; var curveBoundingBox = bezierEditor._getCurveBoundingBox(), left = curveBoundingBox.left, top = curveBoundingBox.top, x = e.pageX - left, y = e.pageY - top - HEIGHT_ABOVE, $P1 = $(bezierEditor.P1), $P2 = $(bezierEditor.P2); // Helper function to calculate distance between 2-D points function distance(x1, y1, x2, y2) { return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2)); } // Find which point is closer var distP1 = distance(x, y, parseInt($P1.css("left"), 10), parseInt($P1.css("top"), 10)), distP2 = distance(x, y, parseInt($P2.css("left"), 10), parseInt($P2.css("top"), 10)), $P = (distP1 < distP2) ? $P1 : $P2; $P.css({ left: x + "px", top: y + "px" }); $P.get(0).focus(); // update coords bezierEditor._cubicBezierCoords = bezierEditor.bezierCanvas .offsetsToCoordinates(bezierEditor.P1) .concat(bezierEditor.bezierCanvas.offsetsToCoordinates(bezierEditor.P2)); bezierEditor._commitTimingFunction(); bezierEditor._updateCanvas(); }
[ "function", "_curveClick", "(", "e", ")", "{", "var", "self", "=", "e", ".", "target", ",", "bezierEditor", "=", "self", ".", "bezierEditor", ";", "var", "curveBoundingBox", "=", "bezierEditor", ".", "_getCurveBoundingBox", "(", ")", ",", "left", "=", "cur...
Event handlers Handle click in <canvas> element @param {Event} e Mouse click event
[ "Event", "handlers", "Handle", "click", "in", "<canvas", ">", "element" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/BezierCurveEditor.js#L242-L277
train
Click event handler for curve
[ 30522, 3853, 1035, 7774, 20464, 6799, 1006, 1041, 1007, 1063, 13075, 2969, 1027, 1041, 1012, 4539, 1010, 2022, 21548, 2098, 15660, 1027, 2969, 1012, 2022, 21548, 2098, 15660, 1025, 13075, 7774, 15494, 2075, 8758, 1027, 2022, 21548, 2098, 15...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
webtorrent/webtorrent
lib/torrent.js
validateWire
function validateWire () { if (wire.requests.length) return let i = self._selections.length while (i--) { const next = self._selections[i] let piece if (self.strategy === 'rarest') { const start = next.from + next.offset const end = next.to const len = end - start + 1 const tried = {} let tries = 0 const filter = genPieceFilterFunc(start, end, tried) while (tries < len) { piece = self._rarityMap.getRarestPiece(filter) if (piece < 0) break if (self._request(wire, piece, false)) return tried[piece] = true tries += 1 } } else { for (piece = next.to; piece >= next.from + next.offset; --piece) { if (!wire.peerPieces.get(piece)) continue if (self._request(wire, piece, false)) return } } } // TODO: wire failed to validate as useful; should we close it? // probably not, since 'have' and 'bitfield' messages might be coming }
javascript
function validateWire () { if (wire.requests.length) return let i = self._selections.length while (i--) { const next = self._selections[i] let piece if (self.strategy === 'rarest') { const start = next.from + next.offset const end = next.to const len = end - start + 1 const tried = {} let tries = 0 const filter = genPieceFilterFunc(start, end, tried) while (tries < len) { piece = self._rarityMap.getRarestPiece(filter) if (piece < 0) break if (self._request(wire, piece, false)) return tried[piece] = true tries += 1 } } else { for (piece = next.to; piece >= next.from + next.offset; --piece) { if (!wire.peerPieces.get(piece)) continue if (self._request(wire, piece, false)) return } } } // TODO: wire failed to validate as useful; should we close it? // probably not, since 'have' and 'bitfield' messages might be coming }
[ "function", "validateWire", "(", ")", "{", "if", "(", "wire", ".", "requests", ".", "length", ")", "return", "let", "i", "=", "self", ".", "_selections", ".", "length", "while", "(", "i", "--", ")", "{", "const", "next", "=", "self", ".", "_selection...
TODO: Do we need both validateWire and trySelectWire?
[ "TODO", ":", "Do", "we", "need", "both", "validateWire", "and", "trySelectWire?" ]
f8923a66a8b1178a412b067bc913e267025b3d57
https://github.com/webtorrent/webtorrent/blob/f8923a66a8b1178a412b067bc913e267025b3d57/lib/torrent.js#L1176-L1208
train
Validate the wire
[ 30522, 3853, 9398, 3686, 20357, 1006, 1007, 1063, 2065, 1006, 7318, 1012, 11186, 1012, 3091, 1007, 2709, 2292, 1045, 1027, 2969, 1012, 1035, 16310, 1012, 3091, 2096, 1006, 1045, 1011, 1011, 1007, 1063, 9530, 3367, 2279, 1027, 2969, 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...
wangfupeng1988/wangEditor
src/js/menus/head/index.js
function (value) { const editor = this.editor const $selectionElem = editor.selection.getSelectionContainerElem() if (editor.$textElem.equal($selectionElem)) { // 不能选中多行来设置标题,否则会出现问题 // 例如选中的是 <p>xxx</p><p>yyy</p> 来设置标题,设置之后会成为 <h1>xxx<br>yyy</h1> 不符合预期 return } editor.cmd.do('formatBlock', value) }
javascript
function (value) { const editor = this.editor const $selectionElem = editor.selection.getSelectionContainerElem() if (editor.$textElem.equal($selectionElem)) { // 不能选中多行来设置标题,否则会出现问题 // 例如选中的是 <p>xxx</p><p>yyy</p> 来设置标题,设置之后会成为 <h1>xxx<br>yyy</h1> 不符合预期 return } editor.cmd.do('formatBlock', value) }
[ "function", "(", "value", ")", "{", "const", "editor", "=", "this", ".", "editor", "const", "$selectionElem", "=", "editor", ".", "selection", ".", "getSelectionContainerElem", "(", ")", "if", "(", "editor", ".", "$textElem", ".", "equal", "(", "$selectionEl...
执行命令
[ "执行命令" ]
b77696f5e81c8ec13d9d341252d6b9fa8a22db18
https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/menus/head/index.js#L41-L52
train
format block
[ 30522, 3853, 1006, 3643, 1007, 1063, 9530, 3367, 3559, 1027, 2023, 1012, 3559, 9530, 3367, 1002, 4989, 12260, 2213, 1027, 3559, 1012, 4989, 1012, 4152, 12260, 7542, 8663, 18249, 7869, 16930, 1006, 1007, 2065, 1006, 3559, 1012, 1002, 3793, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GitbookIO/gitbook
lib/output/website/createTemplateEngine.js
getArticleByPath
function getArticleByPath(filePath) { var article = summary.getByPath(filePath); if (!article) return undefined; return JSONUtils.encodeSummaryArticle(article); }
javascript
function getArticleByPath(filePath) { var article = summary.getByPath(filePath); if (!article) return undefined; return JSONUtils.encodeSummaryArticle(article); }
[ "function", "getArticleByPath", "(", "filePath", ")", "{", "var", "article", "=", "summary", ".", "getByPath", "(", "filePath", ")", ";", "if", "(", "!", "article", ")", "return", "undefined", ";", "return", "JSONUtils", ".", "encodeSummaryArticle", "(", "ar...
Return an article by its path @param {String} filePath @return {Object|undefined}
[ "Return", "an", "article", "by", "its", "path" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/output/website/createTemplateEngine.js#L75-L80
train
Get an article from summary by path
[ 30522, 3853, 2131, 8445, 25128, 3762, 15069, 1006, 5371, 15069, 1007, 1063, 13075, 3720, 1027, 12654, 1012, 2131, 3762, 15069, 1006, 5371, 15069, 1007, 1025, 2065, 30524, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
grpc/grpc
examples/node/static_codegen/route_guide/route_guide_client.js
runGetFeature
function runGetFeature(callback) { var next = _.after(2, callback); function featureCallback(error, feature) { if (error) { callback(error); return; } var latitude = feature.getLocation().getLatitude(); var longitude = feature.getLocation().getLongitude(); if (feature.getName() === '') { console.log('Found no feature at ' + latitude/COORD_FACTOR + ', ' + longitude/COORD_FACTOR); } else { console.log('Found feature called "' + feature.getName() + '" at ' + latitude/COORD_FACTOR + ', ' + longitude/COORD_FACTOR); } next(); } var point1 = new messages.Point(); point1.setLatitude(409146138); point1.setLongitude(-746188906); var point2 = new messages.Point(); point2.setLatitude(0); point2.setLongitude(0); client.getFeature(point1, featureCallback); client.getFeature(point2, featureCallback); }
javascript
function runGetFeature(callback) { var next = _.after(2, callback); function featureCallback(error, feature) { if (error) { callback(error); return; } var latitude = feature.getLocation().getLatitude(); var longitude = feature.getLocation().getLongitude(); if (feature.getName() === '') { console.log('Found no feature at ' + latitude/COORD_FACTOR + ', ' + longitude/COORD_FACTOR); } else { console.log('Found feature called "' + feature.getName() + '" at ' + latitude/COORD_FACTOR + ', ' + longitude/COORD_FACTOR); } next(); } var point1 = new messages.Point(); point1.setLatitude(409146138); point1.setLongitude(-746188906); var point2 = new messages.Point(); point2.setLatitude(0); point2.setLongitude(0); client.getFeature(point1, featureCallback); client.getFeature(point2, featureCallback); }
[ "function", "runGetFeature", "(", "callback", ")", "{", "var", "next", "=", "_", ".", "after", "(", "2", ",", "callback", ")", ";", "function", "featureCallback", "(", "error", ",", "feature", ")", "{", "if", "(", "error", ")", "{", "callback", "(", ...
Run the getFeature demo. Calls getFeature with a point known to have a feature and a point known not to have a feature. @param {function} callback Called when this demo is complete
[ "Run", "the", "getFeature", "demo", ".", "Calls", "getFeature", "with", "a", "point", "known", "to", "have", "a", "feature", "and", "a", "point", "known", "not", "to", "have", "a", "feature", "." ]
cc75d93818410e2b0edd0fa3009a6def9ac403ca
https://github.com/grpc/grpc/blob/cc75d93818410e2b0edd0fa3009a6def9ac403ca/examples/node/static_codegen/route_guide/route_guide_client.js#L39-L65
train
Get a feature from the cluster
[ 30522, 3853, 2448, 18150, 7959, 4017, 5397, 1006, 2655, 5963, 1007, 1063, 13075, 2279, 1027, 1035, 1012, 2044, 1006, 1016, 1010, 2655, 5963, 1007, 1025, 3853, 3444, 9289, 20850, 8684, 1006, 7561, 1010, 3444, 1007, 1063, 2065, 1006, 7561, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_AggregationHelper.js
function (oAggregation, mQueryOptions, mAlias2MeasureAndMethod, bFollowUp) { var aAggregate, sApply = "", // concat(aggregate(???),.) content for grand totals (w/o unit) or min/max or count aConcatAggregate = [], aGroupBy, bHasGrandTotal, sSkipTop; /* * Returns the corresponding part of the "aggregate" term for an aggregatable property, * for example "AggregatableProperty with method as Alias". Processes min/max as a side * effect. * * @param {string} sAlias - An aggregatable property name * @returns {string} - Part of the "aggregate" term * @throws {Error} If "average" or "countdistinct" are used together with subtotals or * grand totals */ function aggregate(sAlias) { var oDetails = oAggregation.aggregate[sAlias], sAggregate = oDetails.name || sAlias, sGrandTotal = sAlias, sWith = oDetails.with; if (sWith) { if ((sWith === "average" || sWith === "countdistinct") && (oDetails.grandTotal || oDetails.subtotals)) { throw new Error("Cannot aggregate totals with '" + sWith + "'"); } sAggregate += " with " + sWith + " as " + sAlias; } else if (oDetails.name) { sAggregate += " as " + sAlias; } if (!bFollowUp) { if (oDetails.min) { processMinOrMax(sAlias, "min"); } if (oDetails.max) { processMinOrMax(sAlias, "max"); } } if (oDetails.grandTotal) { bHasGrandTotal = true; if (!mQueryOptions.$skip) { if (sWith) { sGrandTotal += " with " + sWith + " as UI5grand__" + sAlias; } aConcatAggregate.push(sGrandTotal); } } return sAggregate; } /* * Tells whether the given groupable property is not a group level. * * @param {string} sGroupable - A groupable property name * @returns {boolean} - Whether it is not a group level */ function notGroupLevel(sGroupable) { return oAggregation.groupLevels.indexOf(sGroupable) < 0; } /* * Builds the min/max expression for the "concat" term (for example * "AggregatableProperty with min as UI5min__AggregatableProperty") and adds a * corresponding entry to the optional alias map. * * @param {string} sName - An aggregatable property name * @param {string} sMinOrMax - Either "min" or "max" */ function processMinOrMax(sName, sMinOrMax) { var sAlias = "UI5" + sMinOrMax + "__" + sName; aConcatAggregate.push(sName + " with " + sMinOrMax + " as " + sAlias); if (mAlias2MeasureAndMethod) { mAlias2MeasureAndMethod[sAlias] = { measure : sName, method : sMinOrMax }; } } /* * Takes care of the $skip/$top system query options and returns the corresponding * transformation(s). * * @returns {string} The transformation(s) corresponding to $skip/$top or "". */ function skipTop() { var sTransformation = ""; if (mQueryOptions.$skip) { sTransformation = "skip(" + mQueryOptions.$skip + ")"; } delete mQueryOptions.$skip; // delete 0 value even w/o skip(0) if (mQueryOptions.$top < Infinity) { // ignore +Infinity, undefined, NaN, ... if (sTransformation) { sTransformation += "/"; } sTransformation += "top(" + mQueryOptions.$top + ")"; } delete mQueryOptions.$top; return sTransformation; } mQueryOptions = jQuery.extend({}, mQueryOptions); checkKeys(oAggregation, mAllowedAggregationKeys2Type); oAggregation.groupLevels = oAggregation.groupLevels || []; if (oAggregation.groupLevels.length > 1) { throw new Error("More than one group level: " + oAggregation.groupLevels); } oAggregation.aggregate = oAggregation.aggregate || {}; checkKeys4AllDetails(oAggregation.aggregate, mAllowedAggregateDetails2Type); aAggregate = Object.keys(oAggregation.aggregate).sort().map(aggregate); if (bHasGrandTotal && oAggregation.groupLevels.length) { throw new Error("Cannot combine visual grouping with grand total"); } if (aAggregate.length) { sApply = "aggregate(" + aAggregate.join(",") + ")"; } oAggregation.group = oAggregation.group || {}; checkKeys4AllDetails(oAggregation.group); aGroupBy = oAggregation.groupLevels.concat( Object.keys(oAggregation.group).sort().filter(notGroupLevel)); if (aGroupBy.length) { sApply = "groupby((" + aGroupBy.join(",") + (sApply ? ")," + sApply + ")" : "))"); } if (bFollowUp) { delete mQueryOptions.$count; } else if (mQueryOptions.$count) { aConcatAggregate.push("$count as UI5__count"); delete mQueryOptions.$count; } if (mQueryOptions.$filter) { sApply += "/filter(" + mQueryOptions.$filter + ")"; delete mQueryOptions.$filter; } if (mQueryOptions.$orderby) { sApply += "/orderby(" + mQueryOptions.$orderby + ")"; delete mQueryOptions.$orderby; } if (bHasGrandTotal) { // account for grand total row if (mQueryOptions.$skip) { mQueryOptions.$skip -= 1; } else { // Note: turns undefined into NaN which is later ignored mQueryOptions.$top -= 1; } } sSkipTop = skipTop(); if (aConcatAggregate.length) { sApply += "/concat(aggregate(" + aConcatAggregate.join(",") + ")," + (sSkipTop || "identity") + ")"; } else if (sSkipTop) { sApply += "/" + sSkipTop; } mQueryOptions.$apply = sApply; return mQueryOptions; }
javascript
function (oAggregation, mQueryOptions, mAlias2MeasureAndMethod, bFollowUp) { var aAggregate, sApply = "", // concat(aggregate(???),.) content for grand totals (w/o unit) or min/max or count aConcatAggregate = [], aGroupBy, bHasGrandTotal, sSkipTop; /* * Returns the corresponding part of the "aggregate" term for an aggregatable property, * for example "AggregatableProperty with method as Alias". Processes min/max as a side * effect. * * @param {string} sAlias - An aggregatable property name * @returns {string} - Part of the "aggregate" term * @throws {Error} If "average" or "countdistinct" are used together with subtotals or * grand totals */ function aggregate(sAlias) { var oDetails = oAggregation.aggregate[sAlias], sAggregate = oDetails.name || sAlias, sGrandTotal = sAlias, sWith = oDetails.with; if (sWith) { if ((sWith === "average" || sWith === "countdistinct") && (oDetails.grandTotal || oDetails.subtotals)) { throw new Error("Cannot aggregate totals with '" + sWith + "'"); } sAggregate += " with " + sWith + " as " + sAlias; } else if (oDetails.name) { sAggregate += " as " + sAlias; } if (!bFollowUp) { if (oDetails.min) { processMinOrMax(sAlias, "min"); } if (oDetails.max) { processMinOrMax(sAlias, "max"); } } if (oDetails.grandTotal) { bHasGrandTotal = true; if (!mQueryOptions.$skip) { if (sWith) { sGrandTotal += " with " + sWith + " as UI5grand__" + sAlias; } aConcatAggregate.push(sGrandTotal); } } return sAggregate; } /* * Tells whether the given groupable property is not a group level. * * @param {string} sGroupable - A groupable property name * @returns {boolean} - Whether it is not a group level */ function notGroupLevel(sGroupable) { return oAggregation.groupLevels.indexOf(sGroupable) < 0; } /* * Builds the min/max expression for the "concat" term (for example * "AggregatableProperty with min as UI5min__AggregatableProperty") and adds a * corresponding entry to the optional alias map. * * @param {string} sName - An aggregatable property name * @param {string} sMinOrMax - Either "min" or "max" */ function processMinOrMax(sName, sMinOrMax) { var sAlias = "UI5" + sMinOrMax + "__" + sName; aConcatAggregate.push(sName + " with " + sMinOrMax + " as " + sAlias); if (mAlias2MeasureAndMethod) { mAlias2MeasureAndMethod[sAlias] = { measure : sName, method : sMinOrMax }; } } /* * Takes care of the $skip/$top system query options and returns the corresponding * transformation(s). * * @returns {string} The transformation(s) corresponding to $skip/$top or "". */ function skipTop() { var sTransformation = ""; if (mQueryOptions.$skip) { sTransformation = "skip(" + mQueryOptions.$skip + ")"; } delete mQueryOptions.$skip; // delete 0 value even w/o skip(0) if (mQueryOptions.$top < Infinity) { // ignore +Infinity, undefined, NaN, ... if (sTransformation) { sTransformation += "/"; } sTransformation += "top(" + mQueryOptions.$top + ")"; } delete mQueryOptions.$top; return sTransformation; } mQueryOptions = jQuery.extend({}, mQueryOptions); checkKeys(oAggregation, mAllowedAggregationKeys2Type); oAggregation.groupLevels = oAggregation.groupLevels || []; if (oAggregation.groupLevels.length > 1) { throw new Error("More than one group level: " + oAggregation.groupLevels); } oAggregation.aggregate = oAggregation.aggregate || {}; checkKeys4AllDetails(oAggregation.aggregate, mAllowedAggregateDetails2Type); aAggregate = Object.keys(oAggregation.aggregate).sort().map(aggregate); if (bHasGrandTotal && oAggregation.groupLevels.length) { throw new Error("Cannot combine visual grouping with grand total"); } if (aAggregate.length) { sApply = "aggregate(" + aAggregate.join(",") + ")"; } oAggregation.group = oAggregation.group || {}; checkKeys4AllDetails(oAggregation.group); aGroupBy = oAggregation.groupLevels.concat( Object.keys(oAggregation.group).sort().filter(notGroupLevel)); if (aGroupBy.length) { sApply = "groupby((" + aGroupBy.join(",") + (sApply ? ")," + sApply + ")" : "))"); } if (bFollowUp) { delete mQueryOptions.$count; } else if (mQueryOptions.$count) { aConcatAggregate.push("$count as UI5__count"); delete mQueryOptions.$count; } if (mQueryOptions.$filter) { sApply += "/filter(" + mQueryOptions.$filter + ")"; delete mQueryOptions.$filter; } if (mQueryOptions.$orderby) { sApply += "/orderby(" + mQueryOptions.$orderby + ")"; delete mQueryOptions.$orderby; } if (bHasGrandTotal) { // account for grand total row if (mQueryOptions.$skip) { mQueryOptions.$skip -= 1; } else { // Note: turns undefined into NaN which is later ignored mQueryOptions.$top -= 1; } } sSkipTop = skipTop(); if (aConcatAggregate.length) { sApply += "/concat(aggregate(" + aConcatAggregate.join(",") + ")," + (sSkipTop || "identity") + ")"; } else if (sSkipTop) { sApply += "/" + sSkipTop; } mQueryOptions.$apply = sApply; return mQueryOptions; }
[ "function", "(", "oAggregation", ",", "mQueryOptions", ",", "mAlias2MeasureAndMethod", ",", "bFollowUp", ")", "{", "var", "aAggregate", ",", "sApply", "=", "\"\"", ",", "// concat(aggregate(???),.) content for grand totals (w/o unit) or min/max or count", "aConcatAggregate", ...
Builds the value for a "$apply" system query option based on the given data aggregation information. The value is "groupby((&lt;groupable_1,...,groupable_N),aggregate( &lt;aggregatable> with &lt;method> as &lt;alias>,...))" where the "aggregate" part is only present if aggregatable properties are given and both "with" and "as" are optional. If <code>mQueryOptions.$filter</code> is given, the resulting "$apply" is extended: ".../filter(&lt;mQueryOptions.$filter>)". If <code>mQueryOptions.$orderby</code> is given, the resulting "$apply" is extended: ".../orderby(&lt;mQueryOptions.$orderby>)". If at least one aggregatable property requesting minimum or maximum values is contained, the resulting "$apply" is extended: ".../concat(aggregate(&lt;alias> with min as UI5min__&lt;alias>,&lt;alias> with max as UI5max__&lt;alias>,...),identity)". Grand total values are requested in a similar way, unless <code>mQueryOptions.$skip</code> is given. If <code>mQueryOptions.$skip</code> is given, it is inserted as a transformation: ".../skip(&lt;mQueryOptions.$skip>))". Same for <code>mQueryOptions.$top</code>. Unnecessary transformations like "identity/" or "skip(0)" are actually avoided. In case of a "concat", if <code>mQueryOptions.$count</code> is given, it is inserted as an additional aggregate "$count as UI5__count"; this way it still works with "skip()" and "top()". @param {object} oAggregation An object holding the information needed for data aggregation; see also <a href="http://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/">OData Extension for Data Aggregation Version 4.0</a>; must be a clone which is normalized as a side effect to contain all optional maps/lists @param {object} [oAggregation.aggregate] A map from aggregatable property names or aliases to objects containing the following details: <ul> <li><code>grandTotal</code>: An optional boolean that tells whether a grand total for this aggregatable property is needed (since 1.59.0) <li><code>min</code>: An optional boolean that tells whether the minimum value (ignoring currencies or units of measure) for this aggregatable property is needed <li><code>max</code>: An optional boolean that tells whether the maximum value (ignoring currencies or units of measure) for this aggregatable property is needed <li><code>subtotals</code>: An optional boolean that tells whether subtotals for this aggregatable property are needed <li><code>with</code>: An optional string that provides the name of the method (for example "sum") used for aggregation of this aggregatable property; see "3.1.2 Keyword with". Both, "average" and "countdistinct" are not supported for subtotals or grand totals. <li><code>name</code>: An optional string that provides the original aggregatable property name in case a different alias is chosen as the name of the dynamic property used for aggregation of this aggregatable property; see "3.1.1 Keyword as" </ul> @param {object} [oAggregation.group] A map from groupable property names to empty objects @param {string[]} [oAggregation.groupLevels] A list of groupable property names (which may, but don't need to be repeated in <code>oAggregation.group</code>) used to determine group levels; only a single group level is supported @param {object} [mQueryOptions={}] A map of key-value pairs representing the query string @param {boolean} [mQueryOptions.$count] The value for a "$count" system query option; it is removed from the returned map, but not from <code>mQueryOptions</code> itself, for a follow-up request or in case it is turned into an aggregate "$count as UI5__count" @param {string} [mQueryOptions.$filter] The value for a "$filter" system query option; it is removed from the returned map, but not from <code>mQueryOptions</code> itself @param {string} [mQueryOptions.$orderby] The value for a "$orderby" system query option; it is removed from the returned map, but not from <code>mQueryOptions</code> itself @param {number} [mQueryOptions.$skip] The value for a "$skip" system query option; it is removed from the returned map, but not from <code>mQueryOptions</code> itself, in case it is turned into a "skip()" transformation @param {number} [mQueryOptions.$top] The value for a "$top" system query option; it is removed from the returned map, but not from <code>mQueryOptions</code> itself, in case it is turned into a "top()" transformation @param {object} [mAlias2MeasureAndMethod] An optional map which is filled in case an aggregatable property requests minimum or maximum values; the alias (for example "UI5min__&lt;alias>") for that value becomes the key; an object with "measure" and "method" becomes the corresponding value. Note that "measure" holds the aggregatable property's alias in case "3.1.1 Keyword as" is used. @param {boolean} [bFollowUp] Tells whether this method is called for a follow-up request, not for the first one; in this case, neither the count nor minimum or maximum values are requested again and <code>mAlias2MeasureAndMethod</code> is ignored @returns {object} A map of key-value pairs representing the query string, including a value for the "$apply" system query option; it is a modified copy of <code>mQueryOptions</code> @throws {Error} If the given data aggregation object is unsupported @public
[ "Builds", "the", "value", "for", "a", "$apply", "system", "query", "option", "based", "on", "the", "given", "data", "aggregation", "information", ".", "The", "value", "is", "groupby", "((", "&lt", ";", "groupable_1", "...", "groupable_N", ")", "aggregate", "...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_AggregationHelper.js#L173-L339
train
Returns the aggregate term for an aggregatable property.
[ 30522, 3853, 1006, 1051, 8490, 17603, 12540, 1010, 1049, 4226, 2854, 7361, 9285, 1010, 16007, 3022, 2475, 4168, 3022, 5397, 5685, 11368, 6806, 2094, 1010, 28939, 14511, 5004, 6279, 1007, 1063, 13075, 9779, 13871, 2890, 5867, 1010, 20066, 22...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
muaz-khan/RTCMultiConnection
dev/MediaStreamRecorder.js
WhammyVideo
function WhammyVideo(duration, quality) { this.frames = []; if (!duration) { duration = 1; } this.duration = 1000 / duration; this.quality = quality || 0.8; }
javascript
function WhammyVideo(duration, quality) { this.frames = []; if (!duration) { duration = 1; } this.duration = 1000 / duration; this.quality = quality || 0.8; }
[ "function", "WhammyVideo", "(", "duration", ",", "quality", ")", "{", "this", ".", "frames", "=", "[", "]", ";", "if", "(", "!", "duration", ")", "{", "duration", "=", "1", ";", "}", "this", ".", "duration", "=", "1000", "/", "duration", ";", "this...
a more abstract-ish API
[ "a", "more", "abstract", "-", "ish", "API" ]
2032ce949bde30b43a3d2666e0f1e5afbf337f3d
https://github.com/muaz-khan/RTCMultiConnection/blob/2032ce949bde30b43a3d2666e0f1e5afbf337f3d/dev/MediaStreamRecorder.js#L2228-L2235
train
Whammy video
[ 30522, 3853, 1059, 3511, 8029, 17258, 8780, 1006, 9367, 1010, 3737, 1007, 1063, 2023, 1012, 11048, 1027, 1031, 1033, 1025, 2065, 1006, 999, 9367, 1007, 1063, 9367, 1027, 1015, 1025, 1065, 2023, 1012, 9367, 1027, 6694, 1013, 9367, 1025, 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...
goldfire/howler.js
examples/3d/js/camera.js
function(resolution) { this.width = canvas.width = window.innerWidth; this.height = canvas.height = window.innerHeight; this.resolution = resolution; this.spacing = this.width / resolution; this.focalLen = this.height / this.width; this.range = isMobile ? 9 : 18; this.lightRange = 9; this.scale = canvas.width / 1200; }
javascript
function(resolution) { this.width = canvas.width = window.innerWidth; this.height = canvas.height = window.innerHeight; this.resolution = resolution; this.spacing = this.width / resolution; this.focalLen = this.height / this.width; this.range = isMobile ? 9 : 18; this.lightRange = 9; this.scale = canvas.width / 1200; }
[ "function", "(", "resolution", ")", "{", "this", ".", "width", "=", "canvas", ".", "width", "=", "window", ".", "innerWidth", ";", "this", ".", "height", "=", "canvas", ".", "height", "=", "window", ".", "innerHeight", ";", "this", ".", "resolution", "...
Camera that draws everything you see on the screen from the player's perspective. @param {Number} resolution Resolution to render at (higher has better quality, but lower performance).
[ "Camera", "that", "draws", "everything", "you", "see", "on", "the", "screen", "from", "the", "player", "s", "perspective", "." ]
030db918dd8ce640afd57e172418472497e8f113
https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/examples/3d/js/camera.js#L17-L26
train
Initialize the cubemap
[ 30522, 3853, 1006, 5813, 1007, 1063, 2023, 1012, 9381, 1027, 10683, 1012, 9381, 1027, 3332, 1012, 5110, 9148, 11927, 2232, 1025, 2023, 1012, 4578, 1027, 10683, 1012, 4578, 1027, 3332, 1012, 5110, 26036, 13900, 1025, 2023, 1012, 5813, 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...
google/closure-library
closure/goog/base.js
fetchInOwnScriptThenLoad
function fetchInOwnScriptThenLoad() { /** @type {!HTMLDocument} */ var doc = goog.global.document; var key = goog.Dependency.registerCallback_(function() { goog.Dependency.unregisterCallback_(key); load(); }); var script = '<script type="text/javascript">' + goog.protectScriptTag_('goog.Dependency.callback_("' + key + '");') + '</' + 'script>'; doc.write( goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createHTML(script) : script); }
javascript
function fetchInOwnScriptThenLoad() { /** @type {!HTMLDocument} */ var doc = goog.global.document; var key = goog.Dependency.registerCallback_(function() { goog.Dependency.unregisterCallback_(key); load(); }); var script = '<script type="text/javascript">' + goog.protectScriptTag_('goog.Dependency.callback_("' + key + '");') + '</' + 'script>'; doc.write( goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createHTML(script) : script); }
[ "function", "fetchInOwnScriptThenLoad", "(", ")", "{", "/** @type {!HTMLDocument} */", "var", "doc", "=", "goog", ".", "global", ".", "document", ";", "var", "key", "=", "goog", ".", "Dependency", ".", "registerCallback_", "(", "function", "(", ")", "{", "goog...
Do not fetch now; in FireFox 47 the synchronous XHR doesn't block all events. If we fetched now and then document.write'd the contents the document.write would be an eval and would execute too soon! Instead write a script tag to fetch and eval synchronously at the correct time.
[ "Do", "not", "fetch", "now", ";", "in", "FireFox", "47", "the", "synchronous", "XHR", "doesn", "t", "block", "all", "events", ".", "If", "we", "fetched", "now", "and", "then", "document", ".", "write", "d", "the", "contents", "the", "document", ".", "w...
97390e9ca4483cebb9628e06026139fbb3023d65
https://github.com/google/closure-library/blob/97390e9ca4483cebb9628e06026139fbb3023d65/closure/goog/base.js#L3752-L3769
train
Fetch in own script then load
[ 30522, 3853, 18584, 5740, 7962, 22483, 10760, 20554, 10441, 2094, 1006, 1007, 1063, 1013, 1008, 1008, 1030, 2828, 1063, 999, 16129, 3527, 24894, 4765, 1065, 1008, 1013, 13075, 9986, 1027, 27571, 2290, 1012, 3795, 1012, 6254, 1025, 13075, 31...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
catapult-project/catapult
tracing/third_party/oboe/src/patternAdapter.js
addUnderlyingListener
function addUnderlyingListener( fullEventName, predicateEvent, compiledJsonPath ){ var emitMatch = oboeBus(fullEventName).emit; predicateEvent.on( function (ascent) { var maybeMatchingMapping = compiledJsonPath(ascent); /* Possible values for maybeMatchingMapping are now: false: we did not match an object/array/string/number/null: we matched and have the node that matched. Because nulls are valid json values this can be null. undefined: we matched but don't have the matching node yet. ie, we know there is an upcoming node that matches but we can't say anything else about it. */ if (maybeMatchingMapping !== false) { emitMatchingNode( emitMatch, nodeOf(maybeMatchingMapping), ascent ); } }, fullEventName); oboeBus('removeListener').on( function(removedEventName){ // if the fully qualified match event listener is later removed, clean up // by removing the underlying listener if it was the last using that pattern: if( removedEventName == fullEventName ) { if( !oboeBus(removedEventName).listeners( )) { predicateEvent.un( fullEventName ); } } }); }
javascript
function addUnderlyingListener( fullEventName, predicateEvent, compiledJsonPath ){ var emitMatch = oboeBus(fullEventName).emit; predicateEvent.on( function (ascent) { var maybeMatchingMapping = compiledJsonPath(ascent); /* Possible values for maybeMatchingMapping are now: false: we did not match an object/array/string/number/null: we matched and have the node that matched. Because nulls are valid json values this can be null. undefined: we matched but don't have the matching node yet. ie, we know there is an upcoming node that matches but we can't say anything else about it. */ if (maybeMatchingMapping !== false) { emitMatchingNode( emitMatch, nodeOf(maybeMatchingMapping), ascent ); } }, fullEventName); oboeBus('removeListener').on( function(removedEventName){ // if the fully qualified match event listener is later removed, clean up // by removing the underlying listener if it was the last using that pattern: if( removedEventName == fullEventName ) { if( !oboeBus(removedEventName).listeners( )) { predicateEvent.un( fullEventName ); } } }); }
[ "function", "addUnderlyingListener", "(", "fullEventName", ",", "predicateEvent", ",", "compiledJsonPath", ")", "{", "var", "emitMatch", "=", "oboeBus", "(", "fullEventName", ")", ".", "emit", ";", "predicateEvent", ".", "on", "(", "function", "(", "ascent", ")"...
/* Set up the catching of events such as NODE_CLOSED and NODE_OPENED and, if matching the specified pattern, propagate to pattern-match events such as oboeBus('node:!') @param {Function} predicateEvent either oboeBus(NODE_CLOSED) or oboeBus(NODE_OPENED). @param {Function} compiledJsonPath
[ "/", "*", "Set", "up", "the", "catching", "of", "events", "such", "as", "NODE_CLOSED", "and", "NODE_OPENED", "and", "if", "matching", "the", "specified", "pattern", "propagate", "to", "pattern", "-", "match", "events", "such", "as", "oboeBus", "(", "node", ...
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/patternAdapter.js#L48-L92
train
Add a listener to the underlying event bus.
[ 30522, 3853, 5587, 20824, 2135, 2075, 9863, 24454, 1006, 2440, 18697, 3372, 18442, 1010, 3653, 16467, 18697, 3372, 1010, 9227, 22578, 2239, 15069, 1007, 1063, 13075, 12495, 29418, 10649, 1027, 22523, 8286, 1006, 2440, 18697, 3372, 18442, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/search/FindInFiles.js
filesChanged
function filesChanged(fileList) { if (FindUtils.isNodeSearchDisabled() || !fileList || fileList.length === 0) { return; } var updateObject = { "fileList": fileList }; if (searchModel.filter) { updateObject.filesInSearchScope = FileFilters.getPathsMatchingFilter(searchModel.filter, fileList); _searchScopeChanged(); } searchDomain.exec("filesChanged", updateObject); }
javascript
function filesChanged(fileList) { if (FindUtils.isNodeSearchDisabled() || !fileList || fileList.length === 0) { return; } var updateObject = { "fileList": fileList }; if (searchModel.filter) { updateObject.filesInSearchScope = FileFilters.getPathsMatchingFilter(searchModel.filter, fileList); _searchScopeChanged(); } searchDomain.exec("filesChanged", updateObject); }
[ "function", "filesChanged", "(", "fileList", ")", "{", "if", "(", "FindUtils", ".", "isNodeSearchDisabled", "(", ")", "||", "!", "fileList", "||", "fileList", ".", "length", "===", "0", ")", "{", "return", ";", "}", "var", "updateObject", "=", "{", "\"fi...
Inform node that the list of files has changed. @param {array} fileList The list of files that changed.
[ "Inform", "node", "that", "the", "list", "of", "files", "has", "changed", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindInFiles.js#L674-L686
train
Update the search domain with the new files
[ 30522, 3853, 6764, 22305, 2098, 1006, 5371, 9863, 1007, 1063, 2065, 1006, 2424, 21823, 4877, 1012, 3475, 19847, 14644, 2818, 10521, 3085, 2094, 1006, 1007, 1064, 1064, 999, 5371, 9863, 1064, 1064, 5371, 9863, 1012, 3091, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/mvc/JSView.js
viewFactory
function viewFactory(sId, vView, bAsync) { var mSettings = {}, oView; if (vView && typeof (vView) == "string") { // instantiation sap.ui.jsview("id","name", [async]) mSettings.viewName = vView; if (typeof arguments[2] == "boolean") { mSettings.async = bAsync; } else if (typeof arguments[2] == "object") { // arguments[2] is somehow a controller mSettings.controller = arguments[2]; mSettings.async = !!arguments[3]; // optional } oView = new JSView(sId, mSettings); return oView; } else if (vView && typeof (vView) == "object") { // definition sap.ui.jsview("name",definitionObject) // sId is not given, but contains the desired value of sViewName mRegistry[sId] = vView; sap.ui.loader._.declareModule(sId.replace(/\./g, "/") + ".view.js"); Log.info("For defining views use JSView.extend instead."); } else if (arguments.length == 1 && typeof sId == "string" || arguments.length == 2 && typeof arguments[0] == "string" && typeof arguments[1] == "boolean") { // instantiation sap.ui.jsview("name", [async]) mSettings.viewName = arguments[0]; mSettings.async = !!arguments[1]; // optional /*** STEP 1: create View ***/ oView = mSettings.id ? new JSView(mSettings.id, mSettings) : new JSView(mSettings); /*** Step 3B and 4B (create and connect controller) happen in View ***/ return oView; } else { throw new Error("Wrong arguments ('" + sId + "', '" + vView + "')! Either call sap.ui.jsview([sId,] sViewName) to instantiate a View or sap.ui.jsview(sViewName, oViewImpl) to define a View type."); } }
javascript
function viewFactory(sId, vView, bAsync) { var mSettings = {}, oView; if (vView && typeof (vView) == "string") { // instantiation sap.ui.jsview("id","name", [async]) mSettings.viewName = vView; if (typeof arguments[2] == "boolean") { mSettings.async = bAsync; } else if (typeof arguments[2] == "object") { // arguments[2] is somehow a controller mSettings.controller = arguments[2]; mSettings.async = !!arguments[3]; // optional } oView = new JSView(sId, mSettings); return oView; } else if (vView && typeof (vView) == "object") { // definition sap.ui.jsview("name",definitionObject) // sId is not given, but contains the desired value of sViewName mRegistry[sId] = vView; sap.ui.loader._.declareModule(sId.replace(/\./g, "/") + ".view.js"); Log.info("For defining views use JSView.extend instead."); } else if (arguments.length == 1 && typeof sId == "string" || arguments.length == 2 && typeof arguments[0] == "string" && typeof arguments[1] == "boolean") { // instantiation sap.ui.jsview("name", [async]) mSettings.viewName = arguments[0]; mSettings.async = !!arguments[1]; // optional /*** STEP 1: create View ***/ oView = mSettings.id ? new JSView(mSettings.id, mSettings) : new JSView(mSettings); /*** Step 3B and 4B (create and connect controller) happen in View ***/ return oView; } else { throw new Error("Wrong arguments ('" + sId + "', '" + vView + "')! Either call sap.ui.jsview([sId,] sViewName) to instantiate a View or sap.ui.jsview(sViewName, oViewImpl) to define a View type."); } }
[ "function", "viewFactory", "(", "sId", ",", "vView", ",", "bAsync", ")", "{", "var", "mSettings", "=", "{", "}", ",", "oView", ";", "if", "(", "vView", "&&", "typeof", "(", "vView", ")", "==", "\"string\"", ")", "{", "// instantiation sap.ui.jsview(\"id\",...
/* The old view factory implementation
[ "/", "*", "The", "old", "view", "factory", "implementation" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/mvc/JSView.js#L166-L197
train
Creates a view instance
[ 30522, 3853, 3193, 21450, 1006, 15765, 1010, 1058, 8584, 1010, 19021, 6038, 2278, 1007, 1063, 13075, 5796, 18319, 3070, 2015, 1027, 1063, 1065, 1010, 1051, 8584, 1025, 2065, 1006, 1058, 8584, 1004, 1004, 2828, 11253, 1006, 1058, 8584, 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...
ksky521/nodeppt
packages/nodeppt-serve/config/app.js
ensureRelative
function ensureRelative(outputDir, p) { if (path.isAbsolute(p)) { return path.relative(outputDir, p); } else { return p; } }
javascript
function ensureRelative(outputDir, p) { if (path.isAbsolute(p)) { return path.relative(outputDir, p); } else { return p; } }
[ "function", "ensureRelative", "(", "outputDir", ",", "p", ")", "{", "if", "(", "path", ".", "isAbsolute", "(", "p", ")", ")", "{", "return", "path", ".", "relative", "(", "outputDir", ",", "p", ")", ";", "}", "else", "{", "return", "p", ";", "}", ...
ensure the filename passed to html-webpack-plugin is a relative path because it cannot correctly handle absolute paths
[ "ensure", "the", "filename", "passed", "to", "html", "-", "webpack", "-", "plugin", "is", "a", "relative", "path", "because", "it", "cannot", "correctly", "handle", "absolute", "paths" ]
ca77e29ef818c08b0522b31e3925b073cf159b9c
https://github.com/ksky521/nodeppt/blob/ca77e29ef818c08b0522b31e3925b073cf159b9c/packages/nodeppt-serve/config/app.js#L9-L15
train
Ensure p is relative to outputDir
[ 30522, 3853, 5676, 16570, 8082, 1006, 6434, 4305, 2099, 1010, 1052, 1007, 1063, 2065, 1006, 4130, 1012, 18061, 5910, 4747, 10421, 1006, 1052, 1007, 1007, 1063, 2709, 4130, 1012, 5816, 1006, 6434, 4305, 2099, 1010, 1052, 1007, 1025, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
fex-team/webuploader
dist/webuploader.withoutimage.js
Runtime
function Runtime( options ) { this.options = $.extend({ container: document.body }, options ); this.uid = Base.guid('rt_'); }
javascript
function Runtime( options ) { this.options = $.extend({ container: document.body }, options ); this.uid = Base.guid('rt_'); }
[ "function", "Runtime", "(", "options", ")", "{", "this", ".", "options", "=", "$", ".", "extend", "(", "{", "container", ":", "document", ".", "body", "}", ",", "options", ")", ";", "this", ".", "uid", "=", "Base", ".", "guid", "(", "'rt_'", ")", ...
接口类。
[ "接口类。" ]
7094e4476c5af3b06993d91dde2d223200b9feb7
https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/dist/webuploader.withoutimage.js#L930-L935
train
Runtime constructor.
[ 30522, 3853, 2448, 7292, 1006, 7047, 1007, 1063, 2023, 1012, 7047, 1027, 1002, 1012, 7949, 1006, 1063, 11661, 1024, 6254, 1012, 2303, 1065, 1010, 7047, 1007, 1025, 2023, 1012, 21318, 2094, 1027, 2918, 1012, 26458, 2094, 1006, 1005, 19387, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/utils/ValidationUtils.js
isIntegerInRange
function isIntegerInRange(value, lowerLimit, upperLimit) { // Validate value is an integer if (!isInteger(value)) { return false; } // Validate integer is in range var hasLowerLimt = (typeof (lowerLimit) === "number"), hasUpperLimt = (typeof (upperLimit) === "number"); return ((!hasLowerLimt || value >= lowerLimit) && (!hasUpperLimt || value <= upperLimit)); }
javascript
function isIntegerInRange(value, lowerLimit, upperLimit) { // Validate value is an integer if (!isInteger(value)) { return false; } // Validate integer is in range var hasLowerLimt = (typeof (lowerLimit) === "number"), hasUpperLimt = (typeof (upperLimit) === "number"); return ((!hasLowerLimt || value >= lowerLimit) && (!hasUpperLimt || value <= upperLimit)); }
[ "function", "isIntegerInRange", "(", "value", ",", "lowerLimit", ",", "upperLimit", ")", "{", "// Validate value is an integer", "if", "(", "!", "isInteger", "(", "value", ")", ")", "{", "return", "false", ";", "}", "// Validate integer is in range", "var", "hasLo...
Used to validate whether type of unknown value is an integer, and, if so, is it within the option lower and upper limits. @param {*} value Value for which to validate its type @param {number=} lowerLimit Optional lower limit (inclusive) @param {number=} upperLimit Optional upper limit (inclusive) @return {boolean} true if value is an interger, and optionally in specified range.
[ "Used", "to", "validate", "whether", "type", "of", "unknown", "value", "is", "an", "integer", "and", "if", "so", "is", "it", "within", "the", "option", "lower", "and", "upper", "limits", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/ValidationUtils.js#L62-L73
train
Check if value is an integer in the range lowerLimit and upperLimit
[ 30522, 3853, 2003, 18447, 26320, 2378, 24388, 2063, 1006, 3643, 1010, 2896, 17960, 4183, 1010, 3356, 17960, 4183, 1007, 1063, 1013, 1013, 9398, 3686, 3643, 2003, 2019, 16109, 2065, 1006, 999, 2003, 18447, 26320, 1006, 3643, 1007, 1007, 1063...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/prefer-template.js
startsWithTemplateCurly
function startsWithTemplateCurly(node) { if (node.type === "BinaryExpression") { return startsWithTemplateCurly(node.left); } if (node.type === "TemplateLiteral") { return node.expressions.length && node.quasis.length && node.quasis[0].range[0] === node.quasis[0].range[1]; } return node.type !== "Literal" || typeof node.value !== "string"; }
javascript
function startsWithTemplateCurly(node) { if (node.type === "BinaryExpression") { return startsWithTemplateCurly(node.left); } if (node.type === "TemplateLiteral") { return node.expressions.length && node.quasis.length && node.quasis[0].range[0] === node.quasis[0].range[1]; } return node.type !== "Literal" || typeof node.value !== "string"; }
[ "function", "startsWithTemplateCurly", "(", "node", ")", "{", "if", "(", "node", ".", "type", "===", "\"BinaryExpression\"", ")", "{", "return", "startsWithTemplateCurly", "(", "node", ".", "left", ")", ";", "}", "if", "(", "node", ".", "type", "===", "\"T...
Determines whether a given node will start with a template curly expression (`${}`) when being converted to a template literal. @param {ASTNode} node The node that will be fixed to a template literal @returns {boolean} `true` if the node will start with a template curly.
[ "Determines", "whether", "a", "given", "node", "will", "start", "with", "a", "template", "curly", "expression", "(", "$", "{}", ")", "when", "being", "converted", "to", "a", "template", "literal", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-template.js#L113-L121
train
Returns true if the node is a template curly
[ 30522, 3853, 4627, 24415, 18532, 15725, 10841, 21194, 1006, 13045, 1007, 1063, 2065, 1006, 13045, 1012, 2828, 1027, 1027, 1027, 1000, 12441, 10288, 20110, 3258, 1000, 1007, 1063, 2709, 4627, 24415, 18532, 15725, 10841, 21194, 1006, 13045, 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/39_xlsbiff.js
parse_XLSCell
function parse_XLSCell(blob/*::, length*/)/*:Cell*/ { var rw = blob.read_shift(2); // 0-indexed var col = blob.read_shift(2); var ixfe = blob.read_shift(2); return ({r:rw, c:col, ixfe:ixfe}/*:any*/); }
javascript
function parse_XLSCell(blob/*::, length*/)/*:Cell*/ { var rw = blob.read_shift(2); // 0-indexed var col = blob.read_shift(2); var ixfe = blob.read_shift(2); return ({r:rw, c:col, ixfe:ixfe}/*:any*/); }
[ "function", "parse_XLSCell", "(", "blob", "/*::, length*/", ")", "/*:Cell*/", "{", "var", "rw", "=", "blob", ".", "read_shift", "(", "2", ")", ";", "// 0-indexed", "var", "col", "=", "blob", ".", "read_shift", "(", "2", ")", ";", "var", "ixfe", "=", "b...
/* [MS-XLS] 2.5.19
[ "/", "*", "[", "MS", "-", "XLS", "]", "2", ".", "5", ".", "19" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/39_xlsbiff.js#L2-L7
train
Parse an LXSCell
[ 30522, 3853, 11968, 3366, 1035, 28712, 11020, 5349, 1006, 1038, 4135, 2497, 1013, 1008, 1024, 1024, 1010, 3091, 1008, 1013, 1007, 1013, 1008, 1024, 3526, 1008, 1013, 1063, 13075, 1054, 2860, 1027, 1038, 4135, 2497, 1012, 3191, 1035, 5670, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dequelabs/axe-core
lib/core/public/run.js
normalizeRunParams
function normalizeRunParams(context, options, callback) { 'use strict'; let typeErr = new TypeError('axe.run arguments are invalid'); // Determine the context if (!isContext(context)) { if (callback !== undefined) { // Either context is invalid or there are too many params throw typeErr; } // Set default and shift one over callback = options; options = context; context = document; } // Determine the options if (typeof options !== 'object') { if (callback !== undefined) { // Either options is invalid or there are too many params throw typeErr; } // Set default and shift one over callback = options; options = {}; } // Set the callback or noop; if (typeof callback !== 'function' && callback !== undefined) { throw typeErr; } return { context: context, options: options, callback: callback || noop }; }
javascript
function normalizeRunParams(context, options, callback) { 'use strict'; let typeErr = new TypeError('axe.run arguments are invalid'); // Determine the context if (!isContext(context)) { if (callback !== undefined) { // Either context is invalid or there are too many params throw typeErr; } // Set default and shift one over callback = options; options = context; context = document; } // Determine the options if (typeof options !== 'object') { if (callback !== undefined) { // Either options is invalid or there are too many params throw typeErr; } // Set default and shift one over callback = options; options = {}; } // Set the callback or noop; if (typeof callback !== 'function' && callback !== undefined) { throw typeErr; } return { context: context, options: options, callback: callback || noop }; }
[ "function", "normalizeRunParams", "(", "context", ",", "options", ",", "callback", ")", "{", "'use strict'", ";", "let", "typeErr", "=", "new", "TypeError", "(", "'axe.run arguments are invalid'", ")", ";", "// Determine the context", "if", "(", "!", "isContext", ...
Normalize the optional params of axe.run() @param {object} context @param {object} options @param {Function} callback @return {object} With 3 keys: context, options, callback
[ "Normalize", "the", "optional", "params", "of", "axe", ".", "run", "()" ]
727323c07980e2291575f545444d389fb942906f
https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/public/run.js#L32-L69
train
Normalizes the run parameters
[ 30522, 3853, 3671, 17629, 4609, 28689, 5244, 1006, 6123, 1010, 7047, 1010, 2655, 5963, 1007, 1063, 1005, 2224, 9384, 1005, 1025, 2292, 2828, 2121, 2099, 1027, 2047, 2828, 2121, 29165, 1006, 1005, 12946, 1012, 2448, 9918, 2024, 19528, 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...
adobe/brackets
src/command/Menus.js
MenuItem
function MenuItem(id, command) { this.id = id; this.isDivider = (command === DIVIDER); this.isNative = false; if (!this.isDivider && command !== SUBMENU) { // Bind event handlers this._enabledChanged = this._enabledChanged.bind(this); this._checkedChanged = this._checkedChanged.bind(this); this._nameChanged = this._nameChanged.bind(this); this._keyBindingAdded = this._keyBindingAdded.bind(this); this._keyBindingRemoved = this._keyBindingRemoved.bind(this); this._command = command; this._command .on("enabledStateChange", this._enabledChanged) .on("checkedStateChange", this._checkedChanged) .on("nameChange", this._nameChanged) .on("keyBindingAdded", this._keyBindingAdded) .on("keyBindingRemoved", this._keyBindingRemoved); } }
javascript
function MenuItem(id, command) { this.id = id; this.isDivider = (command === DIVIDER); this.isNative = false; if (!this.isDivider && command !== SUBMENU) { // Bind event handlers this._enabledChanged = this._enabledChanged.bind(this); this._checkedChanged = this._checkedChanged.bind(this); this._nameChanged = this._nameChanged.bind(this); this._keyBindingAdded = this._keyBindingAdded.bind(this); this._keyBindingRemoved = this._keyBindingRemoved.bind(this); this._command = command; this._command .on("enabledStateChange", this._enabledChanged) .on("checkedStateChange", this._checkedChanged) .on("nameChange", this._nameChanged) .on("keyBindingAdded", this._keyBindingAdded) .on("keyBindingRemoved", this._keyBindingRemoved); } }
[ "function", "MenuItem", "(", "id", ",", "command", ")", "{", "this", ".", "id", "=", "id", ";", "this", ".", "isDivider", "=", "(", "command", "===", "DIVIDER", ")", ";", "this", ".", "isNative", "=", "false", ";", "if", "(", "!", "this", ".", "i...
MenuItem represents a single menu item that executes a Command or a menu divider. MenuItems may have a sub-menu. A MenuItem may correspond to an HTML-based menu item or a native menu item if Brackets is running in a native application shell Since MenuItems may have a native implementation clients should create MenuItems through addMenuItem() and should NOT construct a MenuItem object directly. Clients should also not access HTML content of a menu directly and instead use the MenuItem API to query and modify menus items. MenuItems are views on to Command objects so modify the underlying Command to modify the name, enabled, and checked state of a MenuItem. The MenuItem will update automatically @constructor @private @param {string} id @param {string|Command} command - the Command this MenuItem will reflect. Use DIVIDER to specify a menu divider
[ "MenuItem", "represents", "a", "single", "menu", "item", "that", "executes", "a", "Command", "or", "a", "menu", "divider", ".", "MenuItems", "may", "have", "a", "sub", "-", "menu", ".", "A", "MenuItem", "may", "correspond", "to", "an", "HTML", "-", "base...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/Menus.js#L309-L330
train
MenuItem constructor.
[ 30522, 3853, 12183, 4221, 2213, 1006, 8909, 1010, 3094, 1007, 1063, 2023, 1012, 8909, 1027, 8909, 1025, 2023, 1012, 2003, 4305, 17258, 2121, 1027, 1006, 3094, 1027, 1027, 1027, 11443, 2099, 1007, 1025, 2023, 1012, 3475, 8082, 1027, 6270, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
mochajs/mocha
lib/browser/growl.js
display
function display(runner) { var stats = runner.stats; var symbol = { cross: '\u274C', tick: '\u2705' }; var logo = require('../../package').notifyLogo; var _message; var message; var title; if (stats.failures) { _message = stats.failures + ' of ' + stats.tests + ' tests failed'; message = symbol.cross + ' ' + _message; title = 'Failed'; } else { _message = stats.passes + ' tests passed in ' + stats.duration + 'ms'; message = symbol.tick + ' ' + _message; title = 'Passed'; } // Send notification var options = { badge: logo, body: message, dir: 'ltr', icon: logo, lang: 'en-US', name: 'mocha', requireInteraction: false, timestamp: Date.now() }; var notification = new Notification(title, options); // Autoclose after brief delay (makes various browsers act same) var FORCE_DURATION = 4000; setTimeout(notification.close.bind(notification), FORCE_DURATION); }
javascript
function display(runner) { var stats = runner.stats; var symbol = { cross: '\u274C', tick: '\u2705' }; var logo = require('../../package').notifyLogo; var _message; var message; var title; if (stats.failures) { _message = stats.failures + ' of ' + stats.tests + ' tests failed'; message = symbol.cross + ' ' + _message; title = 'Failed'; } else { _message = stats.passes + ' tests passed in ' + stats.duration + 'ms'; message = symbol.tick + ' ' + _message; title = 'Passed'; } // Send notification var options = { badge: logo, body: message, dir: 'ltr', icon: logo, lang: 'en-US', name: 'mocha', requireInteraction: false, timestamp: Date.now() }; var notification = new Notification(title, options); // Autoclose after brief delay (makes various browsers act same) var FORCE_DURATION = 4000; setTimeout(notification.close.bind(notification), FORCE_DURATION); }
[ "function", "display", "(", "runner", ")", "{", "var", "stats", "=", "runner", ".", "stats", ";", "var", "symbol", "=", "{", "cross", ":", "'\\u274C'", ",", "tick", ":", "'\\u2705'", "}", ";", "var", "logo", "=", "require", "(", "'../../package'", ")",...
Displays the notification. @private @param {Runner} runner - Runner instance.
[ "Displays", "the", "notification", "." ]
9b00fedb610241e33f7592c40164e42a38a793cf
https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/browser/growl.js#L121-L158
train
Display the test results
[ 30522, 3853, 4653, 1006, 5479, 1007, 1063, 13075, 26319, 1027, 5479, 1012, 26319, 1025, 13075, 6454, 1027, 1063, 2892, 1024, 1005, 1032, 23343, 2581, 2549, 2278, 1005, 1010, 16356, 1024, 1005, 1032, 23343, 19841, 2629, 1005, 1065, 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...
apache/incubator-echarts
src/component/brush/BrushModel.js
function (areas) { if (__DEV__) { zrUtil.assert(zrUtil.isArray(areas)); zrUtil.each(areas, function (area) { zrUtil.assert(area.brushType, 'Illegal areas'); }); } // If ranges is null/undefined, range state remain. // This helps user to dispatchAction({type: 'brush'}) with no areas // set but just want to get the current brush select info from a `brush` event. if (!areas) { return; } this.areas = zrUtil.map(areas, function (area) { return generateBrushOption(this.option, area); }, this); }
javascript
function (areas) { if (__DEV__) { zrUtil.assert(zrUtil.isArray(areas)); zrUtil.each(areas, function (area) { zrUtil.assert(area.brushType, 'Illegal areas'); }); } // If ranges is null/undefined, range state remain. // This helps user to dispatchAction({type: 'brush'}) with no areas // set but just want to get the current brush select info from a `brush` event. if (!areas) { return; } this.areas = zrUtil.map(areas, function (area) { return generateBrushOption(this.option, area); }, this); }
[ "function", "(", "areas", ")", "{", "if", "(", "__DEV__", ")", "{", "zrUtil", ".", "assert", "(", "zrUtil", ".", "isArray", "(", "areas", ")", ")", ";", "zrUtil", ".", "each", "(", "areas", ",", "function", "(", "area", ")", "{", "zrUtil", ".", "...
If ranges is null/undefined, range state remain. @param {Array.<Object>} [ranges]
[ "If", "ranges", "is", "null", "/", "undefined", "range", "state", "remain", "." ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/brush/BrushModel.js#L120-L138
train
Set the current brush area
[ 30522, 3853, 1006, 2752, 1007, 1063, 2065, 1006, 1035, 1035, 16475, 1035, 1035, 1007, 1063, 1062, 22134, 4014, 1012, 20865, 1006, 1062, 22134, 4014, 1012, 18061, 11335, 2100, 1006, 2752, 1007, 1007, 1025, 1062, 22134, 4014, 1012, 2169, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/hasher.js
function(){ if(! _isActive) return; if(_isHashChangeSupported){ _removeListener(window, 'hashchange', _checkHistory); }else{ clearInterval(_checkInterval); _checkInterval = null; } _isActive = false; hasher.stopped.dispatch(_trimHash(_hash)); }
javascript
function(){ if(! _isActive) return; if(_isHashChangeSupported){ _removeListener(window, 'hashchange', _checkHistory); }else{ clearInterval(_checkInterval); _checkInterval = null; } _isActive = false; hasher.stopped.dispatch(_trimHash(_hash)); }
[ "function", "(", ")", "{", "if", "(", "!", "_isActive", ")", "return", ";", "if", "(", "_isHashChangeSupported", ")", "{", "_removeListener", "(", "window", ",", "'hashchange'", ",", "_checkHistory", ")", ";", "}", "else", "{", "clearInterval", "(", "_chec...
Stop listening/dispatching changes in the hash/history. <ul> <li>hasher won't dispatch CHANGE events by manually typing a new value or pressing the back/forward buttons after calling this method, unless you call hasher.init() again.</li> <li>hasher will still dispatch changes made programatically by calling hasher.setHash();</li> </ul>
[ "Stop", "listening", "/", "dispatching", "changes", "in", "the", "hash", "/", "history", ".", "<ul", ">", "<li", ">", "hasher", "won", "t", "dispatch", "CHANGE", "events", "by", "manually", "typing", "a", "new", "value", "or", "pressing", "the", "back", ...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/hasher.js#L319-L331
train
Stop the hashchange check
[ 30522, 3853, 1006, 1007, 1063, 2065, 1006, 999, 1035, 18061, 15277, 1007, 2709, 1025, 2065, 1006, 1035, 2003, 14949, 16257, 18003, 2229, 6279, 6442, 2098, 1007, 1063, 1035, 6366, 9863, 24454, 1006, 3332, 1010, 1005, 23325, 22305, 2063, 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...
adobe/brackets
src/extensions/default/RecentProjects/main.js
showDropdown
function showDropdown(position) { // If the dropdown is already visible, just return (so the root click handler on html // will close it). if ($dropdown) { return; } Menus.closeAll(); $dropdown = $(renderList()) .css({ left: position.pageX, top: position.pageY }) .appendTo($("body")); PopUpManager.addPopUp($dropdown, cleanupDropdown, true); // TODO: should use capture, otherwise clicking on the menus doesn't close it. More fallout // from the fact that we can't use the Boostrap (1.4) dropdowns. $("html").on("click", closeDropdown); // Hide the menu if the user scrolls in the project tree. Otherwise the Lion scrollbar // overlaps it. // TODO: This duplicates logic that's already in ProjectManager (which calls Menus.close()). // We should fix this when the popup handling is centralized in PopupManager, as well // as making Esc close the dropdown. See issue #1381. $("#project-files-container").on("scroll", closeDropdown); // Note: PopUpManager will automatically hide the sidebar in other cases, such as when a // command is run, Esc is pressed, or the menu is focused. // Hacky: if we detect a click in the menubar, close ourselves. // TODO: again, we should have centralized popup management. $("#titlebar .nav").on("click", closeDropdown); _handleListEvents(); $(window).on("keydown", keydownHook); }
javascript
function showDropdown(position) { // If the dropdown is already visible, just return (so the root click handler on html // will close it). if ($dropdown) { return; } Menus.closeAll(); $dropdown = $(renderList()) .css({ left: position.pageX, top: position.pageY }) .appendTo($("body")); PopUpManager.addPopUp($dropdown, cleanupDropdown, true); // TODO: should use capture, otherwise clicking on the menus doesn't close it. More fallout // from the fact that we can't use the Boostrap (1.4) dropdowns. $("html").on("click", closeDropdown); // Hide the menu if the user scrolls in the project tree. Otherwise the Lion scrollbar // overlaps it. // TODO: This duplicates logic that's already in ProjectManager (which calls Menus.close()). // We should fix this when the popup handling is centralized in PopupManager, as well // as making Esc close the dropdown. See issue #1381. $("#project-files-container").on("scroll", closeDropdown); // Note: PopUpManager will automatically hide the sidebar in other cases, such as when a // command is run, Esc is pressed, or the menu is focused. // Hacky: if we detect a click in the menubar, close ourselves. // TODO: again, we should have centralized popup management. $("#titlebar .nav").on("click", closeDropdown); _handleListEvents(); $(window).on("keydown", keydownHook); }
[ "function", "showDropdown", "(", "position", ")", "{", "// If the dropdown is already visible, just return (so the root click handler on html", "// will close it).", "if", "(", "$dropdown", ")", "{", "return", ";", "}", "Menus", ".", "closeAll", "(", ")", ";", "$dropdown"...
Show or hide the recent projects dropdown. @param {{pageX:number, pageY:number}} position - the absolute position where to open the dropdown
[ "Show", "or", "hide", "the", "recent", "projects", "dropdown", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/RecentProjects/main.js#L376-L414
train
Show the dropdown
[ 30522, 3853, 2265, 25711, 7698, 1006, 2597, 1007, 1063, 1013, 1013, 2065, 1996, 4530, 7698, 2003, 2525, 5710, 1010, 2074, 2709, 1006, 2061, 1996, 7117, 11562, 28213, 2006, 16129, 1013, 1013, 2097, 2485, 2009, 1007, 1012, 2065, 1006, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netlify/netlify-cms
packages/netlify-cms-widget-markdown/src/serializers/remarkSlate.js
createInline
function createInline(type, props = {}, nodes) { const node = { object: 'inline', type, ...props }; return addNodes(node, nodes); }
javascript
function createInline(type, props = {}, nodes) { const node = { object: 'inline', type, ...props }; return addNodes(node, nodes); }
[ "function", "createInline", "(", "type", ",", "props", "=", "{", "}", ",", "nodes", ")", "{", "const", "node", "=", "{", "object", ":", "'inline'", ",", "type", ",", "...", "props", "}", ";", "return", "addNodes", "(", "node", ",", "nodes", ")", ";...
Create a Slate Block node.
[ "Create", "a", "Slate", "Block", "node", "." ]
2488556590cbfdcefa626f2f2de01e7a160cf6ee
https://github.com/netlify/netlify-cms/blob/2488556590cbfdcefa626f2f2de01e7a160cf6ee/packages/netlify-cms-widget-markdown/src/serializers/remarkSlate.js#L81-L84
train
Create inline node
[ 30522, 3853, 3443, 2378, 4179, 1006, 2828, 1010, 24387, 30524, 2828, 1010, 1012, 1012, 1012, 24387, 1065, 1025, 2709, 5587, 3630, 6155, 1006, 13045, 1010, 14164, 1007, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/less.js
function (str, callback, additionalData) { var root, line, lines, error = null, globalVars, modifyVars, preText = ""; i = j = currentPos = furthest = 0; globalVars = (additionalData && additionalData.globalVars) ? less.Parser.serializeVars(additionalData.globalVars) + '\n' : ''; modifyVars = (additionalData && additionalData.modifyVars) ? '\n' + less.Parser.serializeVars(additionalData.modifyVars) : ''; if (globalVars || (additionalData && additionalData.banner)) { preText = ((additionalData && additionalData.banner) ? additionalData.banner : "") + globalVars; parser.imports.contentsIgnoredChars[env.currentFileInfo.filename] = preText.length; } str = str.replace(/\r\n/g, '\n'); // Remove potential UTF Byte Order Mark input = str = preText + str.replace(/^\uFEFF/, '') + modifyVars; parser.imports.contents[env.currentFileInfo.filename] = str; // Split the input into chunks. chunks = (function (input) { var len = input.length, level = 0, parenLevel = 0, lastOpening, lastOpeningParen, lastMultiComment, lastMultiCommentEndBrace, chunks = [], emitFrom = 0, parserCurrentIndex, currentChunkStartIndex, cc, cc2, matched; function fail(msg, index) { error = new(LessError)({ index: index || parserCurrentIndex, type: 'Parse', message: msg, filename: env.currentFileInfo.filename }, env); } function emitChunk(force) { var len = parserCurrentIndex - emitFrom; if (((len < 512) && !force) || !len) { return; } chunks.push(input.slice(emitFrom, parserCurrentIndex + 1)); emitFrom = parserCurrentIndex + 1; } for (parserCurrentIndex = 0; parserCurrentIndex < len; parserCurrentIndex++) { cc = input.charCodeAt(parserCurrentIndex); if (((cc >= 97) && (cc <= 122)) || (cc < 34)) { // a-z or whitespace continue; } switch (cc) { case 40: // ( parenLevel++; lastOpeningParen = parserCurrentIndex; continue; case 41: // ) if (--parenLevel < 0) { return fail("missing opening `(`"); } continue; case 59: // ; if (!parenLevel) { emitChunk(); } continue; case 123: // { level++; lastOpening = parserCurrentIndex; continue; case 125: // } if (--level < 0) { return fail("missing opening `{`"); } if (!level) { emitChunk(); } continue; case 92: // \ if (parserCurrentIndex < len - 1) { parserCurrentIndex++; continue; } return fail("unescaped `\\`"); case 34: case 39: case 96: // ", ' and ` matched = 0; currentChunkStartIndex = parserCurrentIndex; for (parserCurrentIndex = parserCurrentIndex + 1; parserCurrentIndex < len; parserCurrentIndex++) { cc2 = input.charCodeAt(parserCurrentIndex); if (cc2 > 96) { continue; } if (cc2 == cc) { matched = 1; break; } if (cc2 == 92) { // \ if (parserCurrentIndex == len - 1) { return fail("unescaped `\\`"); } parserCurrentIndex++; } } if (matched) { continue; } return fail("unmatched `" + String.fromCharCode(cc) + "`", currentChunkStartIndex); case 47: // /, check for comment if (parenLevel || (parserCurrentIndex == len - 1)) { continue; } cc2 = input.charCodeAt(parserCurrentIndex + 1); if (cc2 == 47) { // //, find lnfeed for (parserCurrentIndex = parserCurrentIndex + 2; parserCurrentIndex < len; parserCurrentIndex++) { cc2 = input.charCodeAt(parserCurrentIndex); if ((cc2 <= 13) && ((cc2 == 10) || (cc2 == 13))) { break; } } } else if (cc2 == 42) { // /*, find */ lastMultiComment = currentChunkStartIndex = parserCurrentIndex; for (parserCurrentIndex = parserCurrentIndex + 2; parserCurrentIndex < len - 1; parserCurrentIndex++) { cc2 = input.charCodeAt(parserCurrentIndex); if (cc2 == 125) { lastMultiCommentEndBrace = parserCurrentIndex; } if (cc2 != 42) { continue; } if (input.charCodeAt(parserCurrentIndex + 1) == 47) { break; } } if (parserCurrentIndex == len - 1) { return fail("missing closing `*/`", currentChunkStartIndex); } parserCurrentIndex++; } continue; case 42: // *, check for unmatched */ if ((parserCurrentIndex < len - 1) && (input.charCodeAt(parserCurrentIndex + 1) == 47)) { return fail("unmatched `/*`"); } continue; } } if (level !== 0) { if ((lastMultiComment > lastOpening) && (lastMultiCommentEndBrace > lastMultiComment)) { return fail("missing closing `}` or `*/`", lastOpening); } else { return fail("missing closing `}`", lastOpening); } } else if (parenLevel !== 0) { return fail("missing closing `)`", lastOpeningParen); } emitChunk(true); return chunks; })(str); if (error) { return callback(new(LessError)(error, env)); } current = chunks[0]; // Start with the primary rule. // The whole syntax tree is held under a Ruleset node, // with the `root` property set to true, so no `{}` are // output. The callback is called when the input is parsed. try { root = new(tree.Ruleset)(null, this.parsers.primary()); root.root = true; root.firstRoot = true; } catch (e) { return callback(new(LessError)(e, env)); } root.toCSS = (function (evaluate) { return function (options, variables) { options = options || {}; var evaldRoot, css, evalEnv = new tree.evalEnv(options); // // Allows setting variables with a hash, so: // // `{ color: new(tree.Color)('#f01') }` will become: // // new(tree.Rule)('@color', // new(tree.Value)([ // new(tree.Expression)([ // new(tree.Color)('#f01') // ]) // ]) // ) // if (typeof(variables) === 'object' && !Array.isArray(variables)) { variables = Object.keys(variables).map(function (k) { var value = variables[k]; if (! (value instanceof tree.Value)) { if (! (value instanceof tree.Expression)) { value = new(tree.Expression)([value]); } value = new(tree.Value)([value]); } return new(tree.Rule)('@' + k, value, false, null, 0); }); evalEnv.frames = [new(tree.Ruleset)(null, variables)]; } try { var preEvalVisitors = [], visitors = [ new(tree.joinSelectorVisitor)(), new(tree.processExtendsVisitor)(), new(tree.toCSSVisitor)({compress: Boolean(options.compress)}) ], i, root = this; if (options.plugins) { for(i =0; i < options.plugins.length; i++) { if (options.plugins[i].isPreEvalVisitor) { preEvalVisitors.push(options.plugins[i]); } else { if (options.plugins[i].isPreVisitor) { visitors.splice(0, 0, options.plugins[i]); } else { visitors.push(options.plugins[i]); } } } } for(i = 0; i < preEvalVisitors.length; i++) { preEvalVisitors[i].run(root); } evaldRoot = evaluate.call(root, evalEnv); for(i = 0; i < visitors.length; i++) { visitors[i].run(evaldRoot); } if (options.sourceMap) { evaldRoot = new tree.sourceMapOutput( { contentsIgnoredCharsMap: parser.imports.contentsIgnoredChars, writeSourceMap: options.writeSourceMap, rootNode: evaldRoot, contentsMap: parser.imports.contents, sourceMapFilename: options.sourceMapFilename, sourceMapURL: options.sourceMapURL, outputFilename: options.sourceMapOutputFilename, sourceMapBasepath: options.sourceMapBasepath, sourceMapRootpath: options.sourceMapRootpath, outputSourceFiles: options.outputSourceFiles, sourceMapGenerator: options.sourceMapGenerator }); } css = evaldRoot.toCSS({ compress: Boolean(options.compress), dumpLineNumbers: env.dumpLineNumbers, strictUnits: Boolean(options.strictUnits), numPrecision: 8}); } catch (e) { throw new(LessError)(e, env); } if (options.cleancss && less.mode === 'node') { var CleanCSS = require('clean-css'), cleancssOptions = options.cleancssOptions || {}; if (cleancssOptions.keepSpecialComments === undefined) { cleancssOptions.keepSpecialComments = "*"; } cleancssOptions.processImport = false; cleancssOptions.noRebase = true; if (cleancssOptions.noAdvanced === undefined) { cleancssOptions.noAdvanced = true; } return new CleanCSS(cleancssOptions).minify(css); } else if (options.compress) { return css.replace(/(^(\s)+)|((\s)+$)/g, ""); } else { return css; } }; })(root.eval); // If `i` is smaller than the `input.length - 1`, // it means the parser wasn't able to parse the whole // string, so we've got a parsing error. // // We try to extract a \n delimited string, // showing the line where the parse error occured. // We split it up into two parts (the part which parsed, // and the part which didn't), so we can color them differently. if (i < input.length - 1) { i = furthest; var loc = getLocation(i, input); lines = input.split('\n'); line = loc.line + 1; error = { type: "Parse", message: "Unrecognised input", index: i, filename: env.currentFileInfo.filename, line: line, column: loc.column, extract: [ lines[line - 2], lines[line - 1], lines[line] ] }; } var finish = function (e) { e = error || e || parser.imports.error; if (e) { if (!(e instanceof LessError)) { e = new(LessError)(e, env); } return callback(e); } else { return callback(null, root); } }; if (env.processImports !== false) { new tree.importVisitor(this.imports, finish) .run(root); } else { return finish(); } }
javascript
function (str, callback, additionalData) { var root, line, lines, error = null, globalVars, modifyVars, preText = ""; i = j = currentPos = furthest = 0; globalVars = (additionalData && additionalData.globalVars) ? less.Parser.serializeVars(additionalData.globalVars) + '\n' : ''; modifyVars = (additionalData && additionalData.modifyVars) ? '\n' + less.Parser.serializeVars(additionalData.modifyVars) : ''; if (globalVars || (additionalData && additionalData.banner)) { preText = ((additionalData && additionalData.banner) ? additionalData.banner : "") + globalVars; parser.imports.contentsIgnoredChars[env.currentFileInfo.filename] = preText.length; } str = str.replace(/\r\n/g, '\n'); // Remove potential UTF Byte Order Mark input = str = preText + str.replace(/^\uFEFF/, '') + modifyVars; parser.imports.contents[env.currentFileInfo.filename] = str; // Split the input into chunks. chunks = (function (input) { var len = input.length, level = 0, parenLevel = 0, lastOpening, lastOpeningParen, lastMultiComment, lastMultiCommentEndBrace, chunks = [], emitFrom = 0, parserCurrentIndex, currentChunkStartIndex, cc, cc2, matched; function fail(msg, index) { error = new(LessError)({ index: index || parserCurrentIndex, type: 'Parse', message: msg, filename: env.currentFileInfo.filename }, env); } function emitChunk(force) { var len = parserCurrentIndex - emitFrom; if (((len < 512) && !force) || !len) { return; } chunks.push(input.slice(emitFrom, parserCurrentIndex + 1)); emitFrom = parserCurrentIndex + 1; } for (parserCurrentIndex = 0; parserCurrentIndex < len; parserCurrentIndex++) { cc = input.charCodeAt(parserCurrentIndex); if (((cc >= 97) && (cc <= 122)) || (cc < 34)) { // a-z or whitespace continue; } switch (cc) { case 40: // ( parenLevel++; lastOpeningParen = parserCurrentIndex; continue; case 41: // ) if (--parenLevel < 0) { return fail("missing opening `(`"); } continue; case 59: // ; if (!parenLevel) { emitChunk(); } continue; case 123: // { level++; lastOpening = parserCurrentIndex; continue; case 125: // } if (--level < 0) { return fail("missing opening `{`"); } if (!level) { emitChunk(); } continue; case 92: // \ if (parserCurrentIndex < len - 1) { parserCurrentIndex++; continue; } return fail("unescaped `\\`"); case 34: case 39: case 96: // ", ' and ` matched = 0; currentChunkStartIndex = parserCurrentIndex; for (parserCurrentIndex = parserCurrentIndex + 1; parserCurrentIndex < len; parserCurrentIndex++) { cc2 = input.charCodeAt(parserCurrentIndex); if (cc2 > 96) { continue; } if (cc2 == cc) { matched = 1; break; } if (cc2 == 92) { // \ if (parserCurrentIndex == len - 1) { return fail("unescaped `\\`"); } parserCurrentIndex++; } } if (matched) { continue; } return fail("unmatched `" + String.fromCharCode(cc) + "`", currentChunkStartIndex); case 47: // /, check for comment if (parenLevel || (parserCurrentIndex == len - 1)) { continue; } cc2 = input.charCodeAt(parserCurrentIndex + 1); if (cc2 == 47) { // //, find lnfeed for (parserCurrentIndex = parserCurrentIndex + 2; parserCurrentIndex < len; parserCurrentIndex++) { cc2 = input.charCodeAt(parserCurrentIndex); if ((cc2 <= 13) && ((cc2 == 10) || (cc2 == 13))) { break; } } } else if (cc2 == 42) { // /*, find */ lastMultiComment = currentChunkStartIndex = parserCurrentIndex; for (parserCurrentIndex = parserCurrentIndex + 2; parserCurrentIndex < len - 1; parserCurrentIndex++) { cc2 = input.charCodeAt(parserCurrentIndex); if (cc2 == 125) { lastMultiCommentEndBrace = parserCurrentIndex; } if (cc2 != 42) { continue; } if (input.charCodeAt(parserCurrentIndex + 1) == 47) { break; } } if (parserCurrentIndex == len - 1) { return fail("missing closing `*/`", currentChunkStartIndex); } parserCurrentIndex++; } continue; case 42: // *, check for unmatched */ if ((parserCurrentIndex < len - 1) && (input.charCodeAt(parserCurrentIndex + 1) == 47)) { return fail("unmatched `/*`"); } continue; } } if (level !== 0) { if ((lastMultiComment > lastOpening) && (lastMultiCommentEndBrace > lastMultiComment)) { return fail("missing closing `}` or `*/`", lastOpening); } else { return fail("missing closing `}`", lastOpening); } } else if (parenLevel !== 0) { return fail("missing closing `)`", lastOpeningParen); } emitChunk(true); return chunks; })(str); if (error) { return callback(new(LessError)(error, env)); } current = chunks[0]; // Start with the primary rule. // The whole syntax tree is held under a Ruleset node, // with the `root` property set to true, so no `{}` are // output. The callback is called when the input is parsed. try { root = new(tree.Ruleset)(null, this.parsers.primary()); root.root = true; root.firstRoot = true; } catch (e) { return callback(new(LessError)(e, env)); } root.toCSS = (function (evaluate) { return function (options, variables) { options = options || {}; var evaldRoot, css, evalEnv = new tree.evalEnv(options); // // Allows setting variables with a hash, so: // // `{ color: new(tree.Color)('#f01') }` will become: // // new(tree.Rule)('@color', // new(tree.Value)([ // new(tree.Expression)([ // new(tree.Color)('#f01') // ]) // ]) // ) // if (typeof(variables) === 'object' && !Array.isArray(variables)) { variables = Object.keys(variables).map(function (k) { var value = variables[k]; if (! (value instanceof tree.Value)) { if (! (value instanceof tree.Expression)) { value = new(tree.Expression)([value]); } value = new(tree.Value)([value]); } return new(tree.Rule)('@' + k, value, false, null, 0); }); evalEnv.frames = [new(tree.Ruleset)(null, variables)]; } try { var preEvalVisitors = [], visitors = [ new(tree.joinSelectorVisitor)(), new(tree.processExtendsVisitor)(), new(tree.toCSSVisitor)({compress: Boolean(options.compress)}) ], i, root = this; if (options.plugins) { for(i =0; i < options.plugins.length; i++) { if (options.plugins[i].isPreEvalVisitor) { preEvalVisitors.push(options.plugins[i]); } else { if (options.plugins[i].isPreVisitor) { visitors.splice(0, 0, options.plugins[i]); } else { visitors.push(options.plugins[i]); } } } } for(i = 0; i < preEvalVisitors.length; i++) { preEvalVisitors[i].run(root); } evaldRoot = evaluate.call(root, evalEnv); for(i = 0; i < visitors.length; i++) { visitors[i].run(evaldRoot); } if (options.sourceMap) { evaldRoot = new tree.sourceMapOutput( { contentsIgnoredCharsMap: parser.imports.contentsIgnoredChars, writeSourceMap: options.writeSourceMap, rootNode: evaldRoot, contentsMap: parser.imports.contents, sourceMapFilename: options.sourceMapFilename, sourceMapURL: options.sourceMapURL, outputFilename: options.sourceMapOutputFilename, sourceMapBasepath: options.sourceMapBasepath, sourceMapRootpath: options.sourceMapRootpath, outputSourceFiles: options.outputSourceFiles, sourceMapGenerator: options.sourceMapGenerator }); } css = evaldRoot.toCSS({ compress: Boolean(options.compress), dumpLineNumbers: env.dumpLineNumbers, strictUnits: Boolean(options.strictUnits), numPrecision: 8}); } catch (e) { throw new(LessError)(e, env); } if (options.cleancss && less.mode === 'node') { var CleanCSS = require('clean-css'), cleancssOptions = options.cleancssOptions || {}; if (cleancssOptions.keepSpecialComments === undefined) { cleancssOptions.keepSpecialComments = "*"; } cleancssOptions.processImport = false; cleancssOptions.noRebase = true; if (cleancssOptions.noAdvanced === undefined) { cleancssOptions.noAdvanced = true; } return new CleanCSS(cleancssOptions).minify(css); } else if (options.compress) { return css.replace(/(^(\s)+)|((\s)+$)/g, ""); } else { return css; } }; })(root.eval); // If `i` is smaller than the `input.length - 1`, // it means the parser wasn't able to parse the whole // string, so we've got a parsing error. // // We try to extract a \n delimited string, // showing the line where the parse error occured. // We split it up into two parts (the part which parsed, // and the part which didn't), so we can color them differently. if (i < input.length - 1) { i = furthest; var loc = getLocation(i, input); lines = input.split('\n'); line = loc.line + 1; error = { type: "Parse", message: "Unrecognised input", index: i, filename: env.currentFileInfo.filename, line: line, column: loc.column, extract: [ lines[line - 2], lines[line - 1], lines[line] ] }; } var finish = function (e) { e = error || e || parser.imports.error; if (e) { if (!(e instanceof LessError)) { e = new(LessError)(e, env); } return callback(e); } else { return callback(null, root); } }; if (env.processImports !== false) { new tree.importVisitor(this.imports, finish) .run(root); } else { return finish(); } }
[ "function", "(", "str", ",", "callback", ",", "additionalData", ")", "{", "var", "root", ",", "line", ",", "lines", ",", "error", "=", "null", ",", "globalVars", ",", "modifyVars", ",", "preText", "=", "\"\"", ";", "i", "=", "j", "=", "currentPos", "...
Parse an input string into an abstract syntax tree, @param str A string containing 'less' markup @param callback call `callback` when done. @param [additionalData] An optional map which can contains vars - a map (key, value) of variables to apply
[ "Parse", "an", "input", "string", "into", "an", "abstract", "syntax", "tree" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/less.js#L383-L706
train
Parse a string into chunks of less. js
[ 30522, 3853, 1006, 2358, 2099, 1010, 2655, 5963, 1010, 3176, 2850, 2696, 1007, 1063, 13075, 7117, 1010, 2240, 1010, 3210, 1010, 7561, 1027, 19701, 1010, 3795, 10755, 2015, 1010, 19933, 10755, 2015, 1010, 3653, 18209, 1027, 1000, 1000, 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...
aframevr/aframe
src/core/a-assets.js
mediaElementLoaded
function mediaElementLoaded (el) { if (!el.hasAttribute('autoplay') && el.getAttribute('preload') !== 'auto') { return; } // If media specifies autoplay or preload, wait until media is completely buffered. return new Promise(function (resolve, reject) { if (el.readyState === 4) { return resolve(); } // Already loaded. if (el.error) { return reject(); } // Error. el.addEventListener('loadeddata', checkProgress, false); el.addEventListener('progress', checkProgress, false); el.addEventListener('error', reject, false); function checkProgress () { // Add up the seconds buffered. var secondsBuffered = 0; for (var i = 0; i < el.buffered.length; i++) { secondsBuffered += el.buffered.end(i) - el.buffered.start(i); } // Compare seconds buffered to media duration. if (secondsBuffered >= el.duration) { // Set in cache because we won't be needing to call three.js loader if we have. // a loaded media element. // Store video elements only. three.js loader is used for audio elements. // See assetParse too. if (el.tagName === 'VIDEO') { THREE.Cache.files[el.getAttribute('src')] = el; } resolve(); } } }); }
javascript
function mediaElementLoaded (el) { if (!el.hasAttribute('autoplay') && el.getAttribute('preload') !== 'auto') { return; } // If media specifies autoplay or preload, wait until media is completely buffered. return new Promise(function (resolve, reject) { if (el.readyState === 4) { return resolve(); } // Already loaded. if (el.error) { return reject(); } // Error. el.addEventListener('loadeddata', checkProgress, false); el.addEventListener('progress', checkProgress, false); el.addEventListener('error', reject, false); function checkProgress () { // Add up the seconds buffered. var secondsBuffered = 0; for (var i = 0; i < el.buffered.length; i++) { secondsBuffered += el.buffered.end(i) - el.buffered.start(i); } // Compare seconds buffered to media duration. if (secondsBuffered >= el.duration) { // Set in cache because we won't be needing to call three.js loader if we have. // a loaded media element. // Store video elements only. three.js loader is used for audio elements. // See assetParse too. if (el.tagName === 'VIDEO') { THREE.Cache.files[el.getAttribute('src')] = el; } resolve(); } } }); }
[ "function", "mediaElementLoaded", "(", "el", ")", "{", "if", "(", "!", "el", ".", "hasAttribute", "(", "'autoplay'", ")", "&&", "el", ".", "getAttribute", "(", "'preload'", ")", "!==", "'auto'", ")", "{", "return", ";", "}", "// If media specifies autoplay o...
Create a Promise that resolves once the media element has finished buffering. @param {Element} el - HTMLMediaElement. @returns {Promise}
[ "Create", "a", "Promise", "that", "resolves", "once", "the", "media", "element", "has", "finished", "buffering", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/a-assets.js#L140-L174
train
The media element loaded event handler.
[ 30522, 3853, 2865, 12260, 3672, 17468, 1006, 3449, 1007, 1063, 2065, 1006, 999, 3449, 1012, 2038, 19321, 3089, 8569, 2618, 1006, 1005, 8285, 13068, 1005, 1007, 1004, 1004, 3449, 1012, 2131, 19321, 3089, 8569, 2618, 1006, 1005, 3653, 11066, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/JSUtils/ScopeManager.js
initTernModule
function initTernModule() { var moduleDeferred = $.Deferred(); ternPromise = moduleDeferred.promise(); function prepareTern() { _ternNodeDomain.exec("setInterface", { messageIds : MessageIds }); _ternNodeDomain.exec("invokeTernCommand", { type: MessageIds.SET_CONFIG, config: config }); moduleDeferred.resolveWith(null, [_ternNodeDomain]); } if (_ternNodeDomain) { _ternNodeDomain.exec("resetTernServer"); moduleDeferred.resolveWith(null, [_ternNodeDomain]); } else { _ternNodeDomain = new NodeDomain("TernNodeDomain", _domainPath); _ternNodeDomain.on("data", function (evt, data) { if (config.debug) { console.log("Message received", data.type); } var response = data, type = response.type; if (type === MessageIds.TERN_COMPLETIONS_MSG || type === MessageIds.TERN_CALLED_FUNC_TYPE_MSG) { // handle any completions the tern server calculated handleTernCompletions(response); } else if (type === MessageIds.TERN_GET_FILE_MSG) { // handle a request for the contents of a file handleTernGetFile(response); } else if (type === MessageIds.TERN_JUMPTODEF_MSG) { handleJumptoDef(response); } else if (type === MessageIds.TERN_SCOPEDATA_MSG) { handleScopeData(response); } else if (type === MessageIds.TERN_REFS) { handleRename(response); } else if (type === MessageIds.TERN_PRIME_PUMP_MSG) { handlePrimePumpCompletion(response); } else if (type === MessageIds.TERN_GET_GUESSES_MSG) { handleGetGuesses(response); } else if (type === MessageIds.TERN_UPDATE_FILE_MSG) { handleUpdateFile(response); } else if (type === MessageIds.TERN_INFERENCE_TIMEDOUT) { handleTimedOut(response); } else if (type === MessageIds.TERN_WORKER_READY) { moduleDeferred.resolveWith(null, [_ternNodeDomain]); } else if (type === "RE_INIT_TERN") { // Ensure the request is because of a node restart if (currentModule) { prepareTern(); // Mark the module with resetForced, then creation of TernModule will // happen again as part of '_maybeReset' call currentModule.resetForced = true; } } else { console.log("Tern Module: " + (response.log || response)); } }); _ternNodeDomain.promise().done(prepareTern); } }
javascript
function initTernModule() { var moduleDeferred = $.Deferred(); ternPromise = moduleDeferred.promise(); function prepareTern() { _ternNodeDomain.exec("setInterface", { messageIds : MessageIds }); _ternNodeDomain.exec("invokeTernCommand", { type: MessageIds.SET_CONFIG, config: config }); moduleDeferred.resolveWith(null, [_ternNodeDomain]); } if (_ternNodeDomain) { _ternNodeDomain.exec("resetTernServer"); moduleDeferred.resolveWith(null, [_ternNodeDomain]); } else { _ternNodeDomain = new NodeDomain("TernNodeDomain", _domainPath); _ternNodeDomain.on("data", function (evt, data) { if (config.debug) { console.log("Message received", data.type); } var response = data, type = response.type; if (type === MessageIds.TERN_COMPLETIONS_MSG || type === MessageIds.TERN_CALLED_FUNC_TYPE_MSG) { // handle any completions the tern server calculated handleTernCompletions(response); } else if (type === MessageIds.TERN_GET_FILE_MSG) { // handle a request for the contents of a file handleTernGetFile(response); } else if (type === MessageIds.TERN_JUMPTODEF_MSG) { handleJumptoDef(response); } else if (type === MessageIds.TERN_SCOPEDATA_MSG) { handleScopeData(response); } else if (type === MessageIds.TERN_REFS) { handleRename(response); } else if (type === MessageIds.TERN_PRIME_PUMP_MSG) { handlePrimePumpCompletion(response); } else if (type === MessageIds.TERN_GET_GUESSES_MSG) { handleGetGuesses(response); } else if (type === MessageIds.TERN_UPDATE_FILE_MSG) { handleUpdateFile(response); } else if (type === MessageIds.TERN_INFERENCE_TIMEDOUT) { handleTimedOut(response); } else if (type === MessageIds.TERN_WORKER_READY) { moduleDeferred.resolveWith(null, [_ternNodeDomain]); } else if (type === "RE_INIT_TERN") { // Ensure the request is because of a node restart if (currentModule) { prepareTern(); // Mark the module with resetForced, then creation of TernModule will // happen again as part of '_maybeReset' call currentModule.resetForced = true; } } else { console.log("Tern Module: " + (response.log || response)); } }); _ternNodeDomain.promise().done(prepareTern); } }
[ "function", "initTernModule", "(", ")", "{", "var", "moduleDeferred", "=", "$", ".", "Deferred", "(", ")", ";", "ternPromise", "=", "moduleDeferred", ".", "promise", "(", ")", ";", "function", "prepareTern", "(", ")", "{", "_ternNodeDomain", ".", "exec", "...
Init the Tern module that does all the code hinting work.
[ "Init", "the", "Tern", "module", "that", "does", "all", "the", "code", "hinting", "work", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L1096-L1163
train
initTernModule - Initialize tern module
[ 30522, 3853, 1999, 27100, 6826, 5302, 8566, 2571, 1006, 1007, 1063, 13075, 11336, 3207, 7512, 5596, 1027, 1002, 1012, 13366, 28849, 2094, 1006, 1007, 1025, 28774, 16275, 21716, 5562, 1027, 11336, 3207, 7512, 5596, 1012, 4872, 1006, 30524, 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...
material-components/material-components-web-react
scripts/release/cp-pkgs.js
cpTypes
function cpTypes(typeAsset) { const {dir, base} = path.parse(typeAsset); let destDir = dir.split('build/types/')[1]; destDir = destDir.split('/'); destDir.splice(2, 0, 'dist'); destDir = `${destDir.join('/')}/${base}`; addTsIgnore(typeAsset); return cpFile(typeAsset, destDir) .then(() => console.log(`cp ${typeAsset} -> ${destDir}`)); }
javascript
function cpTypes(typeAsset) { const {dir, base} = path.parse(typeAsset); let destDir = dir.split('build/types/')[1]; destDir = destDir.split('/'); destDir.splice(2, 0, 'dist'); destDir = `${destDir.join('/')}/${base}`; addTsIgnore(typeAsset); return cpFile(typeAsset, destDir) .then(() => console.log(`cp ${typeAsset} -> ${destDir}`)); }
[ "function", "cpTypes", "(", "typeAsset", ")", "{", "const", "{", "dir", ",", "base", "}", "=", "path", ".", "parse", "(", "typeAsset", ")", ";", "let", "destDir", "=", "dir", ".", "split", "(", "'build/types/'", ")", "[", "1", "]", ";", "destDir", ...
takes assetPath, computes the destination file directory path and copies file into destination directory
[ "takes", "assetPath", "computes", "the", "destination", "file", "directory", "path", "and", "copies", "file", "into", "destination", "directory" ]
5ee9df0982d6cff893523c3e1e447b0f98bf8611
https://github.com/material-components/material-components-web-react/blob/5ee9df0982d6cff893523c3e1e447b0f98bf8611/scripts/release/cp-pkgs.js#L96-L105
train
cp types
[ 30522, 3853, 18133, 13874, 2015, 1006, 2828, 27241, 2102, 1007, 1063, 9530, 3367, 1063, 16101, 1010, 2918, 1065, 1027, 4130, 1012, 11968, 3366, 1006, 2828, 27241, 2102, 1007, 1025, 2292, 4078, 2102, 4305, 2099, 1027, 16101, 1012, 3975, 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...
getinsomnia/insomnia
packages/insomnia-importers/src/importers/openapi3.js
prepareHeaders
function prepareHeaders(endpointSchema) { const isSendInHeader = p => p.in === 'header'; const parameters = endpointSchema.parameters || []; const headerParameters = parameters.filter(isSendInHeader); return convertParameters(headerParameters); }
javascript
function prepareHeaders(endpointSchema) { const isSendInHeader = p => p.in === 'header'; const parameters = endpointSchema.parameters || []; const headerParameters = parameters.filter(isSendInHeader); return convertParameters(headerParameters); }
[ "function", "prepareHeaders", "(", "endpointSchema", ")", "{", "const", "isSendInHeader", "=", "p", "=>", "p", ".", "in", "===", "'header'", ";", "const", "parameters", "=", "endpointSchema", ".", "parameters", "||", "[", "]", ";", "const", "headerParameters",...
Imports insomnia definitions of header parameters. @param {Object} endpointSchema - OpenAPI 3 endpoint schema @returns {Object[]} array of parameters definitions
[ "Imports", "insomnia", "definitions", "of", "header", "parameters", "." ]
e24ce7f7b41246e700c4b9bdb6b34b6652ad589b
https://github.com/getinsomnia/insomnia/blob/e24ce7f7b41246e700c4b9bdb6b34b6652ad589b/packages/insomnia-importers/src/importers/openapi3.js#L209-L214
train
Prepare headers for the endpoint
[ 30522, 3853, 7374, 4974, 2545, 1006, 2203, 26521, 5403, 2863, 1007, 1063, 9530, 3367, 26354, 10497, 2378, 4974, 2121, 1027, 1052, 1027, 1028, 1052, 1012, 1999, 1027, 1027, 1027, 1005, 20346, 1005, 1025, 9530, 3367, 11709, 1027, 2203, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/less.js
function (path, currentFileInfo, importOptions, callback) { var parserImports = this; this.queue.push(path); var fileParsedFunc = function (e, root, fullPath) { parserImports.queue.splice(parserImports.queue.indexOf(path), 1); // Remove the path from the queue var importedPreviously = fullPath in parserImports.files || fullPath === rootFilename; parserImports.files[fullPath] = root; // Store the root if (e && !parserImports.error) { parserImports.error = e; } callback(e, root, importedPreviously, fullPath); }; if (less.Parser.importer) { less.Parser.importer(path, currentFileInfo, fileParsedFunc, env); } else { less.Parser.fileLoader(path, currentFileInfo, function(e, contents, fullPath, newFileInfo) { if (e) {fileParsedFunc(e); return;} var newEnv = new tree.parseEnv(env); newEnv.currentFileInfo = newFileInfo; newEnv.processImports = false; newEnv.contents[fullPath] = contents; if (currentFileInfo.reference || importOptions.reference) { newFileInfo.reference = true; } if (importOptions.inline) { fileParsedFunc(null, contents, fullPath); } else { new(less.Parser)(newEnv).parse(contents, function (e, root) { fileParsedFunc(e, root, fullPath); }); } }, env); } }
javascript
function (path, currentFileInfo, importOptions, callback) { var parserImports = this; this.queue.push(path); var fileParsedFunc = function (e, root, fullPath) { parserImports.queue.splice(parserImports.queue.indexOf(path), 1); // Remove the path from the queue var importedPreviously = fullPath in parserImports.files || fullPath === rootFilename; parserImports.files[fullPath] = root; // Store the root if (e && !parserImports.error) { parserImports.error = e; } callback(e, root, importedPreviously, fullPath); }; if (less.Parser.importer) { less.Parser.importer(path, currentFileInfo, fileParsedFunc, env); } else { less.Parser.fileLoader(path, currentFileInfo, function(e, contents, fullPath, newFileInfo) { if (e) {fileParsedFunc(e); return;} var newEnv = new tree.parseEnv(env); newEnv.currentFileInfo = newFileInfo; newEnv.processImports = false; newEnv.contents[fullPath] = contents; if (currentFileInfo.reference || importOptions.reference) { newFileInfo.reference = true; } if (importOptions.inline) { fileParsedFunc(null, contents, fullPath); } else { new(less.Parser)(newEnv).parse(contents, function (e, root) { fileParsedFunc(e, root, fullPath); }); } }, env); } }
[ "function", "(", "path", ",", "currentFileInfo", ",", "importOptions", ",", "callback", ")", "{", "var", "parserImports", "=", "this", ";", "this", ".", "queue", ".", "push", "(", "path", ")", ";", "var", "fileParsedFunc", "=", "function", "(", "e", ",",...
Error in parsing/evaluating an import
[ "Error", "in", "parsing", "/", "evaluating", "an", "import" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/less.js#L97-L138
train
Parse a file and return the root
[ 30522, 3853, 1006, 4130, 1010, 2783, 8873, 19856, 14876, 1010, 12324, 7361, 9285, 1010, 2655, 5963, 1007, 1063, 13075, 11968, 8043, 5714, 25378, 1027, 2023, 1025, 2023, 1012, 24240, 1012, 5245, 1006, 4130, 1007, 1025, 13075, 5371, 19362, 69...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
onUpdateConfirmPhoneVerification
function onUpdateConfirmPhoneVerification() { if (!activeUser()) { alertError('You need to sign in before linking an account.'); return; } var verificationId = $('#link-reauth-phone-verification-id').val(); var verificationCode = $('#link-reauth-phone-verification-code').val(); var credential = firebase.auth.PhoneAuthProvider.credential( verificationId, verificationCode); activeUser().updatePhoneNumber(credential).then(function() { refreshUserData(); alertSuccess('Phone number updated!'); }, onAuthError); }
javascript
function onUpdateConfirmPhoneVerification() { if (!activeUser()) { alertError('You need to sign in before linking an account.'); return; } var verificationId = $('#link-reauth-phone-verification-id').val(); var verificationCode = $('#link-reauth-phone-verification-code').val(); var credential = firebase.auth.PhoneAuthProvider.credential( verificationId, verificationCode); activeUser().updatePhoneNumber(credential).then(function() { refreshUserData(); alertSuccess('Phone number updated!'); }, onAuthError); }
[ "function", "onUpdateConfirmPhoneVerification", "(", ")", "{", "if", "(", "!", "activeUser", "(", ")", ")", "{", "alertError", "(", "'You need to sign in before linking an account.'", ")", ";", "return", ";", "}", "var", "verificationId", "=", "$", "(", "'#link-re...
Updates the user's phone number.
[ "Updates", "the", "user", "s", "phone", "number", "." ]
491598a499813dacc23724de5e237ec220cc560e
https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L492-L505
train
Updates the user s phone number
[ 30522, 3853, 2006, 6279, 13701, 8663, 27972, 9864, 6299, 9031, 1006, 1007, 1063, 2065, 1006, 999, 3161, 20330, 1006, 1007, 1007, 1063, 9499, 2121, 29165, 1006, 1005, 2017, 2342, 2000, 3696, 1999, 2077, 11383, 2019, 4070, 1012, 1005, 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...
summernote/summernote
src/js/base/core/dom.js
listPrev
function listPrev(node, pred) { pred = pred || func.fail; const nodes = []; while (node) { if (pred(node)) { break; } nodes.push(node); node = node.previousSibling; } return nodes; }
javascript
function listPrev(node, pred) { pred = pred || func.fail; const nodes = []; while (node) { if (pred(node)) { break; } nodes.push(node); node = node.previousSibling; } return nodes; }
[ "function", "listPrev", "(", "node", ",", "pred", ")", "{", "pred", "=", "pred", "||", "func", ".", "fail", ";", "const", "nodes", "=", "[", "]", ";", "while", "(", "node", ")", "{", "if", "(", "pred", "(", "node", ")", ")", "{", "break", ";", ...
listing all previous siblings (until predicate hit). @param {Node} node @param {Function} [optional] pred - predicate function
[ "listing", "all", "previous", "siblings", "(", "until", "predicate", "hit", ")", "." ]
8dcafb8107453006b905ef697a529c42e76beb3f
https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/dom.js#L316-L326
train
List the previous nodes of a node
[ 30522, 3853, 2862, 28139, 2615, 1006, 13045, 1010, 3653, 2094, 1007, 1063, 3653, 2094, 1027, 3653, 2094, 1064, 1064, 4569, 2278, 1012, 8246, 1025, 9530, 3367, 14164, 1027, 1031, 1033, 1025, 2096, 1006, 13045, 1007, 1063, 2065, 1006, 3653, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
lib/jsdoc/ui5/template/publish.js
makeSortby
function makeSortby(/* fields ...*/) { var aFields = Array.prototype.slice.apply(arguments), aNorms = [], aFuncs = []; for (var i = 0; i < arguments.length; i++) { aNorms[i] = 1; if ( typeof aFields[i] === 'function' ) { aFuncs[i] = aFields[i]; continue; } aFuncs[i] = function($,n) { return $[n]; }; if ( aFields[i].indexOf("!") === 0 ) { aNorms[i] = -1; aFields[i] = aFields[i].slice(1); } if ( aFields[i] === 'deprecated' ) { aFuncs[i] = function($,n) { return !!$[n]; }; } else if ( aFields[i] === 'static' ) { aFields[i] = 'scope'; aFuncs[i] = function($,n) { return $[n] === 'static'; }; } else if ( aFields[i].indexOf("#") === 0 ) { aFields[i] = aFields[i].slice(1); aFuncs[i] = function($,n) { return $.comment.getTag(n).length > 0; }; } } return function(a, b) { // info("compare " + a.longname + " : " + b.longname); var r = 0,i,va,vb; for (i = 0; r === 0 && i < aFields.length; i++) { va = aFuncs[i](a,aFields[i]); vb = aFuncs[i](b,aFields[i]); if ( va && !vb ) { r = -aNorms[i]; } else if ( !va && vb ) { r = aNorms[i]; } else if ( va && vb ) { va = String(va).toLowerCase(); vb = String(vb).toLowerCase(); if (va < vb) { r = -aNorms[i]; } if (va > vb) { r = aNorms[i]; } } // debug(" " + aFields[i] + ": " + va + " ? " + vb + " = " + r); } return r; }; }
javascript
function makeSortby(/* fields ...*/) { var aFields = Array.prototype.slice.apply(arguments), aNorms = [], aFuncs = []; for (var i = 0; i < arguments.length; i++) { aNorms[i] = 1; if ( typeof aFields[i] === 'function' ) { aFuncs[i] = aFields[i]; continue; } aFuncs[i] = function($,n) { return $[n]; }; if ( aFields[i].indexOf("!") === 0 ) { aNorms[i] = -1; aFields[i] = aFields[i].slice(1); } if ( aFields[i] === 'deprecated' ) { aFuncs[i] = function($,n) { return !!$[n]; }; } else if ( aFields[i] === 'static' ) { aFields[i] = 'scope'; aFuncs[i] = function($,n) { return $[n] === 'static'; }; } else if ( aFields[i].indexOf("#") === 0 ) { aFields[i] = aFields[i].slice(1); aFuncs[i] = function($,n) { return $.comment.getTag(n).length > 0; }; } } return function(a, b) { // info("compare " + a.longname + " : " + b.longname); var r = 0,i,va,vb; for (i = 0; r === 0 && i < aFields.length; i++) { va = aFuncs[i](a,aFields[i]); vb = aFuncs[i](b,aFields[i]); if ( va && !vb ) { r = -aNorms[i]; } else if ( !va && vb ) { r = aNorms[i]; } else if ( va && vb ) { va = String(va).toLowerCase(); vb = String(vb).toLowerCase(); if (va < vb) { r = -aNorms[i]; } if (va > vb) { r = aNorms[i]; } } // debug(" " + aFields[i] + ": " + va + " ? " + vb + " = " + r); } return r; }; }
[ "function", "makeSortby", "(", "/* fields ...*/", ")", "{", "var", "aFields", "=", "Array", ".", "prototype", ".", "slice", ".", "apply", "(", "arguments", ")", ",", "aNorms", "=", "[", "]", ",", "aFuncs", "=", "[", "]", ";", "for", "(", "var", "i", ...
/* Make a symbol sorter by some attribute.
[ "/", "*", "Make", "a", "symbol", "sorter", "by", "some", "attribute", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/template/publish.js#L1197-L1246
train
Creates a function that can be used to sort by a list of fields
[ 30522, 3853, 3084, 11589, 3762, 1006, 1013, 1008, 4249, 1012, 1012, 1012, 1008, 1013, 1007, 1063, 13075, 28697, 14273, 2015, 1027, 9140, 1012, 8773, 1012, 14704, 1012, 6611, 1006, 9918, 1007, 1010, 2019, 2953, 5244, 1027, 1031, 1033, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/dialog/dialog.js
activateListeners
function activateListeners(element, options) { var window = angular.element($window); var onWindowResize = $mdUtil.debounce(function() { stretchDialogContainerToViewport(element, options); }, 60); var removeListeners = []; var smartClose = function() { // Only 'confirm' dialogs have a cancel button... escape/clickOutside will // cancel or fallback to hide. var closeFn = (options.$type == 'alert') ? $mdDialog.hide : $mdDialog.cancel; $mdUtil.nextTick(closeFn, true); }; if (options.escapeToClose) { var parentTarget = options.parent; var keyHandlerFn = function(ev) { if (ev.keyCode === $mdConstant.KEY_CODE.ESCAPE) { ev.stopImmediatePropagation(); ev.preventDefault(); smartClose(); } }; // Add keydown listeners element.on('keydown', keyHandlerFn); parentTarget.on('keydown', keyHandlerFn); // Queue remove listeners function removeListeners.push(function() { element.off('keydown', keyHandlerFn); parentTarget.off('keydown', keyHandlerFn); }); } // Register listener to update dialog on window resize window.on('resize', onWindowResize); removeListeners.push(function() { window.off('resize', onWindowResize); }); if (options.clickOutsideToClose) { var target = element; var sourceElem; // Keep track of the element on which the mouse originally went down // so that we can only close the backdrop when the 'click' started on it. // A simple 'click' handler does not work, // it sets the target object as the element the mouse went down on. var mousedownHandler = function(ev) { sourceElem = ev.target; }; // We check if our original element and the target is the backdrop // because if the original was the backdrop and the target was inside the dialog // we don't want to dialog to close. var mouseupHandler = function(ev) { if (sourceElem === target[0] && ev.target === target[0]) { ev.stopPropagation(); ev.preventDefault(); smartClose(); } }; // Add listeners target.on('mousedown', mousedownHandler); target.on('mouseup', mouseupHandler); // Queue remove listeners function removeListeners.push(function() { target.off('mousedown', mousedownHandler); target.off('mouseup', mouseupHandler); }); } // Attach specific `remove` listener handler options.deactivateListeners = function() { removeListeners.forEach(function(removeFn) { removeFn(); }); options.deactivateListeners = null; }; }
javascript
function activateListeners(element, options) { var window = angular.element($window); var onWindowResize = $mdUtil.debounce(function() { stretchDialogContainerToViewport(element, options); }, 60); var removeListeners = []; var smartClose = function() { // Only 'confirm' dialogs have a cancel button... escape/clickOutside will // cancel or fallback to hide. var closeFn = (options.$type == 'alert') ? $mdDialog.hide : $mdDialog.cancel; $mdUtil.nextTick(closeFn, true); }; if (options.escapeToClose) { var parentTarget = options.parent; var keyHandlerFn = function(ev) { if (ev.keyCode === $mdConstant.KEY_CODE.ESCAPE) { ev.stopImmediatePropagation(); ev.preventDefault(); smartClose(); } }; // Add keydown listeners element.on('keydown', keyHandlerFn); parentTarget.on('keydown', keyHandlerFn); // Queue remove listeners function removeListeners.push(function() { element.off('keydown', keyHandlerFn); parentTarget.off('keydown', keyHandlerFn); }); } // Register listener to update dialog on window resize window.on('resize', onWindowResize); removeListeners.push(function() { window.off('resize', onWindowResize); }); if (options.clickOutsideToClose) { var target = element; var sourceElem; // Keep track of the element on which the mouse originally went down // so that we can only close the backdrop when the 'click' started on it. // A simple 'click' handler does not work, // it sets the target object as the element the mouse went down on. var mousedownHandler = function(ev) { sourceElem = ev.target; }; // We check if our original element and the target is the backdrop // because if the original was the backdrop and the target was inside the dialog // we don't want to dialog to close. var mouseupHandler = function(ev) { if (sourceElem === target[0] && ev.target === target[0]) { ev.stopPropagation(); ev.preventDefault(); smartClose(); } }; // Add listeners target.on('mousedown', mousedownHandler); target.on('mouseup', mouseupHandler); // Queue remove listeners function removeListeners.push(function() { target.off('mousedown', mousedownHandler); target.off('mouseup', mouseupHandler); }); } // Attach specific `remove` listener handler options.deactivateListeners = function() { removeListeners.forEach(function(removeFn) { removeFn(); }); options.deactivateListeners = null; }; }
[ "function", "activateListeners", "(", "element", ",", "options", ")", "{", "var", "window", "=", "angular", ".", "element", "(", "$window", ")", ";", "var", "onWindowResize", "=", "$mdUtil", ".", "debounce", "(", "function", "(", ")", "{", "stretchDialogCont...
Listen for escape keys and outside clicks to auto close
[ "Listen", "for", "escape", "keys", "and", "outside", "clicks", "to", "auto", "close" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L949-L1036
train
Activate the listeners for the given element
[ 30522, 3853, 20544, 9863, 24454, 2015, 1006, 5783, 1010, 7047, 1007, 1063, 13075, 3332, 1027, 16108, 1012, 5783, 1006, 1002, 3332, 1007, 1025, 13075, 2006, 11101, 5004, 6072, 4697, 1027, 1002, 9108, 21823, 2140, 1012, 2139, 5092, 17457, 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...
eslint/eslint
lib/util/source-code.js
sortedMerge
function sortedMerge(tokens, comments) { const result = []; let tokenIndex = 0; let commentIndex = 0; while (tokenIndex < tokens.length || commentIndex < comments.length) { if (commentIndex >= comments.length || tokenIndex < tokens.length && tokens[tokenIndex].range[0] < comments[commentIndex].range[0]) { result.push(tokens[tokenIndex++]); } else { result.push(comments[commentIndex++]); } } return result; }
javascript
function sortedMerge(tokens, comments) { const result = []; let tokenIndex = 0; let commentIndex = 0; while (tokenIndex < tokens.length || commentIndex < comments.length) { if (commentIndex >= comments.length || tokenIndex < tokens.length && tokens[tokenIndex].range[0] < comments[commentIndex].range[0]) { result.push(tokens[tokenIndex++]); } else { result.push(comments[commentIndex++]); } } return result; }
[ "function", "sortedMerge", "(", "tokens", ",", "comments", ")", "{", "const", "result", "=", "[", "]", ";", "let", "tokenIndex", "=", "0", ";", "let", "commentIndex", "=", "0", ";", "while", "(", "tokenIndex", "<", "tokens", ".", "length", "||", "comme...
Merges two sorted lists into a larger sorted list in O(n) time. @param {Token[]} tokens The list of tokens. @param {Token[]} comments The list of comments. @returns {Token[]} A sorted list of tokens and comments. @private
[ "Merges", "two", "sorted", "lists", "into", "a", "larger", "sorted", "list", "in", "O", "(", "n", ")", "time", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/source-code.js#L63-L77
train
Merge a list of tokens and comments into a single array
[ 30522, 3853, 19616, 5017, 3351, 1006, 19204, 2015, 1010, 7928, 1007, 1063, 9530, 3367, 2765, 1027, 1031, 1033, 1025, 2292, 19204, 22254, 10288, 1027, 1014, 1025, 2292, 7615, 22254, 10288, 1027, 1014, 1025, 2096, 1006, 19204, 22254, 10288, 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/thirdparty/caja-html-sanitizer.js
htmlSplit
function htmlSplit(str) { // can't hoist this out of the function because of the re.exec loop. var re = /(<\/|<\!--|<[!?]|[&<>])/g; str += ''; if (splitWillCapture) { return str.split(re); } else { var parts = []; var lastPos = 0; var m; while ((m = re.exec(str)) !== null) { parts.push(str.substring(lastPos, m.index)); parts.push(m[0]); lastPos = m.index + m[0].length; } parts.push(str.substring(lastPos)); return parts; } }
javascript
function htmlSplit(str) { // can't hoist this out of the function because of the re.exec loop. var re = /(<\/|<\!--|<[!?]|[&<>])/g; str += ''; if (splitWillCapture) { return str.split(re); } else { var parts = []; var lastPos = 0; var m; while ((m = re.exec(str)) !== null) { parts.push(str.substring(lastPos, m.index)); parts.push(m[0]); lastPos = m.index + m[0].length; } parts.push(str.substring(lastPos)); return parts; } }
[ "function", "htmlSplit", "(", "str", ")", "{", "// can't hoist this out of the function because of the re.exec loop.", "var", "re", "=", "/", "(<\\/|<\\!--|<[!?]|[&<>])", "/", "g", ";", "str", "+=", "''", ";", "if", "(", "splitWillCapture", ")", "{", "return", "str"...
Split str into parts for the html parser.
[ "Split", "str", "into", "parts", "for", "the", "html", "parser", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/caja-html-sanitizer.js#L3152-L3170
train
split the string into an array of parts
[ 30522, 3853, 16129, 13102, 15909, 1006, 2358, 2099, 1007, 1063, 1013, 1013, 2064, 1005, 1056, 7570, 2923, 2023, 2041, 1997, 1996, 3853, 2138, 1997, 1996, 2128, 1012, 4654, 8586, 7077, 1012, 13075, 2128, 1027, 1013, 1006, 1026, 1032, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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(evt) { var state = null; // Workaround for touch events which started on some DOM node // on top of the container, in which case the cells under the // mouse for the move and up events are not detected. if (mxClient.IS_TOUCH) { var x = mxEvent.getClientX(evt); var y = mxEvent.getClientY(evt); // Dispatches the drop event to the graph which // consumes and executes the source function var pt = mxUtils.convertPoint(container, x, y); state = graph.view.getState(graph.getCellAt(pt.x, pt.y)); } return state; }
javascript
function(evt) { var state = null; // Workaround for touch events which started on some DOM node // on top of the container, in which case the cells under the // mouse for the move and up events are not detected. if (mxClient.IS_TOUCH) { var x = mxEvent.getClientX(evt); var y = mxEvent.getClientY(evt); // Dispatches the drop event to the graph which // consumes and executes the source function var pt = mxUtils.convertPoint(container, x, y); state = graph.view.getState(graph.getCellAt(pt.x, pt.y)); } return state; }
[ "function", "(", "evt", ")", "{", "var", "state", "=", "null", ";", "// Workaround for touch events which started on some DOM node", "// on top of the container, in which case the cells under the", "// mouse for the move and up events are not detected.", "if", "(", "mxClient", ".", ...
Workaround for touch events which started on some DOM node on top of the container, in which case the cells under the mouse for the move and up events are not detected.
[ "Workaround", "for", "touch", "events", "which", "started", "on", "some", "DOM", "node", "on", "top", "of", "the", "container", "in", "which", "case", "the", "cells", "under", "the", "mouse", "for", "the", "move", "and", "up", "events", "are", "not", "de...
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L53687-L53706
train
This function is called when the user clicks on a cell
[ 30522, 3853, 1006, 23408, 2102, 1007, 1063, 13075, 2110, 1027, 19701, 1025, 1013, 1013, 2147, 24490, 2005, 3543, 2824, 2029, 2318, 2006, 2070, 14383, 13045, 1013, 1013, 2006, 2327, 1997, 1996, 11661, 1010, 1999, 2029, 2553, 1996, 4442, 2104...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/constants/defaultPlugins.js
createFromDependency
function createFromDependency(pluginName) { var npmID = PluginDependency.nameToNpmID(pluginName); var version = pkg.dependencies[npmID]; return PluginDependency.create(pluginName, version); }
javascript
function createFromDependency(pluginName) { var npmID = PluginDependency.nameToNpmID(pluginName); var version = pkg.dependencies[npmID]; return PluginDependency.create(pluginName, version); }
[ "function", "createFromDependency", "(", "pluginName", ")", "{", "var", "npmID", "=", "PluginDependency", ".", "nameToNpmID", "(", "pluginName", ")", ";", "var", "version", "=", "pkg", ".", "dependencies", "[", "npmID", "]", ";", "return", "PluginDependency", ...
Create a PluginDependency from a dependency of gitbook @param {String} pluginName @return {PluginDependency}
[ "Create", "a", "PluginDependency", "from", "a", "dependency", "of", "gitbook" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/constants/defaultPlugins.js#L11-L16
train
Create a new PluginDependency object from a name
[ 30522, 3853, 3443, 19699, 5358, 3207, 11837, 4181, 5666, 1006, 13354, 23111, 14074, 1007, 1063, 13075, 27937, 4328, 2094, 1027, 13354, 22254, 13699, 10497, 11916, 1012, 2171, 2669, 9737, 3593, 1006, 13354, 23111, 14074, 1007, 1025, 13075, 254...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/qunit.js
function( fn ) { var args, l = fn.length; if ( !l ) { return ""; } args = new Array( l ); while ( l-- ) { // 97 is 'a' args[ l ] = String.fromCharCode( 97 + l ); } return " " + args.join( ", " ) + " "; }
javascript
function( fn ) { var args, l = fn.length; if ( !l ) { return ""; } args = new Array( l ); while ( l-- ) { // 97 is 'a' args[ l ] = String.fromCharCode( 97 + l ); } return " " + args.join( ", " ) + " "; }
[ "function", "(", "fn", ")", "{", "var", "args", ",", "l", "=", "fn", ".", "length", ";", "if", "(", "!", "l", ")", "{", "return", "\"\"", ";", "}", "args", "=", "new", "Array", "(", "l", ")", ";", "while", "(", "l", "--", ")", "{", "// 97 i...
function calls it internally, it's the arguments part of the function
[ "function", "calls", "it", "internally", "it", "s", "the", "arguments", "part", "of", "the", "function" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/qunit.js#L1864-L1879
train
Returns a string that is a function that can be called with the arguments passed to the function.
[ 30522, 3853, 1006, 1042, 2078, 1007, 1063, 13075, 12098, 5620, 1010, 1048, 1027, 1042, 2078, 1012, 3091, 1025, 2065, 1006, 999, 1048, 1007, 1063, 2709, 1000, 1000, 1025, 1065, 12098, 5620, 1027, 2047, 9140, 1006, 1048, 1007, 1025, 2096, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/AutoUpdate/main.js
dirtyFileSaveCancelled
function dirtyFileSaveCancelled() { UpdateInfoBar.showUpdateBar({ type: "warning", title: Strings.WARNING_TYPE, description: Strings.UPDATE_ON_NEXT_LAUNCH }); }
javascript
function dirtyFileSaveCancelled() { UpdateInfoBar.showUpdateBar({ type: "warning", title: Strings.WARNING_TYPE, description: Strings.UPDATE_ON_NEXT_LAUNCH }); }
[ "function", "dirtyFileSaveCancelled", "(", ")", "{", "UpdateInfoBar", ".", "showUpdateBar", "(", "{", "type", ":", "\"warning\"", ",", "title", ":", "Strings", ".", "WARNING_TYPE", ",", "description", ":", "Strings", ".", "UPDATE_ON_NEXT_LAUNCH", "}", ")", ";", ...
Handles the Cancel button click by user in Unsaved changes prompt, which would come up if user has dirty files and he/she clicked UpdateNow
[ "Handles", "the", "Cancel", "button", "click", "by", "user", "in", "Unsaved", "changes", "prompt", "which", "would", "come", "up", "if", "user", "has", "dirty", "files", "and", "he", "/", "she", "clicked", "UpdateNow" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/main.js#L805-L811
train
Called when a file has been saved to disk
[ 30522, 3853, 6530, 8873, 4244, 10696, 9336, 29109, 3709, 1006, 1007, 1063, 10651, 2378, 14876, 8237, 1012, 2265, 6279, 13701, 8237, 1006, 1063, 2828, 1024, 1000, 5432, 1000, 1010, 2516, 1024, 7817, 1012, 5432, 1035, 2828, 1010, 6412, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SheetJS/js-xlsx
xlsx.js
write_ws_xlml_table
function write_ws_xlml_table(ws, opts, idx, wb) { if(!ws['!ref']) return ""; var range = safe_decode_range(ws['!ref']); var marr = ws['!merges'] || [], mi = 0; var o = []; if(ws['!cols']) ws['!cols'].forEach(function(n, i) { process_col(n); var w = !!n.width; var p = col_obj_w(i, n); var k = {"ss:Index":i+1}; if(w) k['ss:Width'] = width2px(p.width); if(n.hidden) k['ss:Hidden']="1"; o.push(writextag("Column",null,k)); }); var dense = Array.isArray(ws); for(var R = range.s.r; R <= range.e.r; ++R) { var row = [write_ws_xlml_row(R, (ws['!rows']||[])[R])]; for(var C = range.s.c; C <= range.e.c; ++C) { var skip = false; for(mi = 0; mi != marr.length; ++mi) { if(marr[mi].s.c > C) continue; if(marr[mi].s.r > R) continue; if(marr[mi].e.c < C) continue; if(marr[mi].e.r < R) continue; if(marr[mi].s.c != C || marr[mi].s.r != R) skip = true; break; } if(skip) continue; var addr = {r:R,c:C}; var ref = encode_cell(addr), cell = dense ? (ws[R]||[])[C] : ws[ref]; row.push(write_ws_xlml_cell(cell, ref, ws, opts, idx, wb, addr)); } row.push("</Row>"); if(row.length > 2) o.push(row.join("")); } return o.join(""); }
javascript
function write_ws_xlml_table(ws, opts, idx, wb) { if(!ws['!ref']) return ""; var range = safe_decode_range(ws['!ref']); var marr = ws['!merges'] || [], mi = 0; var o = []; if(ws['!cols']) ws['!cols'].forEach(function(n, i) { process_col(n); var w = !!n.width; var p = col_obj_w(i, n); var k = {"ss:Index":i+1}; if(w) k['ss:Width'] = width2px(p.width); if(n.hidden) k['ss:Hidden']="1"; o.push(writextag("Column",null,k)); }); var dense = Array.isArray(ws); for(var R = range.s.r; R <= range.e.r; ++R) { var row = [write_ws_xlml_row(R, (ws['!rows']||[])[R])]; for(var C = range.s.c; C <= range.e.c; ++C) { var skip = false; for(mi = 0; mi != marr.length; ++mi) { if(marr[mi].s.c > C) continue; if(marr[mi].s.r > R) continue; if(marr[mi].e.c < C) continue; if(marr[mi].e.r < R) continue; if(marr[mi].s.c != C || marr[mi].s.r != R) skip = true; break; } if(skip) continue; var addr = {r:R,c:C}; var ref = encode_cell(addr), cell = dense ? (ws[R]||[])[C] : ws[ref]; row.push(write_ws_xlml_cell(cell, ref, ws, opts, idx, wb, addr)); } row.push("</Row>"); if(row.length > 2) o.push(row.join("")); } return o.join(""); }
[ "function", "write_ws_xlml_table", "(", "ws", ",", "opts", ",", "idx", ",", "wb", ")", "{", "if", "(", "!", "ws", "[", "'!ref'", "]", ")", "return", "\"\"", ";", "var", "range", "=", "safe_decode_range", "(", "ws", "[", "'!ref'", "]", ")", ";", "va...
/* TODO
[ "/", "*", "TODO" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L16212-L16248
train
Write a table of cells
[ 30522, 3853, 4339, 1035, 1059, 2015, 1035, 28712, 19968, 1035, 2795, 1006, 1059, 2015, 1010, 23569, 2015, 1010, 8909, 2595, 1010, 25610, 1007, 1063, 2065, 1006, 999, 1059, 2015, 1031, 1005, 999, 25416, 1005, 1033, 1007, 2709, 1000, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...