_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q53300
ProcessBase
train
function ProcessBase(model) { if (!model) throw new Error('Must provide a model'); tr.model.EventContainer.call(this); this.model = model; this.threads = {}; this.counters = {}; this.objects = new tr.model.ObjectCollection(this); this.sortIndex = 0; }
javascript
{ "resource": "" }
q53301
train
function() { var threadsToKeep = {}; for (var tid in this.threads) { var thread = this.threads[tid]; if (!thread.isEmpty) threadsToKeep[tid] = thread; } this.threads = threadsToKeep; }
javascript
{ "resource": "" }
q53302
Thread
train
function Thread(parent, tid) { if (!parent) throw new Error('Parent must be provided.'); tr.model.EventContainer.call(this); this.parent = parent; this.sortIndex = 0; this.tid = tid; this.name = undefined; this.samples_ = undefined; // Set during createSubSlices var that = this; ...
javascript
{ "resource": "" }
q53303
train
function(amount) { this.sliceGroup.shiftTimestampsForward(amount); if (this.timeSlices) { for (var i = 0; i < this.timeSlices.length; i++) { var slice = this.timeSlices[i]; slice.start += amount; } } this.kernelSliceGroup.shiftTimestampsForward(amount); ...
javascript
{ "resource": "" }
q53304
train
function() { this.bounds.reset(); this.sliceGroup.updateBounds(); this.bounds.addRange(this.sliceGroup.bounds); this.kernelSliceGroup.updateBounds(); this.bounds.addRange(this.kernelSliceGroup.bounds); this.asyncSliceGroup.updateBounds(); this.bounds.addRange(this.asyncSlice...
javascript
{ "resource": "" }
q53305
CodeMap
train
function CodeMap() { /** * Dynamic code entries. Used for JIT compiled code. */ this.dynamics_ = new tr.e.importer.v8.SplayTree(); /** * Name generator for entries having duplicate names. */ this.dynamicsNameGen_ = new tr.e.importer.v8.CodeMap.NameGenerator(); /** * Static...
javascript
{ "resource": "" }
q53306
CounterSample
train
function CounterSample(series, timestamp, value) { tr.model.Event.call(this); this.series_ = series; this.timestamp_ = timestamp; this.value_ = value; }
javascript
{ "resource": "" }
q53307
findIndexInSortedIntervals
train
function findIndexInSortedIntervals(ary, mapLoFn, mapWidthFn, loVal) { var first = findLowIndexInSortedArray(ary, mapLoFn, loVal); if (first == 0) { if (loVal >= mapLoFn(ary[0]) && loVal < mapLoFn(ary[0]) + mapWidthFn(ary[0], 0)) { return 0; } else { return -1; } ...
javascript
{ "resource": "" }
q53308
findIndexInSortedClosedIntervals
train
function findIndexInSortedClosedIntervals(ary, mapLoFn, mapHiFn, val) { var i = findLowIndexInSortedArray(ary, mapLoFn, val); if (i === 0) { if (val >= mapLoFn(ary[0], 0) && val <= mapHiFn(ary[0], 0)) { return 0; } else { return -1; } } else if (i < ary.length) { ...
javascript
{ "resource": "" }
q53309
iterateOverIntersectingIntervals
train
function iterateOverIntersectingIntervals(ary, mapLoFn, mapWidthFn, loVal, hiVal, cb) { if (ary.length == 0) return; if (loVal > hiVal) return; var i = findLowIndexInSortedArray(ary, mapLoFn, loVal); if (i == -1) { return; } if (i > 0) { ...
javascript
{ "resource": "" }
q53310
getIntersectingIntervals
train
function getIntersectingIntervals(ary, mapLoFn, mapWidthFn, loVal, hiVal) { var tmp = []; iterateOverIntersectingIntervals(ary, mapLoFn, mapWidthFn, loVal, hiVal, function(d) { tmp.push(d); }); r...
javascript
{ "resource": "" }
q53311
findClosestElementInSortedArray
train
function findClosestElementInSortedArray(ary, mapFn, val, maxDiff) { if (ary.length === 0) return null; var aftIdx = findLowIndexInSortedArray(ary, mapFn, val); var befIdx = aftIdx > 0 ? aftIdx - 1 : 0; if (aftIdx === ary.length) aftIdx -= 1; var befDiff = Math.abs(val - mapFn(ary[bef...
javascript
{ "resource": "" }
q53312
findClosestIntervalInSortedIntervals
train
function findClosestIntervalInSortedIntervals(ary, mapLoFn, mapHiFn, val, maxDiff) { if (ary.length === 0) return null; var idx = findLowIndexInSortedArray(ary, mapLoFn, val); if (idx > 0) idx -= 1; var hiInt = ary[idx]; var loInt = hiInt...
javascript
{ "resource": "" }
q53313
train
function(rirs) { var vacuumIRs = []; rirs.forEach(function(ir) { if (ir instanceof tr.e.rail.LoadInteractionRecord || ir instanceof tr.e.rail.IdleInteractionRecord) vacuumIRs.push(ir); }); if (vacuumIRs.length === 0) return; var allAssociatedEvents = ...
javascript
{ "resource": "" }
q53314
train
function(otherIRs) { if (this.model.bounds.isEmpty) return; var emptyRanges = tr.b.findEmptyRangesBetweenRanges( tr.b.convertEventsToRanges(otherIRs), this.model.bounds); var irs = []; var model = this.model; emptyRanges.forEach(function(range) { // Igno...
javascript
{ "resource": "" }
q53315
train
function() { function isStartupSlice(slice) { return slice.title === 'BrowserMainLoop::CreateThreads'; } var events = this.modelHelper.browserHelper.getAllAsyncSlicesMatching( isStartupSlice); var deduper = new tr.model.EventSet(); events.forEach(function(event) { ...
javascript
{ "resource": "" }
q53316
train
function(lir) { var createChildEvent = undefined; lir.renderMainThread.iterateAllEvents(function(event) { if (event.title !== CREATE_CHILD_TITLE) return; if (event.args.child !== lir.routingId) return; createChildEvent = event; }); if (!createChildE...
javascript
{ "resource": "" }
q53317
train
function() { var startupEvents = this.getStartupEvents(); var commitLoadEvents = this.modelHelper.browserHelper.getCommitProvisionalLoadEventsInRange( this.model.bounds); var frameEvents = this.getAllFrameEvents(); var startLoadEvents = this.getStartLoadEvents(); va...
javascript
{ "resource": "" }
q53318
train
function() { var sortedInputEvents = this.getSortedInputEvents(); var protoIRs = this.findProtoIRs(sortedInputEvents); protoIRs = this.postProcessProtoIRs(protoIRs); this.checkAllInputEventsHandled(sortedInputEvents, protoIRs); var irs = []; var model = this.model; protoIRs.fo...
javascript
{ "resource": "" }
q53319
train
function(sortedInputEvents) { var protoIRs = []; forEventTypesIn(sortedInputEvents, KEYBOARD_TYPE_NAMES, function(event) { var pir = new ProtoIR(ProtoIR.RESPONSE_TYPE, KEYBOARD_IR_NAME); pir.pushEvent(event); protoIRs.push(pir); }); return protoIRs; }
javascript
{ "resource": "" }
q53320
train
function(sortedInputEvents) { var protoIRs = []; forEventTypesIn( sortedInputEvents, MOUSE_RESPONSE_TYPE_NAMES, function(event) { var pir = new ProtoIR(ProtoIR.RESPONSE_TYPE, MOUSE_IR_NAME); pir.pushEvent(event); protoIRs.push(pir); }); return protoIRs; }
javascript
{ "resource": "" }
q53321
train
function(sortedInputEvents) { var protoIRs = []; var currentPIR = undefined; var prevEvent_ = undefined; forEventTypesIn( sortedInputEvents, MOUSE_WHEEL_TYPE_NAMES, function(event) { // Switch prevEvent in one place so that we can early-return later. var prevEvent = pre...
javascript
{ "resource": "" }
q53322
train
function(sortedInputEvents) { var protoIRs = []; var currentPIR = undefined; var sawFirstUpdate = false; var modelBounds = this.model.bounds; forEventTypesIn(sortedInputEvents, PINCH_TYPE_NAMES, function(event) { switch (event.typeName) { case INPUT_TYPE.PINCH_BEGIN: ...
javascript
{ "resource": "" }
q53323
train
function(sortedInputEvents) { var protoIRs = []; var currentPIR = undefined; var sawFirstMove = false; forEventTypesIn(sortedInputEvents, TOUCH_TYPE_NAMES, function(event) { switch (event.typeName) { case INPUT_TYPE.TOUCH_START: if (currentPIR) { // NB...
javascript
{ "resource": "" }
q53324
train
function(sortedInputEvents) { var protoIRs = []; var currentPIR = undefined; var sawFirstUpdate = false; forEventTypesIn(sortedInputEvents, SCROLL_TYPE_NAMES, function(event) { switch (event.typeName) { case INPUT_TYPE.SCROLL_BEGIN: // Always begin a new PIR even if...
javascript
{ "resource": "" }
q53325
train
function(sortedInputEvents) { var animationEvents = this.modelHelper.browserHelper. getAllAsyncSlicesMatching(function(event) { return ((event.title === CSS_ANIMATION_TITLE) && (event.duration > 0)); }); var animationRanges = []; animationEvents.forEach...
javascript
{ "resource": "" }
q53326
train
function(sortedInputEvents, protoIRs) { var handledEvents = []; protoIRs.forEach(function(protoIR) { protoIR.associatedEvents.forEach(function(event) { if (handledEvents.indexOf(event) >= 0) { console.error('double-handled event', event.typeName, parseInt(event....
javascript
{ "resource": "" }
q53327
MemReclaimParser
train
function MemReclaimParser(importer) { Parser.call(this, importer); importer.registerEventHandler('mm_vmscan_kswapd_wake', MemReclaimParser.prototype.kswapdWake.bind(this)); importer.registerEventHandler('mm_vmscan_kswapd_sleep', MemReclaimParser.prototype.kswapdSleep.bind(this)); import...
javascript
{ "resource": "" }
q53328
train
function(eventName, cpuNumber, pid, ts, eventBase) { var event = kswapdWakeRE.exec(eventBase.details); if (!event) return false; var tgid = parseInt(eventBase.tgid); var nid = parseInt(event[1]); var order = parseInt(event[2]); var kthread = this.importer.getOrCreateKernel...
javascript
{ "resource": "" }
q53329
SyncParser
train
function SyncParser(importer) { Parser.call(this, importer); importer.registerEventHandler( 'sync_timeline', SyncParser.prototype.timelineEvent.bind(this)); importer.registerEventHandler( 'sync_wait', SyncParser.prototype.syncWaitEvent.bind(this)); importer.registerEvent...
javascript
{ "resource": "" }
q53330
train
function(eventName, cpuNumber, pid, ts, eventBase) { var event = syncTimelineRE.exec(eventBase.details); if (!event) return false; var thread = this.importer.getOrCreatePseudoThread(event[1]); if (thread.lastActiveTs !== undefined) { var duration = t...
javascript
{ "resource": "" }
q53331
I915Parser
train
function I915Parser(importer) { Parser.call(this, importer); importer.registerEventHandler('i915_gem_object_create', I915Parser.prototype.gemObjectCreateEvent.bind(this)); importer.registerEventHandler('i915_gem_object_bind', I915Parser.prototype.gemObjectBindEvent.bind(this)); importer...
javascript
{ "resource": "" }
q53332
train
function(eventName, cpuNumber, pid, ts, eventBase) { var event = /obj=(\w+), size=(\d+)/.exec(eventBase.details); if (!event) return false; var obj = event[1]; var size = parseInt(event[2]); this.i915GemObjectSlice(ts, eventName, obj, { obj: obj, ...
javascript
{ "resource": "" }
q53333
ExynosParser
train
function ExynosParser(importer) { Parser.call(this, importer); importer.registerEventHandler('exynos_busfreq_target_int', ExynosParser.prototype.busfreqTargetIntEvent.bind(this)); importer.registerEventHandler('exynos_busfreq_target_mif', ExynosParser.prototype.busfreqTargetMifEvent.bind(th...
javascript
{ "resource": "" }
q53334
train
function(eventName, cpuNumber, pid, ts, eventBase) { var event = /frequency=(\d+)/.exec(eventBase.details); if (!event) return false; this.exynosBusfreqSample('INT Frequency', ts, parseInt(event[1])); return true; }
javascript
{ "resource": "" }
q53335
train
function(eventName, cpuNumber, pid, ts, eventBase) { var event = /pipe=(\d+), fb=(\d+), state=(.*)/.exec(eventBase.details); if (!event) return false; var pipe = parseInt(event[1]); var fb = parseInt(event[2]); var state = event[3]; this.exynosPageFlipStateCloseSlice(ts, pi...
javascript
{ "resource": "" }
q53336
IrqParser
train
function IrqParser(importer) { Parser.call(this, importer); importer.registerEventHandler('irq_handler_entry', IrqParser.prototype.irqHandlerEntryEvent.bind(this)); importer.registerEventHandler('irq_handler_exit', IrqParser.prototype.irqHandlerExitEvent.bind(this)); importer.registerEv...
javascript
{ "resource": "" }
q53337
train
function(eventName, cpuNumber, pid, ts, eventBase) { var event = irqHandlerEntryRE.exec(eventBase.details); if (!event) return false; var irq = parseInt(event[1]); var name = event[2]; var thread = this.importer.getOrCreatePseudoThread( 'irqs cpu ' + cpuNumber); t...
javascript
{ "resource": "" }
q53338
train
function(eventName, cpuNumber, pid, ts, eventBase) { var thread = this.importer.getOrCreatePseudoThread( 'irqs cpu ' + cpuNumber); thread.lastEntryTs = ts; return true; }
javascript
{ "resource": "" }
q53339
initialize
train
function initialize() { if (global.isVinn) { tr.isVinn = true; } else if (global.process && global.process.versions.node) { tr.isNode = true; } else { tr.isVinn = false; tr.isNode = false; tr.doc = document; tr.isMac = /Mac/.test(navigator.platform); tr.isWindows =...
javascript
{ "resource": "" }
q53340
train
function(type, handler) { if (!this.listeners_) this.listeners_ = Object.create(null); if (!(type in this.listeners_)) { this.listeners_[type] = [handler]; } else { var handlers = this.listeners_[type]; if (handlers.indexOf(handler) < 0) handlers.push(handler)...
javascript
{ "resource": "" }
q53341
train
function(type, handler) { if (!this.listeners_) return; if (type in this.listeners_) { var handlers = this.listeners_[type]; var index = handlers.indexOf(handler); if (index >= 0) { // Clean up if this was the last listener. if (handlers.length == 1) ...
javascript
{ "resource": "" }
q53342
train
function(event) { if (!this.listeners_) return true; // Since we are using DOM Event objects we need to override some of the // properties and methods so that we can emulate this correctly. var self = this; event.__defineGetter__('target', function() { return self; }...
javascript
{ "resource": "" }
q53343
__verify_client_registration_entries
train
function __verify_client_registration_entries(authorize_request) { return new Promise(async (resolve, reject) => { let error_object = { error: "unauthorized_client", error_description: "" }; try { if (!authorize_request.client_id || !authorize_request.re...
javascript
{ "resource": "" }
q53344
__validate_authorization_request
train
function __validate_authorization_request(authorize_request) { return new Promise((resolve, reject) => { let error_object = { error: "invlalid_request", error_description: "" }; if (authorize_request.state) { error_object.state = authorize_request.state; ...
javascript
{ "resource": "" }
q53345
post_token
train
function post_token(oidc_token) { return new Promise((resolve, reject) => { dbMgr .updateOne("oidc_token", { id_token: { $eq: null } }, { $currentDate: { expire_on: true }, ...
javascript
{ "resource": "" }
q53346
post_authorization_request
train
function post_authorization_request(authorization_request) { return new Promise((resolve, reject) => { dbMgr .updateOne("authorization_request", { client_id: { $eq: null } }, { $set: authorization_request ...
javascript
{ "resource": "" }
q53347
get_authorization_request
train
function get_authorization_request(authorization_request_id) { return new Promise((resolve, reject) => { dbMgr .find("authorization_request", { _id: { $eq: authorization_request_id } }, {limit: 1}) .then((authorize_reque...
javascript
{ "resource": "" }
q53348
__send_token_for_authorization_code
train
async function __send_token_for_authorization_code(request_params, request, h) { function __process_authorization_code(request_params) { return authorization_endpoint .authorization_request_registrar_module .get_authorization_request(request_params.code); } try { co...
javascript
{ "resource": "" }
q53349
__process_authorization_header_for_client
train
function __process_authorization_header_for_client(request_params) { return new Promise(async (resolve, reject) => { try { const client_account_id = await client_endpoint .client_registrar_module .get_client_account_id_for_credentials(request_params.authorization_...
javascript
{ "resource": "" }
q53350
__process_authorization_header_for_user
train
function __process_authorization_header_for_user(request_params) { return new Promise(async (resolve, reject) => { try { const user_account_id = await user_info_endpoint .user_account_registrar_module .get_user_account_id_for_credentials(request_params.authorizati...
javascript
{ "resource": "" }
q53351
formatRequestErrors
train
function formatRequestErrors(request, errors) { const CONTEXT_BEFORE = 20; const CONTEXT_LENGTH = 60; const queryLines = request.getQueryString().split('\n'); return errors.map(({locations = [], message}, ii) => { const prefix = (ii + 1) + '. '; const indent = ' '.repeat(prefix.length); return ( ...
javascript
{ "resource": "" }
q53352
jsonEncoded
train
function jsonEncoded(gw, callback){ var buffer = ''; var readlength = 0; var $error = false; gw.req.on('data', function (chunk) { if (readlength > gw.content.length){$error = true;} if (!$error) { readlength += chunk.length; buffer += chunk.toString('ascii'); } }); gw.req.on('end', f...
javascript
{ "resource": "" }
q53353
urlEncoded
train
function urlEncoded(gw, callback){ var buffer = ''; var readlength = 0; var $error = false; gw.req.on('data', function (chunk) { if (readlength > gw.content.length) {$error = true;} if (!$error) { readlength += chunk.length; buffer += chunk.toString('ascii'); } }); gw.req.on('end', f...
javascript
{ "resource": "" }
q53354
multipartEncoded
train
function multipartEncoded(gw, callback){ var upload = new formidable.IncomingForm(); var files = {}; var fields = {}; gw.eventium.on('end',cleanTemp); upload.uploadDir = tempDirectory; upload.keepExtensions = true; upload.onPart = function(part) { if (part.filename!="") { upload.handlePart...
javascript
{ "resource": "" }
q53355
dimension
train
function dimension(cells) { var d = 0 , max = Math.max for(var i=0, il=cells.length; i<il; ++i) { d = max(d, cells[i].length) } return d-1 }
javascript
{ "resource": "" }
q53356
countVertices
train
function countVertices(cells) { var vc = -1 , max = Math.max for(var i=0, il=cells.length; i<il; ++i) { var c = cells[i] for(var j=0, jl=c.length; j<jl; ++j) { vc = max(vc, c[j]) } } return vc+1 }
javascript
{ "resource": "" }
q53357
cloneCells
train
function cloneCells(cells) { var ncells = new Array(cells.length) for(var i=0, il=cells.length; i<il; ++i) { ncells[i] = cells[i].slice(0) } return ncells }
javascript
{ "resource": "" }
q53358
compareCells
train
function compareCells(a, b) { var n = a.length , t = a.length - b.length , min = Math.min if(t) { return t } switch(n) { case 0: return 0; case 1: return a[0] - b[0]; case 2: var d = a[0]+a[1]-b[0]-b[1] if(d) { return d } return min(a[0],a[1]) ...
javascript
{ "resource": "" }
q53359
normalize
train
function normalize(cells, attr) { if(attr) { var len = cells.length var zipped = new Array(len) for(var i=0; i<len; ++i) { zipped[i] = [cells[i], attr[i]] } zipped.sort(compareZipped) for(var i=0; i<len; ++i) { cells[i] = zipped[i][0] attr[i] = zipped[i][1] } return c...
javascript
{ "resource": "" }
q53360
unique
train
function unique(cells) { if(cells.length === 0) { return [] } var ptr = 1 , len = cells.length for(var i=1; i<len; ++i) { var a = cells[i] if(compareCells(a, cells[i-1])) { if(i === ptr) { ptr++ continue } cells[ptr++] = a } } cells.length = ptr return...
javascript
{ "resource": "" }
q53361
findCell
train
function findCell(cells, c) { var lo = 0 , hi = cells.length-1 , r = -1 while (lo <= hi) { var mid = (lo + hi) >> 1 , s = compareCells(cells[mid], c) if(s <= 0) { if(s === 0) { r = mid } lo = mid + 1 } else if(s > 0) { hi = mid - 1 } } return r }
javascript
{ "resource": "" }
q53362
incidence
train
function incidence(from_cells, to_cells) { var index = new Array(from_cells.length) for(var i=0, il=index.length; i<il; ++i) { index[i] = [] } var b = [] for(var i=0, n=to_cells.length; i<n; ++i) { var c = to_cells[i] var cl = c.length for(var k=1, kn=(1<<cl); k<kn; ++k) { b.length = bit...
javascript
{ "resource": "" }
q53363
dual
train
function dual(cells, vertex_count) { if(!vertex_count) { return incidence(unique(skeleton(cells, 0)), cells, 0) } var res = new Array(vertex_count) for(var i=0; i<vertex_count; ++i) { res[i] = [] } for(var i=0, len=cells.length; i<len; ++i) { var c = cells[i] for(var j=0, cl=c.length; j<cl; ...
javascript
{ "resource": "" }
q53364
explode
train
function explode(cells) { var result = [] for(var i=0, il=cells.length; i<il; ++i) { var c = cells[i] , cl = c.length|0 for(var j=1, jl=(1<<cl); j<jl; ++j) { var b = [] for(var k=0; k<cl; ++k) { if((j >>> k) & 1) { b.push(c[k]) } } result.push(b) }...
javascript
{ "resource": "" }
q53365
skeleton
train
function skeleton(cells, n) { if(n < 0) { return [] } var result = [] , k0 = (1<<(n+1))-1 for(var i=0; i<cells.length; ++i) { var c = cells[i] for(var k=k0; k<(1<<c.length); k=bits.nextCombination(k)) { var b = new Array(n+1) , l = 0 for(var j=0; j<c.length; ++j) { ...
javascript
{ "resource": "" }
q53366
boundary
train
function boundary(cells) { var res = [] for(var i=0,il=cells.length; i<il; ++i) { var c = cells[i] for(var j=0,cl=c.length; j<cl; ++j) { var b = new Array(c.length-1) for(var k=0, l=0; k<cl; ++k) { if(k !== j) { b[l++] = c[k] } } res.push(b) } } retu...
javascript
{ "resource": "" }
q53367
connectedComponents_dense
train
function connectedComponents_dense(cells, vertex_count) { var labels = new UnionFind(vertex_count) for(var i=0; i<cells.length; ++i) { var c = cells[i] for(var j=0; j<c.length; ++j) { for(var k=j+1; k<c.length; ++k) { labels.link(c[j], c[k]) } } } var components = [] , compon...
javascript
{ "resource": "" }
q53368
connectedComponents_sparse
train
function connectedComponents_sparse(cells) { var vertices = unique(normalize(skeleton(cells, 0))) , labels = new UnionFind(vertices.length) for(var i=0; i<cells.length; ++i) { var c = cells[i] for(var j=0; j<c.length; ++j) { var vj = findCell(vertices, [c[j]]) for(var k=j+1; k<c.length; ...
javascript
{ "resource": "" }
q53369
Task
train
function Task(entry) { if (!(this instanceof Task)) { return new Task(entry); } this.called = 0; this.now = this.calledAt = hrTime(); if (resolutionDivisor !== DEFAULT_RESOLUTION) { entry.time = ~~(entry.time * (DEFAULT_RESOLUTION / resolutionDivisor)); } // Side table property definitions th...
javascript
{ "resource": "" }
q53370
cloneObj
train
function cloneObj(a,b) { Object.keys(b).forEach(function(k) { a[k] = b[k]; }); return a; }
javascript
{ "resource": "" }
q53371
train
function (element) { var codeStyles = getStyles(element); var whiteSpace = codeStyles['white-space']; if (whiteSpace === 'pre-wrap' || whiteSpace === 'pre-line') { var codeElement = element.querySelector('code'); var lineNumbersWrapper = element.querySelector('.line-numbers-rows'); var lineNumberSizer =...
javascript
{ "resource": "" }
q53372
listenForWorkerResults
train
function listenForWorkerResults() { chessWorker.addEventListener('message', (event) => { const gameId = event.data.reqid.gameRootMessage; const { ply } = event.data.reqid; if (event.data.topic === 'dests') { const destsMapKey = getDestsKey(gameId, ply); const awaitingDestsObs = ge...
javascript
{ "resource": "" }
q53373
wrap
train
function wrap(set) { return function (fn, time /* , ...args */) { var boundArgs = arguments.length > 2; var args = boundArgs ? slice.call(arguments, 2) : false; return set(boundArgs ? function () { // eslint-disable-next-line no-new-func (typeof fn == 'function' ? fn : Function(fn)...
javascript
{ "resource": "" }
q53374
train
function(key_or_new_store, value) { if (arguments.length === 1) { // replace the whole store let new_store = key_or_new_store for (let k in new_store) { store.set(k, new_store[k]) } return } let key = key_or_new_store if (!store._store.hasOwnProperty(key)) { ...
javascript
{ "resource": "" }
q53375
train
function(key, oldval, value) { if (store._changed_keys.indexOf(key) === -1) { store._changed_keys.push(key) } // suppress active timeout (if any) if (store._debounce_timeout) { store._clearDebounceTimeout() } if (store.options.debounce_ms) { // delay event emission and set ne...
javascript
{ "resource": "" }
q53376
train
function(key) { if (!store._store_created) { throw 'cannot get store because is has not been created' } if (arguments.length === 0) { // return the whole store if (store.options.immutable) { return Object.assign({}, store._store) // copy entire store by value } else { ...
javascript
{ "resource": "" }
q53377
train
function() { const changed_keys = store._changed_keys if (changed_keys.length === 0) { console.error('no keys were changed, yet we are trying to publish a store change') return } // make sure _changed_keys is reset before executing callbacks // (if callbacks modify state, the list of ke...
javascript
{ "resource": "" }
q53378
chessAppIsVisible
train
function chessAppIsVisible() { const topLevelElementArr = document.getElementsByClassName('ssb-chess-container'); if (!topLevelElementArr || topLevelElementArr.length <= 0) { return false; } const element = topLevelElementArr[0]; return document.hasFocus() && isVisible(element); }
javascript
{ "resource": "" }
q53379
_callback
train
function _callback(changed_keys) { if (intersection(keys_to_watch_for_changes, changed_keys).length) { // only update the state if a key we care about has changed var state_update_obj = {}; keys_to_watch_for_changes.forEach(function (k) { return state_update_obj[k] = store._store...
javascript
{ "resource": "" }
q53380
getUnwatchedKeys
train
function getUnwatchedKeys() { var arr1 = Object.keys(store._store), arr2 = Object.keys(store._key_to_watcher_subscriptions); return arr1.filter(function (i) { return arr2.indexOf(i) === -1; }); }
javascript
{ "resource": "" }
q53381
collectResources
train
function collectResources(a, obj, tagName) { Array.prototype .forEach .call(a.ownerDocument.getElementsByTagName(tagName), function(r) { // Get canonical URL a.href = r.currentSrc || r.src || r.getAttribute("xlink:href") || r.href; // only...
javascript
{ "resource": "" }
q53382
cssFilesToStyleTag
train
function cssFilesToStyleTag(dom) { const rootDir = `${__dirname}/`; const styles = m('div', {}, cssFiles.map(file => m('link', { rel: 'stylesheet', href: rootDir + file }))); m.render(dom, styles); }
javascript
{ "resource": "" }
q53383
train
function ( type, time ) { if ( type == 'easeInQuad' ) return time * time; // accelerating from zero velocity if ( type == 'easeOutQuad' ) return time * (2 - time); // decelerating to zero velocity if ( type == 'easeInOutQuad' ) return time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration unti...
javascript
{ "resource": "" }
q53384
train
function ( anchor, headerHeight, offset ) { var location = 0; if (anchor.offsetParent) { do { location += anchor.offsetTop; anchor = anchor.offsetParent; } while (anchor); } location = location - headerHeight - offset; if ( location >= 0 ) { return location; } else { return 0; } }
javascript
{ "resource": "" }
q53385
train
function () { return Math.max( document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight ); }
javascript
{ "resource": "" }
q53386
train
function ( anchor, url ) { if ( (url === true || url === 'true') && history.pushState ) { history.pushState( {pos:anchor.id}, '', anchor ); } }
javascript
{ "resource": "" }
q53387
train
function () { timeLapsed += 16; percentage = ( timeLapsed / speed ); percentage = ( percentage > 1 ) ? 1 : percentage; position = startLocation + ( distance * _easingPattern(easing, percentage) ); window.scrollTo( 0, Math.floor(position) ); _stopAnimateScroll(position, endLocation, animationInterval);...
javascript
{ "resource": "" }
q53388
train
function ( options ) { // Feature test before initializing if ( 'querySelector' in document && 'addEventListener' in window && Array.prototype.forEach ) { // Selectors and variables options = _mergeObjects( _defaults, options || {} ); // Merge user options with defaults var toggles = document.querySelect...
javascript
{ "resource": "" }
q53389
report
train
function report(node) { const name = node.key context.report({ node, loc: node.loc, messageId: "duplicate", data: { name }, }) }
javascript
{ "resource": "" }
q53390
groupByName
train
function groupByName(attrs) { const attributes = new Map() for (const node of attrs) { const name = node.key const list = attributes.get(name) || (() => { const a = [] attribut...
javascript
{ "resource": "" }
q53391
equalNode
train
function equalNode(n1, n2) { return ( n1.type === n2.type && n1.range[0] === n2.range[0] && n1.range[1] === n2.range[1] ) }
javascript
{ "resource": "" }
q53392
validateNameGroup
train
function validateNameGroup(nodes, _name) { if (nodes.length <= 1) { return } for (const target of nodes) { const node = microTemplateService.getBranchProcessedHtmlNode( target, sourceC...
javascript
{ "resource": "" }
q53393
validateAttrs
train
function validateAttrs(attrs) { const attributes = groupByName(attrs) attributes.forEach((nodes, name) => { validateNameGroup(nodes, name) }) }
javascript
{ "resource": "" }
q53394
readConfigs
train
function readConfigs() { const configsRoot = path.resolve(__dirname, "../../lib/configs") const result = fs.readdirSync(configsRoot) const configs = [] for (const name of result) { const configName = name.replace(/\.js$/u, "") const configId = `plugin:lodash-template/${configName}` ...
javascript
{ "resource": "" }
q53395
getActualLineIndentText
train
function getActualLineIndentText(line) { let actualText = actualLineIndentTexts.get(line) if (actualText === undefined) { const lineText = getLineText(line) const index = lineText.search(/\S/u) if (index >= 0) { actualText = lin...
javascript
{ "resource": "" }
q53396
getTopLevelIndentByTemplateTag
train
function getTopLevelIndentByTemplateTag(templateTag) { const baseIndentText = getActualLineIndentText( templateTag.loc.start.line ) return new ExpectedIndent( baseIndentText, options.indentSize * options.startIndent ) ...
javascript
{ "resource": "" }
q53397
setOffsetToNodeList
train
function setOffsetToNodeList(nodeList, leftToken, offset, baseToken) { for (const t of genCollectNodeList(nodeList, leftToken, null)) { setOffsetToToken(t, offset, baseToken) } }
javascript
{ "resource": "" }
q53398
inTemplateTag
train
function inTemplateTag(line) { if (line <= 1) { return false } const lineStartIndex = sourceCode.getIndexFromLoc({ line, column: 0, }) return microTemplateService.inTemplateTag(lin...
javascript
{ "resource": "" }
q53399
validateBaseIndent
train
function validateBaseIndent(line, actualText, expectedIndent) { const expectedBaseIndentText = expectedIndent.baseIndentText if ( expectedBaseIndentText && (actualText.length < expectedBaseIndentText.length || !actualText.st...
javascript
{ "resource": "" }