_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q7600
processAliases
train
function processAliases(aliases) { const result = { long: {}, short: {} }; if (!aliases) { return result; } if (!Array.isArray(aliases)) { if (typeof aliases === 'object') { if (aliases.long && typeof aliases.long === 'object') { Object.assign(result.long, aliases.long); } if (aliases.short && typeof aliases.short === 'object') { Object.assign(result.short, aliases.short); } return result; } aliases = [ aliases ]; } for (const alias of aliases) { if (!alias || typeof alias !== 'string') { throw E.INVALID_ALIAS('Expected aliases to be a string or an array of strings', { name: 'aliases', scope: 'Option.constructor', value: alias }); } for (const a of alias.split(/[ ,|]+/)) { const m = a.match(aliasRegExp); if (!m) { throw E.INVALID_ALIAS(`Invalid alias format "${alias}"`, { name: 'aliases', scope: 'Option.constructor', value: alias }); } if (m[2]) { result.short[m[2]] = !m[1]; } else if (m[3]) { result.long[m[3]] = !m[1]; } } } return result; }
javascript
{ "resource": "" }
q7601
getClosestNode
train
function getClosestNode (element, method, selector) { do { element = element[method] } while (element && ((selector && !matches(element, selector)) || !util.isElement(element))) return element }
javascript
{ "resource": "" }
q7602
_create
train
function _create (elements, selector) { return selector == null ? new Rye(elements) : new Rye(elements).filter(selector) }
javascript
{ "resource": "" }
q7603
createCreateStreamWrap
train
function createCreateStreamWrap(api) { return function createStreamWrap(create_stream) { return function create_stream_trace() { if (!this.stream) { Object.defineProperty(this, 'stream', { get: function () { return this._google_trace_stream; }, set: function (val) { api.wrapEmitter(val); this._google_trace_stream = val; } }); } return create_stream.apply(this, arguments); }; }; }
javascript
{ "resource": "" }
q7604
createStreamListenersWrap
train
function createStreamListenersWrap(api) { return function streamListenersWrap(install_stream_listeners) { return function install_stream_listeners_trace() { api.wrapEmitter(this.stream); return install_stream_listeners.apply(this, arguments); }; }; }
javascript
{ "resource": "" }
q7605
getDocWithDefault
train
function getDocWithDefault(db, id, defaultDoc) { return db.get(id).catch(function (err) { /* istanbul ignore if */ if (err.status !== 404) { throw err; } defaultDoc._id = id; return db.put(defaultDoc).catch(function (err) { /* istanbul ignore if */ if (err.status !== 409) { // conflict throw err; } }).then(function () { return db.get(id); }); }); }
javascript
{ "resource": "" }
q7606
getMainDoc
train
function getMainDoc(db) { return getDocWithDefault(db, MAIN_DOC_ID, {}).then(function (doc) { if (!doc._attachments) { doc._attachments = {}; } return doc; }); }
javascript
{ "resource": "" }
q7607
calculateTotalSize
train
function calculateTotalSize(mainDoc) { var digestsToSizes = {}; // dedup by digest, since that's what Pouch does under the hood Object.keys(mainDoc._attachments).forEach(function (attName) { var att = mainDoc._attachments[attName]; digestsToSizes[att.digest] = att.length; }); var total = 0; Object.keys(digestsToSizes).forEach(function (digest) { total += digestsToSizes[digest]; }); return total; }
javascript
{ "resource": "" }
q7608
synchronous
train
function synchronous(promiseFactory) { return function () { var promise = queue.then(promiseFactory); queue = promise.catch(noop); // squelch return promise; }; }
javascript
{ "resource": "" }
q7609
getDigestsToLastUsed
train
function getDigestsToLastUsed(mainDoc, lastUsedDoc) { var result = {}; // dedup by digest, use the most recent date Object.keys(mainDoc._attachments).forEach(function (attName) { var att = mainDoc._attachments[attName]; var existing = result[att.digest] || 0; result[att.digest] = Math.max(existing, lastUsedDoc.lastUsed[att.digest]); }); return result; }
javascript
{ "resource": "" }
q7610
getLeastRecentlyUsed
train
function getLeastRecentlyUsed(mainDoc, lastUsedDoc) { var digestsToLastUsed = getDigestsToLastUsed(mainDoc, lastUsedDoc); var min; var minDigest; Object.keys(digestsToLastUsed).forEach(function (digest) { var lastUsed = digestsToLastUsed[digest]; if (typeof min === 'undefined' || min > lastUsed) { min = lastUsed; minDigest = digest; } }); return minDigest; }
javascript
{ "resource": "" }
q7611
scheduleFrame
train
function scheduleFrame(context, method) { method = context[method]; return requestAnimationFrame(method.bind(context)); }
javascript
{ "resource": "" }
q7612
exec
train
function exec(target, method, args, onError, stack) { try { method.apply(target, args); } catch (e) { if (onError) { onError(e, stack); } } }
javascript
{ "resource": "" }
q7613
_logWarn
train
function _logWarn(title, stack, test = false, options = {}) { if (test) { return; } const { groupCollapsed, log, trace, groupEnd } = console; if (groupCollapsed && trace && groupEnd) { groupCollapsed(title); log(options.id); trace(stack.stack); groupEnd(title); } else { warn(`${title}\n${stack.stack}`, test, options); } }
javascript
{ "resource": "" }
q7614
train
function(id, location) { var search = "?"+ (location.search || "") + "&hid=" + id; return (location.pathname || '/') + search + (location.hash ? ("#" + location.hash) : ""); }
javascript
{ "resource": "" }
q7615
train
function(location) { if (!location.search) return; location.search = location.search.replace(/&hid=([^&]+)/gi, function(c, v) { location.hid = v; return ""; }); location.path = location.pathname + (location.search ? ("?" + location.search) : ""); location.relative = location.path + (location.hash ? ("#" + location.hash) : ""); location.href = location.protocol + "://" + location.host + location.relative; }
javascript
{ "resource": "" }
q7616
_equals
train
function _equals(a, b) { switch (typeof a) { case 'undefined': case 'boolean': case 'string': case 'number': return a === b; case 'object': if (a === null) {return b === null;} if (_isArray(a)) { if (!_isArray(b) || a.length !== b.length) {return false;} for (var i = 0, l = a.length; i < l; i++) { if (!_equals(a[i], b[i])) {return false;} } return true; } var bKeys = _objectKeys(b); var bLength = bKeys.length; if (_objectKeys(a).length !== bLength) {return false;} for (var i = 0, k; i < bLength; i++) { k = bKeys[i]; if (!(k in a && _equals(a[k], b[k]))) {return false;} } return true; default: return false; } }
javascript
{ "resource": "" }
q7617
train
function (prototype) { if (!_.isObject(prototype)) return {}; if (nativeCreate) return nativeCreate(prototype); Ctor.prototype = prototype; var result = new Ctor(); Ctor.prototype = null; return result; }
javascript
{ "resource": "" }
q7618
omit
train
function omit(obj, blackList) { var newObj = {}; Object.keys(obj || {}).forEach(function (key) { if (blackList.indexOf(key) === -1) { newObj[key] = obj[key]; } }); return newObj; }
javascript
{ "resource": "" }
q7619
parseStartKey
train
function parseStartKey(key, restOfLine) { // When a new key is encountered, the rest of the line is immediately added as // its value, by calling `flushBuffer`. flushBuffer(); incrementArrayElement(key); if (stackScope && stackScope.flags.indexOf('+') > -1) key = 'value'; bufferKey = key; bufferString = restOfLine; flushBufferInto(key, { replace: true }); }
javascript
{ "resource": "" }
q7620
getParser
train
function getParser(delimiterOrParser) { var parser; if (typeof delimiterOrParser === 'string') { parser = discernParser(delimiterOrParser, { delimiter: true }); } else if (typeof delimiterOrParser === 'function' || (typeof delimiterOrParser === 'undefined' ? 'undefined' : _typeof(delimiterOrParser)) === 'object') { parser = delimiterOrParser; } return parser; }
javascript
{ "resource": "" }
q7621
formattingPreflight
train
function formattingPreflight(file, format) { if (file === '') { return []; } else if (!Array.isArray(file)) { notListError(format); } return file; }
javascript
{ "resource": "" }
q7622
readDbf
train
function readDbf(filePath, opts_, cb) { var parserOptions = { map: identity }; if (typeof cb === 'undefined') { cb = opts_; } else { parserOptions = typeof opts_ === 'function' ? { map: opts_ } : opts_; } readData(filePath, parserOptions, cb); }
javascript
{ "resource": "" }
q7623
readdirFilter
train
function readdirFilter(dirPath, opts_, cb) { if (typeof cb === 'undefined') { cb = opts_; opts_ = undefined; } readdir({ async: true }, dirPath, opts_, cb); }
javascript
{ "resource": "" }
q7624
readAml
train
function readAml(filePath, opts_, cb) { var parserOptions; if (typeof cb === 'undefined') { cb = opts_; } else { parserOptions = typeof opts_ === 'function' ? { map: opts_ } : opts_; } readData(filePath, { parser: parserAml, parserOptions: parserOptions }, cb); }
javascript
{ "resource": "" }
q7625
readAmlSync
train
function readAmlSync(filePath, opts_) { var parserOptions; if (typeof opts_ !== 'undefined') { parserOptions = typeof opts_ === 'function' ? { map: opts_ } : opts_; } return readDataSync(filePath, { parser: parserAml, parserOptions: parserOptions }); }
javascript
{ "resource": "" }
q7626
readCsv
train
function readCsv(filePath, opts_, cb) { var parserOptions; if (typeof cb === 'undefined') { cb = opts_; } else { parserOptions = typeof opts_ === 'function' ? { map: opts_ } : opts_; } readData(filePath, { parser: parserCsv, parserOptions: parserOptions }, cb); }
javascript
{ "resource": "" }
q7627
readCsvSync
train
function readCsvSync(filePath, opts_) { var parserOptions; if (typeof opts_ !== 'undefined') { parserOptions = typeof opts_ === 'function' ? { map: opts_ } : opts_; } return readDataSync(filePath, { parser: parserCsv, parserOptions: parserOptions }); }
javascript
{ "resource": "" }
q7628
readJson
train
function readJson(filePath, opts_, cb) { var parserOptions; if (typeof cb === 'undefined') { cb = opts_; } else { parserOptions = typeof opts_ === 'function' ? { map: opts_ } : opts_; } readData(filePath, { parser: parserJson, parserOptions: parserOptions }, cb); }
javascript
{ "resource": "" }
q7629
readJsonSync
train
function readJsonSync(filePath, opts_) { var parserOptions; if (typeof opts_ !== 'undefined') { parserOptions = typeof opts_ === 'function' ? { map: opts_ } : opts_; } return readDataSync(filePath, { parser: parserJson, parserOptions: parserOptions }); }
javascript
{ "resource": "" }
q7630
readPsv
train
function readPsv(filePath, opts_, cb) { var parserOptions; if (typeof cb === 'undefined') { cb = opts_; } else { parserOptions = typeof opts_ === 'function' ? { map: opts_ } : opts_; } readData(filePath, { parser: parserPsv, parserOptions: parserOptions }, cb); }
javascript
{ "resource": "" }
q7631
readPsvSync
train
function readPsvSync(filePath, opts_) { var parserOptions; if (typeof opts_ !== 'undefined') { parserOptions = typeof opts_ === 'function' ? { map: opts_ } : opts_; } return readDataSync(filePath, { parser: parserPsv, parserOptions: parserOptions }); }
javascript
{ "resource": "" }
q7632
readTsv
train
function readTsv(filePath, opts_, cb) { var parserOptions; if (typeof cb === 'undefined') { cb = opts_; } else { parserOptions = typeof opts_ === 'function' ? { map: opts_ } : opts_; } readData(filePath, { parser: parserTsv, parserOptions: parserOptions }, cb); }
javascript
{ "resource": "" }
q7633
readTsvSync
train
function readTsvSync(filePath, opts_) { var parserOptions; if (typeof opts_ !== 'undefined') { parserOptions = typeof opts_ === 'function' ? { map: opts_ } : opts_; } return readDataSync(filePath, { parser: parserTsv, parserOptions: parserOptions }); }
javascript
{ "resource": "" }
q7634
readTxt
train
function readTxt(filePath, opts_, cb) { var parserOptions; if (typeof cb === 'undefined') { cb = opts_; } else { parserOptions = typeof opts_ === 'function' ? { map: opts_ } : opts_; } readData(filePath, { parser: parserTxt, parserOptions: parserOptions }, cb); }
javascript
{ "resource": "" }
q7635
readTxtSync
train
function readTxtSync(filePath, opts_) { var parserOptions; if (typeof opts_ !== 'undefined') { parserOptions = typeof opts_ === 'function' ? { map: opts_ } : opts_; } return readDataSync(filePath, { parser: parserTxt, parserOptions: parserOptions }); }
javascript
{ "resource": "" }
q7636
_getInsertionIndex
train
function _getInsertionIndex (array, element, comparer, start, end) { if (array.length === 0) { return 0; } var pivot = (start + end) >> 1; var result = comparer( { value: element, index: pivot }, { value: array[pivot], index: pivot } ); if (end - start <= 1) { return result < 0 ? pivot : pivot + 1; } else if (result < 0) { return _getInsertionIndex(array, element, comparer, start, pivot); } else if (result === 0) { return pivot + 1; } else { return _getInsertionIndex(array, element, comparer, pivot, end); } }
javascript
{ "resource": "" }
q7637
_getNumConsecutiveHits
train
function _getNumConsecutiveHits (arrayLike, predicate) { var idx = 0; var len = arrayLike.length; while (idx < len && predicate(arrayLike[idx], idx, arrayLike)) { idx++; } return idx; }
javascript
{ "resource": "" }
q7638
train
function(src, dest) { var i = 0; var len = Math.min(src.length, dest.length); while(i < len) { dest[i] = src[i]; i++; } return dest; }
javascript
{ "resource": "" }
q7639
train
function(month, year1, year2) { var leap1 = isLeap(year1 - 1); var leap2 = isLeap(year2 - 1); if(month < 5 + leap1) return 0; return leap2 - leap1; }
javascript
{ "resource": "" }
q7640
train
function() { /** * Reference to this key event. */ var key_event = this; /** * An arbitrary timestamp in milliseconds, indicating this event's * position in time relative to other events. * * @type {Number} */ this.timestamp = new Date().getTime(); /** * Whether the default action of this key event should be prevented. * * @type {Boolean} */ this.defaultPrevented = false; /** * The keysym of the key associated with this key event, as determined * by a best-effort guess using available event properties and keyboard * state. * * @type {Number} */ this.keysym = null; /** * Whether the keysym value of this key event is known to be reliable. * If false, the keysym may still be valid, but it's only a best guess, * and future key events may be a better source of information. * * @type {Boolean} */ this.reliable = false; /** * Returns the number of milliseconds elapsed since this event was * received. * * @return {Number} The number of milliseconds elapsed since this * event was received. */ this.getAge = function() { return new Date().getTime() - key_event.timestamp; }; }
javascript
{ "resource": "" }
q7641
train
function(charCode) { // We extend KeyEvent KeyEvent.apply(this); /** * The Unicode codepoint of the character that would be typed by the * key pressed. * * @type {Number} */ this.charCode = charCode; // Pull keysym from char code this.keysym = keysym_from_charcode(charCode); // Keypress is always reliable this.reliable = true; }
javascript
{ "resource": "" }
q7642
update_modifier_state
train
function update_modifier_state(e) { // Get state var state = Guacamole.Keyboard.ModifierState.fromKeyboardEvent(e); // Release alt if implicitly released if (guac_keyboard.modifiers.alt && state.alt === false) { guac_keyboard.release(0xFFE9); // Left alt guac_keyboard.release(0xFFEA); // Right alt guac_keyboard.release(0xFE03); // AltGr } // Release shift if implicitly released if (guac_keyboard.modifiers.shift && state.shift === false) { guac_keyboard.release(0xFFE1); // Left shift guac_keyboard.release(0xFFE2); // Right shift } // Release ctrl if implicitly released if (guac_keyboard.modifiers.ctrl && state.ctrl === false) { guac_keyboard.release(0xFFE3); // Left ctrl guac_keyboard.release(0xFFE4); // Right ctrl } // Release meta if implicitly released if (guac_keyboard.modifiers.meta && state.meta === false) { guac_keyboard.release(0xFFE7); // Left meta guac_keyboard.release(0xFFE8); // Right meta } // Release hyper if implicitly released if (guac_keyboard.modifiers.hyper && state.hyper === false) { guac_keyboard.release(0xFFEB); // Left hyper guac_keyboard.release(0xFFEC); // Right hyper } // Update state guac_keyboard.modifiers = state; }
javascript
{ "resource": "" }
q7643
release_simulated_altgr
train
function release_simulated_altgr(keysym) { // Both Ctrl+Alt must be pressed if simulated AltGr is in use if (!guac_keyboard.modifiers.ctrl || !guac_keyboard.modifiers.alt) return; // Assume [A-Z] never require AltGr if (keysym >= 0x0041 && keysym <= 0x005A) return; // Assume [a-z] never require AltGr if (keysym >= 0x0061 && keysym <= 0x007A) return; // Release Ctrl+Alt if the keysym is printable if (keysym <= 0xFF || (keysym & 0xFF000000) === 0x01000000) { guac_keyboard.release(0xFFE3); // Left ctrl guac_keyboard.release(0xFFE4); // Right ctrl guac_keyboard.release(0xFFE9); // Left alt guac_keyboard.release(0xFFEA); // Right alt } }
javascript
{ "resource": "" }
q7644
interpret_event
train
function interpret_event() { // Peek at first event in log var first = eventLog[0]; if (!first) return null; // Keydown event if (first instanceof KeydownEvent) { var keysym = null; var accepted_events = []; // If event itself is reliable, no need to wait for other events if (first.reliable) { keysym = first.keysym; accepted_events = eventLog.splice(0, 1); } // If keydown is immediately followed by a keypress, use the indicated character else if (eventLog[1] instanceof KeypressEvent) { keysym = eventLog[1].keysym; accepted_events = eventLog.splice(0, 2); } // If keydown is immediately followed by anything else, then no // keypress can possibly occur to clarify this event, and we must // handle it now else if (eventLog[1]) { keysym = first.keysym; accepted_events = eventLog.splice(0, 1); } // Fire a key press if valid events were found if (accepted_events.length > 0) { if (keysym) { // Fire event release_simulated_altgr(keysym); var defaultPrevented = !guac_keyboard.press(keysym); recentKeysym[first.keyCode] = keysym; // If a key is pressed while meta is held down, the keyup will // never be sent in Chrome, so send it now. (bug #108404) if (guac_keyboard.modifiers.meta && keysym !== 0xFFE7 && keysym !== 0xFFE8) guac_keyboard.release(keysym); // Record whether default was prevented for (var i=0; i<accepted_events.length; i++) accepted_events[i].defaultPrevented = defaultPrevented; } return first; } } // end if keydown // Keyup event else if (first instanceof KeyupEvent) { // Release specific key if known var keysym = first.keysym; if (keysym) { guac_keyboard.release(keysym); first.defaultPrevented = true; } // Otherwise, fall back to releasing all keys else { guac_keyboard.reset(); return first; } return eventLog.shift(); } // end if keyup // Ignore any other type of event (keypress by itself is invalid) else return eventLog.shift(); // No event interpreted return null; }
javascript
{ "resource": "" }
q7645
train
function(str) { var output; try { output = opts.template(str); } catch (e) { e.message = error.badTemplate + ': ' + e.message; return this.emit('error', new PluginError('gulp-concat-filenames', e)); } if (typeof output !== 'string') { return this.emit('error', new PluginError('gulp-concat-filenames', error.badTemplate)); } return output; }
javascript
{ "resource": "" }
q7646
transformIntoQueryParamSchema
train
function transformIntoQueryParamSchema(processedSchema) { return _.transform( processedSchema.items.properties, (result, value, key) => { const parameter = Object.assign( { name: key }, value, { type: Array.isArray(value.type) ? value.type[0] : value.type, required: !_.includes(value.type, "null") } ); result.push(parameter); }, [] ); }
javascript
{ "resource": "" }
q7647
DOTHAT
train
function DOTHAT() { if (!(this instanceof DOTHAT)) { return new DOTHAT(); } this.displayOTron = new DisplayOTron('HAT'); this.lcd = new LCD(this.displayOTron); this.backlight = new Backlight(this.displayOTron); this.barGraph = new BarGraph(this.displayOTron); this.touch = new Touch(this.displayOTron); }
javascript
{ "resource": "" }
q7648
setAuthType
train
function setAuthType(auth_type) { var headers = { 'Content-Type': 'application/json', 'Accept': 'application/json' }; if (auth_type == 'AccessToken') { headers['Authorization'] = _config.access_token; } else if (auth_type == 'AppCredentials') { headers['x-accela-appid'] = _config.app_id headers['x-accela-appsecret'] = _config.app_secret; } else { headers['x-accela-appid'] = _config.app_id headers['x-accela-agency'] = _config.agency; headers['x-accela-environment'] = _config.environment; } return headers; }
javascript
{ "resource": "" }
q7649
escapeCharacters
train
function escapeCharacters(params) { return params; var find = new Array('.','-','%','/','\\\\',':','*','\\','<','>','|','?',' ','&','#'); var replace = new Array('.0','.1','.2','.3','.4','.5','.6','.7','.8','.9','.a','.b','.c','.d','.e'); var escaped = {}; for (var param in params) { if(typeof(params[param]) == 'string') { escaped[param] = replaceCharacter(find, replace, params[param]); } else { escaped[param] = params[param]; } } return escaped; }
javascript
{ "resource": "" }
q7650
replaceCharacter
train
function replaceCharacter(search, replace, subject, count) { var i = 0, j = 0, temp = '', repl = '', sl = 0, fl = 0, f = [].concat(search), r = [].concat(replace), s = subject, ra = Object.prototype.toString.call(r) === '[object Array]', sa = Object.prototype.toString.call(s) === '[object Array]', s = [].concat(s); if(typeof(search) === 'object' && typeof(replace) === 'string' ) { temp = replace; replace = new Array(); for (i=0; i < search.length; i+=1) { replace[i] = temp; } temp = ''; r = [].concat(replace); ra = Object.prototype.toString.call(r) === '[object Array]'; } if (count) { this.window[count] = 0; } for (i = 0, sl = s.length; i < sl; i++) { if (s[i] === '') { continue; } for (j = 0, fl = f.length; j < fl; j++) { temp = s[i] + ''; repl = ra ? (r[j] !== undefined ? r[j] : '') : r[0]; s[i] = (temp) .split(f[j]) .join(repl); if (count) { this.window[count] += ((temp.split(f[j])).length - 1); } } } return sa ? s : s[0]; }
javascript
{ "resource": "" }
q7651
buildQueryString
train
function buildQueryString(params) { var querystring = ''; for(param in params) { querystring += '&' + param + '=' + params[param]; } return querystring; }
javascript
{ "resource": "" }
q7652
makeRequest
train
function makeRequest(options, callback) { request(options, function (error, response, body){ if (error) { callback(error, null); } else if (response.statusCode == 200) { callback( null, JSON.parse(body)); } else { callback(new Error('HTTP Response Code: ' + response.statusCode), null); } }); }
javascript
{ "resource": "" }
q7653
_setFilter
train
function _setFilter(filt) { filt = filt.trim() if (filt === 'all') this.filter = filt else if (filt in _filters) { if (this.filter !== 'all' && this.filter.indexOf(filt) < 0) this.filter.push(filt) } else this.invalid('filter', filt) }
javascript
{ "resource": "" }
q7654
_createFilter
train
function _createFilter(res) { for (var i = 0; i < res.length; ++i) { var f = res[i] if (f instanceof RegExp) custfilt.push(f) else { //console.log('--- creating regex with `' + str + '`') try { f = new RegExp(f) custfilt.push(f) } catch (e) { f = null } if (!f) this.invalid('custom filter', res[i]) } } }
javascript
{ "resource": "" }
q7655
_getPathKey
train
function _getPathKey (target, key, includeNonEnumerables) { if (includeNonEnumerables && key in Object(target) || _isEnumerable(target, key)) { return key; } var n = +key; var len = target && target.length; return n >= -len && n < len ? n < 0 ? n + len : n : void 0; }
javascript
{ "resource": "" }
q7656
_sorter
train
function _sorter (reader, isDescending, comparer) { if (typeof reader !== "function" || reader === identity) { reader = null; } if (typeof comparer !== "function") { comparer = _comparer; } return { isDescending: isDescending === true, compare: function (a, b) { if (reader) { a = reader(a); b = reader(b); } return comparer(a, b); } }; }
javascript
{ "resource": "" }
q7657
_merge
train
function _merge (getKeys, a, b) { return reduce([a, b], function (result, source) { forEach(getKeys(source), function (key) { result[key] = source[key]; }); return result; }, {}); }
javascript
{ "resource": "" }
q7658
trigger
train
function trigger(el, name, options){ var event, type; type = eventTypes[name]; if (!type) { throw new SyntaxError('Unknown event type: '+type); } options = options || {}; inherit(defaults, options); if (document.createEvent) { // Standard Event event = document.createEvent(type); initializers[type](el, name, event, options); el.dispatchEvent(event); } else { // IE Event event = document.createEventObject(); for (var key in options){ event[key] = options[key]; } el.fireEvent('on' + name, event); } }
javascript
{ "resource": "" }
q7659
train
function (util) { function printable(str) { return ('' + str).replace(/\n/g, '\\n').replace(/\r/g, '\\r') } function compare(actual, expected) { var pass = actual === expected return { pass: pass, message: util.buildFailureMessage( 'toHasLinesLike', pass, printable(actual), printable(expected)) } } return {compare: compare} }
javascript
{ "resource": "" }
q7660
train
function (/*util*/) { function compare(actual, expected) { return { pass: actual instanceof Error && ('' + actual).indexOf(expected) >= 0 } } return {compare: compare} }
javascript
{ "resource": "" }
q7661
mousewheel_handler
train
function mousewheel_handler(e) { // Determine approximate scroll amount (in pixels) var delta = e.deltaY || -e.wheelDeltaY || -e.wheelDelta; // If successfully retrieved scroll amount, convert to pixels if not // already in pixels if (delta) { // Convert to pixels if delta was lines if (e.deltaMode === 1) delta = e.deltaY * guac_mouse.PIXELS_PER_LINE; // Convert to pixels if delta was pages else if (e.deltaMode === 2) delta = e.deltaY * guac_mouse.PIXELS_PER_PAGE; } // Otherwise, assume legacy mousewheel event and line scrolling else delta = e.detail * guac_mouse.PIXELS_PER_LINE; // Update overall delta scroll_delta += delta; // Up if (scroll_delta <= -guac_mouse.scrollThreshold) { // Repeatedly click the up button until insufficient delta remains do { if (guac_mouse.onmousedown) { guac_mouse.currentState.up = true; guac_mouse.onmousedown(guac_mouse.currentState); } if (guac_mouse.onmouseup) { guac_mouse.currentState.up = false; guac_mouse.onmouseup(guac_mouse.currentState); } scroll_delta += guac_mouse.scrollThreshold; } while (scroll_delta <= -guac_mouse.scrollThreshold); // Reset delta scroll_delta = 0; } // Down if (scroll_delta >= guac_mouse.scrollThreshold) { // Repeatedly click the down button until insufficient delta remains do { if (guac_mouse.onmousedown) { guac_mouse.currentState.down = true; guac_mouse.onmousedown(guac_mouse.currentState); } if (guac_mouse.onmouseup) { guac_mouse.currentState.down = false; guac_mouse.onmouseup(guac_mouse.currentState); } scroll_delta -= guac_mouse.scrollThreshold; } while (scroll_delta >= guac_mouse.scrollThreshold); // Reset delta scroll_delta = 0; } cancelEvent(e); }
javascript
{ "resource": "" }
q7662
press_button
train
function press_button(button) { if (!guac_touchscreen.currentState[button]) { guac_touchscreen.currentState[button] = true; if (guac_touchscreen.onmousedown) guac_touchscreen.onmousedown(guac_touchscreen.currentState); } }
javascript
{ "resource": "" }
q7663
release_button
train
function release_button(button) { if (guac_touchscreen.currentState[button]) { guac_touchscreen.currentState[button] = false; if (guac_touchscreen.onmouseup) guac_touchscreen.onmouseup(guac_touchscreen.currentState); } }
javascript
{ "resource": "" }
q7664
move_mouse
train
function move_mouse(x, y) { guac_touchscreen.currentState.fromClientPosition(element, x, y); if (guac_touchscreen.onmousemove) guac_touchscreen.onmousemove(guac_touchscreen.currentState); }
javascript
{ "resource": "" }
q7665
finger_moved
train
function finger_moved(e) { var touch = e.touches[0] || e.changedTouches[0]; var delta_x = touch.clientX - gesture_start_x; var delta_y = touch.clientY - gesture_start_y; return Math.sqrt(delta_x*delta_x + delta_y*delta_y) >= guac_touchscreen.clickMoveThreshold; }
javascript
{ "resource": "" }
q7666
begin_gesture
train
function begin_gesture(e) { var touch = e.touches[0]; gesture_in_progress = true; gesture_start_x = touch.clientX; gesture_start_y = touch.clientY; }
javascript
{ "resource": "" }
q7667
shevchenko
train
function shevchenko(anthroponym, inflectionCase) { return anthroponymInflector.inflect(new Anthroponym(anthroponym), new InflectionCase(inflectionCase)).toObject(); }
javascript
{ "resource": "" }
q7668
dequeueBodyCallback
train
function dequeueBodyCallback(name) { // If no callbacks defined, simply return null var callbacks = bodyCallbacks[name]; if (!callbacks) return null; // Otherwise, pull off first callback, deleting the queue if empty var callback = callbacks.shift(); if (callbacks.length === 0) delete bodyCallbacks[name]; // Return found callback return callback; }
javascript
{ "resource": "" }
q7669
enqueueBodyCallback
train
function enqueueBodyCallback(name, callback) { // Get callback queue by name, creating first if necessary var callbacks = bodyCallbacks[name]; if (!callbacks) { callbacks = []; bodyCallbacks[name] = callbacks; } // Add callback to end of queue callbacks.push(callback); }
javascript
{ "resource": "" }
q7670
getLayer
train
function getLayer(index) { // Get layer, create if necessary var layer = layers[index]; if (!layer) { // Create layer based on index if (index === 0) layer = display.getDefaultLayer(); else if (index > 0) layer = display.createLayer(); else layer = display.createBuffer(); // Add new layer layers[index] = layer; } return layer; }
javascript
{ "resource": "" }
q7671
findFrame
train
function findFrame(minIndex, maxIndex, timestamp) { // Do not search if the region contains only one element if (minIndex === maxIndex) return minIndex; // Split search region into two halves var midIndex = Math.floor((minIndex + maxIndex) / 2); var midTimestamp = toRelativeTimestamp(frames[midIndex].timestamp); // If timestamp is within lesser half, search again within that half if (timestamp < midTimestamp && midIndex > minIndex) return findFrame(minIndex, midIndex - 1, timestamp); // If timestamp is within greater half, search again within that half if (timestamp > midTimestamp && midIndex < maxIndex) return findFrame(midIndex + 1, maxIndex, timestamp); // Otherwise, we lucked out and found a frame with exactly the // desired timestamp return midIndex; }
javascript
{ "resource": "" }
q7672
replayFrame
train
function replayFrame(index) { var frame = frames[index]; // Replay all instructions within the retrieved frame for (var i = 0; i < frame.instructions.length; i++) { var instruction = frame.instructions[i]; playbackTunnel.receiveInstruction(instruction.opcode, instruction.args); } // Store client state if frame is flagged as a keyframe if (frame.keyframe && !frame.clientState) { playbackClient.exportState(function storeClientState(state) { frame.clientState = state; }); } }
javascript
{ "resource": "" }
q7673
seekToFrame
train
function seekToFrame(index, callback, delay) { // Abort any in-progress seek abortSeek(); // Replay frames asynchronously seekTimeout = window.setTimeout(function continueSeek() { var startIndex; // Back up until startIndex represents current state for (startIndex = index; startIndex >= 0; startIndex--) { var frame = frames[startIndex]; // If we've reached the current frame, startIndex represents // current state by definition if (startIndex === currentFrame) break; // If frame has associated absolute state, make that frame the // current state if (frame.clientState) { playbackClient.importState(frame.clientState); break; } } // Advance to frame index after current state startIndex++; var startTime = new Date().getTime(); // Replay any applicable incremental frames for (; startIndex <= index; startIndex++) { // Stop seeking if the operation is taking too long var currentTime = new Date().getTime(); if (currentTime - startTime >= MAXIMUM_SEEK_TIME) break; replayFrame(startIndex); } // Current frame is now at requested index currentFrame = startIndex - 1; // Notify of changes in position if (recording.onseek) recording.onseek(recording.getPosition()); // If the seek operation has not yet completed, schedule continuation if (currentFrame !== index) seekToFrame(index, callback, Math.max(delay - (new Date().getTime() - startTime), 0)); // Notify that the requested seek has completed else callback(); }, delay || 0); }
javascript
{ "resource": "" }
q7674
continuePlayback
train
function continuePlayback() { // If frames remain after advancing, schedule next frame if (currentFrame + 1 < frames.length) { // Pull the upcoming frame var next = frames[currentFrame + 1]; // Calculate the real timestamp corresponding to when the next // frame begins var nextRealTimestamp = next.timestamp - startVideoTimestamp + startRealTimestamp; // Calculate the relative delay between the current time and // the next frame start var delay = Math.max(nextRealTimestamp - new Date().getTime(), 0); // Advance to next frame after enough time has elapsed seekToFrame(currentFrame + 1, function frameDelayElapsed() { continuePlayback(); }, delay); } // Otherwise stop playback else recording.pause(); }
javascript
{ "resource": "" }
q7675
getCmd
train
function getCmd(program, opt) { var cmd, expr; if(program==='ogr2ogr') { if(opt==='where') { expr = [ '-where ', "\"", specs.key, " IN ", "('", specs.val, "')\" ", '-clipsrc ', specs.bounds.join(' ') ].join(''); } else if(opt==='clipsrc') { expr = [ '-clipsrc ', specs.bounds.join(' ') ].join(''); } else expr = ''; cmd = [ "ogr2ogr -f GeoJSON", expr, common.geojsonDir + common.tn(r, s.name, v.name, 'geo.json'), common.wgetDir + common.srcPrefix + common.bn(r, v.src, 'shp') ].join(' '); } else if(program==='mapshaper') { cmd = [ mapshaper, common.wgetDir + common.srcPrefix + common.bn(r, v.src, 'shp'), "encoding=utf8", "-clip", common.wgetDir + common.tn(r, s.name, specs.src, 'shp'), "-filter remove-empty", "-o", common.geojsonDir + common.tn(r, s.name, v.name, 'geo.json') ].join(' '); } return cmd; }
javascript
{ "resource": "" }
q7676
swaggerQueryParamsToSchema
train
function swaggerQueryParamsToSchema(queryModel) { const requiredFields = []; const transformedProperties = {}; _.forOwn(queryModel.items.properties, (value, key) => { if (value.required) { requiredFields.push(key); } transformedProperties[key] = { ...value }; if (!_.isNil(transformedProperties[key].required)) { delete transformedProperties[key].required; } }); return { title: queryModel.title, description: queryModel.description, additionalProperties: false, required: requiredFields, properties: transformedProperties }; }
javascript
{ "resource": "" }
q7677
generateSchemaRaw
train
function generateSchemaRaw(modelParam, opts = {}) { validate.notNil(modelParam, "modelParam is mandatory"); let models; if (_.isArray(modelParam)) { models = modelParam; } else if (_.isObject(modelParam)) { models = [modelParam]; } else { throw new Error("modelParam should be an object or an array of objects"); } return models.map(model => { const processedSchema = modelTransformer.transformJsonSchemaFromModel( model, opts ); return { name: model.name, schema: processedSchema }; }); }
javascript
{ "resource": "" }
q7678
saveSchema
train
function saveSchema(modelParam, targetDir, opts = {}) { validate.notNil(modelParam, "modelParam is mandatory"); validate.notNil(targetDir, "targetDir is mandatory"); const yamlSchemaContainers = generateSchema(modelParam, opts); return yamlWriter.writeYamlsToFs(yamlSchemaContainers, targetDir, opts); }
javascript
{ "resource": "" }
q7679
saveNonModelSchema
train
function saveNonModelSchema(schemaParam, targetDir, opts = {}) { validate.notNil(schemaParam, "schemaParam is mandatory"); validate.notNil(targetDir, "targetDir is mandatory"); if (!Array.isArray(schemaParam)) { schemaParam = [schemaParam]; } const yamlSchemaContainers = schemaParam.map(schema => { const processedSchema = jsonSchemaTransformer.transformSchema(schema, opts); return { name: schema.title, schema: yaml.dump(processedSchema) }; }); return yamlWriter.writeYamlsToFs(yamlSchemaContainers, targetDir, opts); }
javascript
{ "resource": "" }
q7680
saveQueryParamSchema
train
function saveQueryParamSchema(schemaParam, targetDir, opts = {}) { validate.notNil(schemaParam, "schemaParam is mandatory"); validate.notNil(targetDir, "targetDir is mandatory"); if (!Array.isArray(schemaParam)) { schemaParam = [schemaParam]; } const yamlSchemaContainers = schemaParam.map(schema => { const modelSchema = jsonSchemaTransformer.transformSchema(schema, opts); const queryParamSchema = queryParamTransformer.transformIntoQueryParamSchema( modelSchema ); return { name: schema.title, schema: yaml.dump(queryParamSchema) }; }); return yamlWriter.writeYamlsToFs(yamlSchemaContainers, targetDir, opts); }
javascript
{ "resource": "" }
q7681
_toInteger
train
function _toInteger (value) { var n = +value; if (n !== n) { // eslint-disable-line no-self-compare return 0; } else if (n % 1 === 0) { return n; } else { return Math.floor(Math.abs(n)) * (n < 0 ? -1 : 1); } }
javascript
{ "resource": "" }
q7682
renderStats
train
function renderStats(stats) { /** * Creates table Header if necessary * @param {string} type error or warning * @returns {string} The formatted string */ function injectHeader(type) { return (stats[type]) ? '| rule | count | visual |\n| --- | --- | --- |\n' : ''; } /** * renders templates for each rule * @param {string} type error or warning * @returns {string} The formatted string, pluralized where necessary */ function output(type) { var statstype = stats[type]; return injectHeader(type) + lodash.map(statstype, function (ruleStats, ruleId) { return statsRowTemplate({ ruleId: ruleId, ruleCount: ruleStats, visual: lodash.repeat('X', lodash.min([ruleStats, 20])) }); }, '').join(''); } /** * render template for severity * @param {string} type severity * @returns {string} template */ function renderTemplate(type) { var lcType = lodash.lowerCase(type); if (lodash.size(stats[lcType])) { return statsTemplate({ title: '### ' + type, items: output(lcType) }); } else { return ''; } } return renderTemplate('Errors') + renderTemplate('Warnings'); }
javascript
{ "resource": "" }
q7683
output
train
function output(type) { var statstype = stats[type]; return injectHeader(type) + lodash.map(statstype, function (ruleStats, ruleId) { return statsRowTemplate({ ruleId: ruleId, ruleCount: ruleStats, visual: lodash.repeat('X', lodash.min([ruleStats, 20])) }); }, '').join(''); }
javascript
{ "resource": "" }
q7684
renderTemplate
train
function renderTemplate(type) { var lcType = lodash.lowerCase(type); if (lodash.size(stats[lcType])) { return statsTemplate({ title: '### ' + type, items: output(lcType) }); } else { return ''; } }
javascript
{ "resource": "" }
q7685
__send_blob
train
function __send_blob(bytes) { var binary = ""; // Produce binary string from bytes in buffer for (var i=0; i<bytes.byteLength; i++) binary += String.fromCharCode(bytes[i]); // Send as base64 stream.sendBlob(window.btoa(binary)); }
javascript
{ "resource": "" }
q7686
setBrightnessOfLed
train
function setBrightnessOfLed(callback) { var ledIndex = 8; var setBrightnessOfLedInterval = setInterval(function() { if (ledIndex >= 0) { dot3k.barGraph.setBrightnessOfLed(ledIndex, 0); ledIndex--; } else { clearInterval(setBrightnessOfLedInterval); if (callback) { callback(); } } }, 500); }
javascript
{ "resource": "" }
q7687
_getPadding
train
function _getPadding (source, char, len) { if (!isNil(source) && type(source) !== "String") { source = String(source); } return _repeat(String(char)[0] || "", Math.ceil(len - source.length)); }
javascript
{ "resource": "" }
q7688
fetchTokensData
train
function fetchTokensData (tokenRegContract, tokenIndexes) { return (dispatch, getState) => { const { api, tokens } = getState(); const allTokens = Object.values(tokens); const tokensIndexesMap = allTokens .reduce((map, token) => { map[token.index] = token; return map; }, {}); const fetchedTokenIndexes = allTokens .filter((token) => token.fetched) .map((token) => token.index); const fullIndexes = []; const partialIndexes = []; tokenIndexes.forEach((tokenIndex) => { if (fetchedTokenIndexes.includes(tokenIndex)) { partialIndexes.push(tokenIndex); } else { fullIndexes.push(tokenIndex); } }); log.debug('need to fully fetch', fullIndexes); log.debug('need to partially fetch', partialIndexes); const fullPromise = fetchTokensInfo(api, tokenRegContract, fullIndexes); const partialPromise = fetchTokensImages(api, tokenRegContract, partialIndexes) .then((imagesResult) => { return imagesResult.map((image, index) => { const tokenIndex = partialIndexes[index]; const token = tokensIndexesMap[tokenIndex]; return { ...token, image }; }); }); return Promise.all([ fullPromise, partialPromise ]) .then(([ fullResults, partialResults ]) => { log.debug('fetched', { fullResults, partialResults }); return [] .concat(fullResults, partialResults) .filter(({ address }) => !/0x0*$/.test(address)) .reduce((tokens, token) => { const { id } = token; tokens[id] = token; return tokens; }, {}); }) .then((tokens) => { dispatch(setTokens(tokens)); }); }; }
javascript
{ "resource": "" }
q7689
resize
train
function resize(newWidth, newHeight) { // Default size to zero newWidth = newWidth || 0; newHeight = newHeight || 0; // Calculate new dimensions of internal canvas var canvasWidth = Math.ceil(newWidth / CANVAS_SIZE_FACTOR) * CANVAS_SIZE_FACTOR; var canvasHeight = Math.ceil(newHeight / CANVAS_SIZE_FACTOR) * CANVAS_SIZE_FACTOR; // Resize only if canvas dimensions are actually changing if (canvas.width !== canvasWidth || canvas.height !== canvasHeight) { // Copy old data only if relevant and non-empty var oldData = null; if (!empty && canvas.width !== 0 && canvas.height !== 0) { // Create canvas and context for holding old data oldData = document.createElement("canvas"); oldData.width = Math.min(layer.width, newWidth); oldData.height = Math.min(layer.height, newHeight); var oldDataContext = oldData.getContext("2d"); // Copy image data from current oldDataContext.drawImage(canvas, 0, 0, oldData.width, oldData.height, 0, 0, oldData.width, oldData.height); } // Preserve composite operation var oldCompositeOperation = context.globalCompositeOperation; // Resize canvas canvas.width = canvasWidth; canvas.height = canvasHeight; // Redraw old data, if any if (oldData) context.drawImage(oldData, 0, 0, oldData.width, oldData.height, 0, 0, oldData.width, oldData.height); // Restore composite operation context.globalCompositeOperation = oldCompositeOperation; // Acknowledge reset of stack (happens on resize of canvas) stackSize = 0; context.save(); } // If the canvas size is not changing, manually force state reset else layer.reset(); // Assign new layer dimensions layer.width = newWidth; layer.height = newHeight; }
javascript
{ "resource": "" }
q7690
fitRect
train
function fitRect(x, y, w, h) { // Calculate bounds var opBoundX = w + x; var opBoundY = h + y; // Determine max width var resizeWidth; if (opBoundX > layer.width) resizeWidth = opBoundX; else resizeWidth = layer.width; // Determine max height var resizeHeight; if (opBoundY > layer.height) resizeHeight = opBoundY; else resizeHeight = layer.height; // Resize if necessary layer.resize(resizeWidth, resizeHeight); }
javascript
{ "resource": "" }
q7691
_mkdom
train
function _mkdom(templ, html) { var match = templ && templ.match(/^\s*<([-\w]+)/), tagName = match && match[1].toLowerCase(), rootTag = rootEls[tagName] || GENERIC, el = mkEl(rootTag) el.stub = true // replace all the yield tags with the tag inner html if (html) templ = replaceYield(templ, html) /* istanbul ignore next */ if (checkIE && tagName && (match = tagName.match(SPECIAL_TAGS_REGEX))) ie9elem(el, templ, tagName, !!match[1]) else el.innerHTML = templ return el }
javascript
{ "resource": "" }
q7692
update
train
function update(expressions, tag) { each(expressions, function(expr, i) { var dom = expr.dom, attrName = expr.attr, value = tmpl(expr.expr, tag), parent = expr.dom.parentNode if (expr.bool) value = value ? attrName : false else if (value == null) value = '' // leave out riot- prefixes from strings inside textarea // fix #815: any value -> string if (parent && parent.tagName == 'TEXTAREA') { value = ('' + value).replace(/riot-/g, '') // change textarea's value parent.value = value } // no change if (expr.value === value) return expr.value = value // text node if (!attrName) { dom.nodeValue = '' + value // #815 related return } // remove original attribute remAttr(dom, attrName) // event handler if (isFunction(value)) { setEventHandler(attrName, value, dom, tag) // if- conditional } else if (attrName == 'if') { var stub = expr.stub, add = function() { insertTo(stub.parentNode, stub, dom) }, remove = function() { insertTo(dom.parentNode, dom, stub) } // add to DOM if (value) { if (stub) { add() dom.inStub = false // avoid to trigger the mount event if the tags is not visible yet // maybe we can optimize this avoiding to mount the tag at all if (!isInStub(dom)) { walk(dom, function(el) { if (el._tag && !el._tag.isMounted) el._tag.isMounted = !!el._tag.trigger('mount') }) } } // remove from DOM } else { stub = expr.stub = stub || document.createTextNode('') // if the parentNode is defined we can easily replace the tag if (dom.parentNode) remove() // otherwise we need to wait the updated event else (tag.parent || tag).one('updated', remove) dom.inStub = true } // show / hide } else if (/^(show|hide)$/.test(attrName)) { if (attrName == 'hide') value = !value dom.style.display = value ? '' : 'none' // field value } else if (attrName == 'value') { dom.value = value // <img src="{ expr }"> } else if (startsWith(attrName, RIOT_PREFIX) && attrName != RIOT_TAG) { if (value) setAttr(dom, attrName.slice(RIOT_PREFIX.length), value) } else { if (expr.bool) { dom[attrName] = value if (!value) return } if (value === 0 || value && typeof value !== T_OBJECT) setAttr(dom, attrName, value) } }) }
javascript
{ "resource": "" }
q7693
each
train
function each(els, fn) { for (var i = 0, len = (els || []).length, el; i < len; i++) { el = els[i] // return false -> remove current item during loop if (el != null && fn(el, i) === false) i-- } return els }
javascript
{ "resource": "" }
q7694
addChildTag
train
function addChildTag(tag, tagName, parent) { var cachedTag = parent.tags[tagName] // if there are multiple children tags having the same name if (cachedTag) { // if the parent tags property is not yet an array // create it adding the first cached tag if (!isArray(cachedTag)) // don't add the same tag twice if (cachedTag !== tag) parent.tags[tagName] = [cachedTag] // add the new nested tag to the array if (!contains(parent.tags[tagName], tag)) parent.tags[tagName].push(tag) } else { parent.tags[tagName] = tag } }
javascript
{ "resource": "" }
q7695
isWritable
train
function isWritable(obj, key) { var props = Object.getOwnPropertyDescriptor(obj, key) return typeof obj[key] === T_UNDEF || props && props.writable }
javascript
{ "resource": "" }
q7696
isInStub
train
function isInStub(dom) { while (dom) { if (dom.inStub) return true dom = dom.parentNode } return false }
javascript
{ "resource": "" }
q7697
setNamed
train
function setNamed(dom, parent, keys) { // get the key value we want to add to the tag instance var key = getNamedKey(dom), isArr, // add the node detected to a tag instance using the named property add = function(value) { // avoid to override the tag properties already set if (contains(keys, key)) return // check whether this value is an array isArr = isArray(value) // if the key was never set if (!value) // set it once on the tag instance parent[key] = dom // if it was an array and not yet set else if (!isArr || isArr && !contains(value, dom)) { // add the dom node into the array if (isArr) value.push(dom) else parent[key] = [value, dom] } } // skip the elements with no named properties if (!key) return // check whether this key has been already evaluated if (tmpl.hasExpr(key)) // wait the first updated event only once parent.one('mount', function() { key = getNamedKey(dom) add(parent[key]) }) else add(parent[key]) }
javascript
{ "resource": "" }
q7698
train
function(value) { // avoid to override the tag properties already set if (contains(keys, key)) return // check whether this value is an array isArr = isArray(value) // if the key was never set if (!value) // set it once on the tag instance parent[key] = dom // if it was an array and not yet set else if (!isArr || isArr && !contains(value, dom)) { // add the dom node into the array if (isArr) value.push(dom) else parent[key] = [value, dom] } }
javascript
{ "resource": "" }
q7699
isColumnReorderable
train
function isColumnReorderable() { var originalMethodFromPrototype = Object.getPrototypeOf(this).isColumnReorderable, isReorderable = originalMethodFromPrototype.call(this), groupedHeaderCellRenderer = this.grid.cellRenderers.get(CLASS_NAME), delimiter = groupedHeaderCellRenderer.delimiter; return ( isReorderable && !this.columns.find(function(column) { // but only if no grouped columns return column.getCellProperty(0, 'renderer') === CLASS_NAME && // header cell using GroupedHeader column.header.indexOf(delimiter) !== -1; // header is part of a group }) ); }
javascript
{ "resource": "" }