_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q6500
train
function (callback) { var self = this; self.registration_callbacks.push(callback); _.each(self.all_sockets(), function (socket) { callback(socket); }); }
javascript
{ "resource": "" }
q6501
train
function(request /*, moreArguments */) { // Store arguments for use within the closure below var args = arguments; // Rewrite /websocket and /websocket/ urls to /sockjs/websocket while // preserving query string. var parsedUrl = url.parse(request.url); if (parsedUrl.path...
javascript
{ "resource": "" }
q6502
add
train
function add(object) { var args = Array.prototype.slice.call(arguments, 1); //loop through all over the arguments forEach(args, function(value, i) { switch(typeof object) { case 'object': isArray(object) ? object.push(value) : extend(object, isObject(value) ? value : creObjec...
javascript
{ "resource": "" }
q6503
runInContext
train
function runInContext(context) { // Node.js return (typeof module === "object" && module && module.exports === context) ? module.exports = agile // Browsers : context[(context._) ? 'agile' : '_'] = agile; }
javascript
{ "resource": "" }
q6504
processIfValues
train
function processIfValues(css, result, rule, decl, queries) { var query = null; var re = /(.*)\s+(?:\?if|\?)\s+media\s+(.*)/; var re2 = /\s/g; var hash = null; // Check if we're working with comments. var match = decl.value ? decl.value.match(re) : decl.text.match(re); // console.log(match) if(match && ...
javascript
{ "resource": "" }
q6505
createAtRules
train
function createAtRules(css, rule, queries) { var parent = rule.parent; var prev = rule; for(var k in queries) { var q = queries[k]; var at = postcss.atRule({name: 'media', params: q.arg, source: rule.source}); var qr = postcss.rule ({selector: q.sel, source: rule.source}); at.append(qr); fo...
javascript
{ "resource": "" }
q6506
getContent
train
function getContent() { var h = pageInformation.response.headers || {}; if (/json/.test(h['content-type'])) { try { return JSON.parse(page.plainText); } catch (e) { return page.content; } } else { return page.content; } }
javascript
{ "resource": "" }
q6507
wrapFailure
train
function wrapFailure(reason) { var res = { fail: true, url: page.url, body: getContent(), headers: pageInformation.response.headers, status: pageInformation.response.status }; if (reason) res.reason = reason; if (pageInformation.error) re...
javascript
{ "resource": "" }
q6508
wrapSuccess
train
function wrapSuccess(result) { return { url: page.url, body: getContent(), headers: pageInformation.response.headers, status: pageInformation.response.status, error: result.error ? helpers.serializeError(result.error) : null, data: result.data }; }
javascript
{ "resource": "" }
q6509
train
function(status) { // Page is now opened pageInformation.isOpened = true; pageInformation.status = status; // Failing if (status !== 'success') { parent.replyTo(callId, wrapFailure('fail')); return cleanup(); } // Wrong status code if (!pageInformation....
javascript
{ "resource": "" }
q6510
processBlockContent
train
function processBlockContent (block, contentState, options) { const entityModifiers = options.entityModifiers || {} let text = block.getText() // Cribbed from sstur’s implementation in draft-js-export-html // https://github.com/sstur/draft-js-export-html/blob/master/src/stateToHTML.js#L222 let charMetaList =...
javascript
{ "resource": "" }
q6511
processBlocks
train
function processBlocks (blocks, contentState, options = {}) { // Track block context let context = context || [] let currentContext = context let lastBlock = null let lastProcessed = null let parents = [] // Procedurally process individual blocks blocks.forEach(processBlock) /** * Process an indi...
javascript
{ "resource": "" }
q6512
getBaseConfig
train
function getBaseConfig(isProd) { // get library details from JSON config var libraryDesc = require('./package.json').library; var libraryEntryPoint = path.join('src', libraryDesc.entry); // generate webpack base config return { entry: path.join(__dirname, libraryEntryPoint), output: { // ommit...
javascript
{ "resource": "" }
q6513
train
function (config) { if (!config) { config = {}; } this.subject = config.subject; this.value = config.value; this.operator = (config.operator) ? config.operator : Operators.EQUALS; return this; }
javascript
{ "resource": "" }
q6514
train
function () { var self = this; if (!self._waitingForQuiescence()) self._flushBufferedWrites(); _.each(self._stores, function (s) { s.saveOriginals(); }); }
javascript
{ "resource": "" }
q6515
train
function() { var self = this; if (_.isEmpty(self._outstandingMethodBlocks)) return; _.each(self._outstandingMethodBlocks[0].methods, function (m) { m.sendMessage(); }); }
javascript
{ "resource": "" }
q6516
APIError
train
function APIError(message, type, field) { Error.call(this); Error.captureStackTrace(this, arguments.callee); this.name = 'APIError'; this.message = message; this.type = type; this.field = field; }
javascript
{ "resource": "" }
q6517
linkPackages
train
function linkPackages(dstPacksDir) { if (!dstPacksDir) { dstPacksDir = Path.resolve(rootDir, "packages"); } else { dstPacksDir = Path.resolve(cwd, dstPacksDir); } // Ensure destination dir try { Fs.mkdirSync(dstPacksDir); } catch (_) {} var packNames = Fs.readdirSync(srcPacksDir); // ...
javascript
{ "resource": "" }
q6518
Stream
train
function Stream(options) { /** * Whether or not the Stream was initialized as * a single- or multi-key stream. * * @property multi * @type Boolean */ reader(this, 'multi', !(options && options.apiKey)); if (!this.multi) { options.headers = options.headers || {}; options.headers['Zotero...
javascript
{ "resource": "" }
q6519
getRange
train
function getRange(sel) { sel = sel || getSelection(); return sel.rangeCount > 0 ? sel.getRangeAt(0) : null; }
javascript
{ "resource": "" }
q6520
setRange
train
function setRange(saved, sel) { if (!saved) { return; } // will make new selection, if unset sel = sel || getSelection(); sel.removeAllRanges(); sel.addRange(saved); }
javascript
{ "resource": "" }
q6521
getRect
train
function getRect(sel) { sel = sel || getSelection(); if (!sel.rangeCount) { return false; } var range = sel.getRangeAt(0).cloneRange(); // on Webkit 'range.getBoundingClientRect()' sometimes return 0/0/0/0 - but 'range.getClientRects()' works var rects = range.getClientRects ? range.getClientRects() : []; for (...
javascript
{ "resource": "" }
q6522
getNodes
train
function getNodes(sel) { var range = getRange(sel); if (!range) { return []; } var node = range.startContainer; var endNode = range.endContainer; // Special case for a range that is contained within a single node if (node === endNode) { return [node]; } // Iterate nodes until we hit the end container var nod...
javascript
{ "resource": "" }
q6523
getHTML
train
function getHTML(sel) { sel = sel || getSelection(); if (!sel.rangeCount || sel.isCollapsed) { return null; } var len = sel.rangeCount; var container = doc.createElement('div'); for (var i = 0; i < len; ++i) { container.appendChild(sel.getRangeAt(i).cloneContents()); } return container.innerHTML; }
javascript
{ "resource": "" }
q6524
isWithin
train
function isWithin(container, sel) { sel = sel || getSelection(); return container.contains(sel.anchorNode) && container.contains(sel.focusNode); }
javascript
{ "resource": "" }
q6525
getCaretWord
train
function getCaretWord(sel) { sel = sel || getSelection(); var rng = getRange(sel); expandToWord(sel); var str = sel.toString(); // range? // Restore selection setRange(rng); return str; }
javascript
{ "resource": "" }
q6526
isBackwards
train
function isBackwards(sel) { sel = sel || getSelection(); if (isCollapsed(sel)) { return; } // Detect if selection is backwards var range = doc.createRange(); range.setStart(sel.anchorNode, sel.anchorOffset); range.setEnd(sel.focusNode, sel.focusOffset); range.detach(); // if `collapsed` then it's backwards r...
javascript
{ "resource": "" }
q6527
snapSelected
train
function snapSelected(sel) { sel = sel || getSelection(); if (isCollapsed(sel)) { return; } var end = sel.focusNode; var off = sel.focusOffset; var dir = ['forward', 'backward']; isBackwards(sel) && dir.reverse(); // modify() works on the focus of the selection sel.collapse(sel.anchorNode, sel.anchorOffset); ...
javascript
{ "resource": "" }
q6528
train
function () { var self = this; if (self === DDPServer._CurrentWriteFence.get()) throw Error("Can't arm the current fence"); self.armed = true; self._maybeFire(); }
javascript
{ "resource": "" }
q6529
train
function () { var self = this; var future = new Future; self.onAllCommitted(function () { future['return'](); }); self.arm(); future.wait(); }
javascript
{ "resource": "" }
q6530
createNode
train
function createNode(el, attr) { // html comment is not currently supported by virtual-dom if (el.nodeType === 3) { return createVirtualTextNode(el); // cdata or doctype is not currently supported by virtual-dom } else if (el.nodeType === 1 || el.nodeType === 9) { return createVirtualDomNode(el, attr); } // ...
javascript
{ "resource": "" }
q6531
createVirtualDomNode
train
function createVirtualDomNode(el, attr) { var ns = el.namespaceURI !== HTML_NAMESPACE ? el.namespaceURI : null; var key = attr && el.getAttribute(attr) ? el.getAttribute(attr) : null; return new VNode( el.tagName , createProperties(el) , createChildren(el, attr) , key , ns ); }
javascript
{ "resource": "" }
q6532
createChildren
train
function createChildren(el, attr) { var children = []; for (var i = 0; i < el.childNodes.length; i++) { children.push(createNode(el.childNodes[i], attr)); }; return children; }
javascript
{ "resource": "" }
q6533
createProperties
train
function createProperties(el) { var properties = {}; if (!el.hasAttributes()) { return properties; } var ns; if (el.namespaceURI && el.namespaceURI !== HTML_NAMESPACE) { ns = el.namespaceURI; } var attr; for (var i = 0; i < el.attributes.length; i++) { // use built in css style parsing if(el.attribut...
javascript
{ "resource": "" }
q6534
createProperty
train
function createProperty(attr) { var name, value, isAttr; // using a map to find the correct case of property name if (propertyMap[attr.name]) { name = propertyMap[attr.name]; } else { name = attr.name; } // special cases for data attribute, we default to properties.attributes.data if (name.indexOf('data-') ...
javascript
{ "resource": "" }
q6535
createPropertyNS
train
function createPropertyNS(attr) { var name, value; return { name: attr.name , value: attr.value , ns: namespaceMap[attr.name] || '' }; }
javascript
{ "resource": "" }
q6536
createStyleProperty
train
function createStyleProperty(el) { var style = el.style; var output = {}; for (var i = 0; i < style.length; ++i) { var item = style.item(i); output[item] = String(style[item]); // hack to workaround browser inconsistency with url() if (output[item].indexOf('url') > -1) { output[item] = output[item].replac...
javascript
{ "resource": "" }
q6537
tagRepo
train
function tagRepo(version) { if (SHOULD_PUBLISH) { shell.exec(`git tag ${version}`); shell.exec("git push origin --tags"); } else { console.log(`\n\nWould publish git tag as version ${version}.`); } }
javascript
{ "resource": "" }
q6538
ensureNoChangesOnMasterBeforePublish
train
function ensureNoChangesOnMasterBeforePublish() { //Let users try the build script as long as they're not doing an actual publish if (!SHOULD_PUBLISH) { return true; } shell.exec("git fetch origin", {silent: true}); const currentBranch = shell.exec("git symbolic-ref --short -q HEAD", {sile...
javascript
{ "resource": "" }
q6539
Quote
train
function Quote(options) { var self = this; events.EventEmitter.call(self); this.quote_id = options.quote_id; this.start_time = new Date(parseInt(options.start_time,10)*1000); this.end_time = new Date(parseInt(options.end_time,10)*1000); this.fee = parseFloat(options.fee); this.currency_code...
javascript
{ "resource": "" }
q6540
train
function(conversationId, userId, text, callback) { send(null, conversationId, utils.messageText('user_id', userId, text), callback); }
javascript
{ "resource": "" }
q6541
train
function(conversationId, name, text, callback) { send(null, conversationId, utils.messageText('name', name, text), callback); }
javascript
{ "resource": "" }
q6542
train
function(conversationId, params, callback) { conversationId = utils.toUUID(conversationId); if (!conversationId) return callback(new Error(utils.i18n.messages.cid)); utils.debug('Message getAll: ' + conversationId); var queryParams = ''; if (typeof params === 'function') callback = params...
javascript
{ "resource": "" }
q6543
train
function(messageId, conversationId, callback) { if (!messageId) return callback(new Error(utils.i18n.messages.mid)); messageId = utils.toUUID(messageId); if (!conversationId) return callback(new Error(utils.i18n.conversations.id)); conversationId = utils.toUUID(conversationId); utils.debug...
javascript
{ "resource": "" }
q6544
train
function(userId, messageId, callback) { if (!userId) return callback(new Error(utils.i18n.messages.userId)); messageId = utils.toUUID(messageId); if (!messageId) return callback(new Error(utils.i18n.messages.mid)); utils.debug('Message getFromUser: ' + userId + ', ' + messageId); request....
javascript
{ "resource": "" }
q6545
retryJob
train
function retryJob(job, when) { when = when || 'later'; // Reaching maxRetries? if (job.req.retries >= this.options.maxRetries) return; // Dropping from remains delete this.remains[job.id]; // Request job.req.retries++; job.state.retrying = true; // Adding to the queue again this.queue[when =...
javascript
{ "resource": "" }
q6546
beforeScraping
train
function beforeScraping(job, callback) { return async.applyEachSeries( this.middlewares.beforeScraping, job.req, callback ); }
javascript
{ "resource": "" }
q6547
afterScraping
train
function afterScraping(job, callback) { return async.applyEachSeries( this.middlewares.afterScraping, job.req, job.res, callback ); }
javascript
{ "resource": "" }
q6548
iterate
train
function iterate() { var lastJob = this.lastJob || {}, feed = this.iterator.call(this, this.index, lastJob.req, lastJob.res); if (feed) this.addUrl(feed); }
javascript
{ "resource": "" }
q6549
addUrl
train
function addUrl(when, feed) { if (!types.check(feed, 'feed') && !types.check(feed, ['feed'])) throw Error('sandcrawler.spider.url(s): wrong argument.'); var a = !(feed instanceof Array) ? [feed] : feed, c = !this.state.running ? this.initialBuffer.length : this.index, job, i, l; for ...
javascript
{ "resource": "" }
q6550
train
function ( a, order, prop, prop2 ) { var out = []; var i=0, ien=order.length; // Could have the test in the loop for slightly smaller code, but speed // is essential here if ( prop2 !== undefined ) { for ( ; i<ien ; i++ ) { out.push( a[ order[i] ][ prop ][ prop2 ] ); } } else { ...
javascript
{ "resource": "" }
q6551
train
function ( src ) { // A faster unique method is to use object keys to identify used values, // but this doesn't work with arrays or objects, which we must also // consider. See jsperf.com/compare-array-unique-versions/4 for more // information. var out = [], val, i, ien=src.length, j, k...
javascript
{ "resource": "" }
q6552
_fnHungarianMap
train
function _fnHungarianMap ( o ) { var hungarian = 'a aa ao as b fn i m o s ', match, newKey, map = {}; $.each( o, function (key, val) { match = key.match(/^([^A-Z]+?)([A-Z])/); if ( match && hungarian.indexOf(match[1]+' ') !== -1 ) { newKey = key.replace( match[0], match[2]...
javascript
{ "resource": "" }
q6553
_fnCamelToHungarian
train
function _fnCamelToHungarian ( src, user, force ) { if ( ! src._hungarianMap ) { _fnHungarianMap( src ); } var hungarianKey; $.each( user, function (key, val) { hungarianKey = src._hungarianMap[ key ]; if ( hungarianKey !== undefined && (force || user[hungarianKey] === undefined) )...
javascript
{ "resource": "" }
q6554
_fnLanguageCompat
train
function _fnLanguageCompat( oLanguage ) { var oDefaults = DataTable.defaults.oLanguage; var zeroRecords = oLanguage.sZeroRecords; /* Backwards compatibility - if there is no sEmptyTable given, then use the same as * sZeroRecords - assuming that is given. */ if ( !oLanguage.sEmptyTable && zeroRe...
javascript
{ "resource": "" }
q6555
train
function ( o, knew, old ) { if ( o[ knew ] !== undefined ) { o[ old ] = o[ knew ]; } }
javascript
{ "resource": "" }
q6556
_fnCompatOpts
train
function _fnCompatOpts ( init ) { _fnCompatMap( init, 'ordering', 'bSort' ); _fnCompatMap( init, 'orderMulti', 'bSortMulti' ); _fnCompatMap( init, 'orderClasses', 'bSortClasses' ); _fnCompatMap( init, 'orderCellsTop', 'bSortCellsTop' ); _fnCompatMap( init, 'order', 'aaSorting' ); _f...
javascript
{ "resource": "" }
q6557
_fnCompatCols
train
function _fnCompatCols ( init ) { _fnCompatMap( init, 'orderable', 'bSortable' ); _fnCompatMap( init, 'orderData', 'aDataSort' ); _fnCompatMap( init, 'orderSequence', 'asSorting' ); _fnCompatMap( init, 'orderDataType', 'sortDataType' ); }
javascript
{ "resource": "" }
q6558
_fnBrowserDetect
train
function _fnBrowserDetect( settings ) { var browser = settings.oBrowser; // Scrolling feature / quirks detection var n = $('<div/>') .css( { position: 'absolute', top: 0, left: 0, height: 1, width: 1, overflow: 'hidden' } ) .append( $('<div/>') .css( { ...
javascript
{ "resource": "" }
q6559
_fnGetColumns
train
function _fnGetColumns( oSettings, sParam ) { var a = []; $.map( oSettings.aoColumns, function(val, i) { if ( val[sParam] ) { a.push( i ); } } ); return a; }
javascript
{ "resource": "" }
q6560
_fnApplyColumnDefs
train
function _fnApplyColumnDefs( oSettings, aoColDefs, aoCols, fn ) { var i, iLen, j, jLen, k, kLen, def; // Column definitions with aTargets if ( aoColDefs ) { /* Loop over the definitions array - loop in reverse so first instance has priority */ for ( i=aoColDefs.length-1 ; i>=0 ; i-- ) { ...
javascript
{ "resource": "" }
q6561
_fnGetCellData
train
function _fnGetCellData( oSettings, iRow, iCol, sSpecific ) { var oCol = oSettings.aoColumns[iCol]; var oData = oSettings.aoData[iRow]._aData; var sData = oCol.fnGetData( oData, sSpecific ); if ( sData === undefined ) { if ( oSettings.iDrawError != oSettings.iDraw && oCol.sDefaultContent === nul...
javascript
{ "resource": "" }
q6562
_fnInvalidateRow
train
function _fnInvalidateRow( settings, rowIdx, src, column ) { var row = settings.aoData[ rowIdx ]; var i, ien; // Are we reading last data from DOM or the data object? if ( src === 'dom' || ((! src || src === 'auto') && row.src === 'dom') ) { // Read the data from the DOM row._aData = _fnGetRowE...
javascript
{ "resource": "" }
q6563
_fnGetRowElements
train
function _fnGetRowElements( settings, row ) { var d = [], tds = [], td = row.firstChild, name, col, o, i=0, contents, columns = settings.aoColumns; var attr = function ( str, data, td ) { if ( typeof str === 'string' ) { var idx = str.indexOf('@'); if ( idx !== -1 ) { ...
javascript
{ "resource": "" }
q6564
_fnBuildAjax
train
function _fnBuildAjax( oSettings, data, fn ) { // Compatibility with 1.9-, allow fnServerData and event to manipulate _fnCallbackFire( oSettings, 'aoServerParams', 'serverParams', [data] ); // Convert to object based for 1.10+ if using the old scheme if ( data && data.__legacy ) { var tmp = {}; ...
javascript
{ "resource": "" }
q6565
_fnAjaxDataSrc
train
function _fnAjaxDataSrc ( oSettings, json ) { var dataSrc = $.isPlainObject( oSettings.ajax ) && oSettings.ajax.dataSrc !== undefined ? oSettings.ajax.dataSrc : oSettings.sAjaxDataProp; // Compatibility with 1.9-. // Compatibility with 1.9-. In order to read from aaData, check if the // default ha...
javascript
{ "resource": "" }
q6566
train
function(nSizer) { var style = nSizer.style; style.paddingTop = "0"; style.paddingBottom = "0"; style.borderTopWidth = "0"; style.borderBottomWidth = "0"; style.height = 0; }
javascript
{ "resource": "" }
q6567
_fnScrollingWidthAdjust
train
function _fnScrollingWidthAdjust ( settings, n ) { var scroll = settings.oScroll; if ( scroll.sX || scroll.sY ) { // When y-scrolling only, we want to remove the width of the scroll bar // so the table + scroll bar will fit into the area available, otherwise // we fix the table at its current siz...
javascript
{ "resource": "" }
q6568
_fnScrollBarWidth
train
function _fnScrollBarWidth () { // On first run a static variable is set, since this is only needed once. // Subsequent runs will just use the previously calculated value if ( ! DataTable.__scrollbarWidth ) { var inner = $('<p/>').css( { width: '100%', height: 200, padding: 0 } )[0]; ...
javascript
{ "resource": "" }
q6569
_fnSortListener
train
function _fnSortListener ( settings, colIdx, append, callback ) { var col = settings.aoColumns[ colIdx ]; var sorting = settings.aaSorting; var asSorting = col.asSorting; var nextSortIdx; var next = function ( a ) { var idx = a._idx; if ( idx === undefined ) { idx = $.inArray( a[1], asSort...
javascript
{ "resource": "" }
q6570
_fnLoadState
train
function _fnLoadState ( oSettings, oInit ) { var i, ien; var columns = oSettings.aoColumns; if ( !oSettings.oFeatures.bStateSave ) { return; } var oData = oSettings.fnStateLoadCallback.call( oSettings.oInstance, oSettings ); if ( !oData ) { return; } /* Allow custom and ...
javascript
{ "resource": "" }
q6571
train
function ( mixed ) { var idx, jq; var settings = DataTable.settings; var tables = $.map( settings, function (el, i) { return el.nTable; } ); if ( mixed.nTable && mixed.oApi ) { // DataTables settings object return [ mixed ]; } else if ( mixed.nodeName && mixed.nodeName.toLowerCase(...
javascript
{ "resource": "" }
q6572
train
function ( fn ) { if ( __arrayProto.forEach ) { // Where possible, use the built-in forEach __arrayProto.forEach.call( this, fn, this ); } else { // Compatibility for browsers without EMCA-252-5 (JS 1.6) for ( var i=0, ien=this.length ; i<ien; i++ ) { // In strict mode the execu...
javascript
{ "resource": "" }
q6573
train
function ( flatten, type, fn ) { var a = [], ret, i, ien, j, jen, context = this.context, rows, items, item, selector = this.selector; // Argument shifting if ( typeof flatten === 'string' ) { fn = type; type = flatten; flatten = false; } for ( i=0, ien=...
javascript
{ "resource": "" }
q6574
train
function ( selector, a ) { // Integer is used to pick out a table by index if ( typeof selector === 'number' ) { return [ a[ selector ] ]; } // Perform a jQuery selector on the table nodes var nodes = $.map( a, function (el, i) { return el.nTable; } ); return $(nodes) .filter( s...
javascript
{ "resource": "" }
q6575
train
function () { var len = this._iDisplayLength, start = this._iDisplayStart, calc = start + len, records = this.aiDisplay.length, features = this.oFeatures, paginate = features.bPaginate; if ( features.bServerSide ) { return paginate === false || len === -1 ? ...
javascript
{ "resource": "" }
q6576
train
function(userId, callback) { if (!userId) return callback(new Error(utils.i18n.identities.id)); utils.debug('Identities get: ' + userId); request.get({ path: '/users/' + userId + '/identity' }, callback); }
javascript
{ "resource": "" }
q6577
train
function(userId, properties, callback) { if (!userId) return callback(new Error(utils.i18n.identities.id)); utils.debug('Identity edit: ' + userId); request.patch({ path: '/users/' + userId + '/identity', body: Object.keys(properties).map(function(propertyName) { return { ...
javascript
{ "resource": "" }
q6578
train
function(website) { var self = this; var scriptPath = path.dirname(website.script); var script = ''; var port = website.port; if(website.absoluteScript === false) { scriptPath = process.cwd() + '/' + path.dirname(website.script); } script = path.basename(website.script); var env = JSON.parse(JSO...
javascript
{ "resource": "" }
q6579
commaNumber
train
function commaNumber(inputNumber, optionalSeparator, optionalDecimalChar) { // we'll strip off and hold the decimal value to reattach later. // we'll hold both the `number` value and `stringNumber` value. let number, stringNumber, decimal // default `separator` is a comma const separator = optionalSeparator...
javascript
{ "resource": "" }
q6580
train
function () { var coming = F.coming; if (!coming || false === F.trigger('onCancel')) { return; } F.hideLoading(); if (F.ajaxLoad) { F.ajaxLoad.abort(); } F.ajaxLoad = null; if (F.imgPreload) { F.imgPreload.onload = F.imgPreload.onerror = null; } if (coming.wrap) { com...
javascript
{ "resource": "" }
q6581
train
function ( direction ) { var current = F.current; if (current) { if (!isString(direction)) { direction = current.direction.next; } F.jumpto(current.index + 1, direction, 'next'); } }
javascript
{ "resource": "" }
q6582
train
function ( direction ) { var current = F.current; if (current) { if (!isString(direction)) { direction = current.direction.prev; } F.jumpto(current.index - 1, direction, 'prev'); } }
javascript
{ "resource": "" }
q6583
train
function ( index, direction, router ) { var current = F.current; if (!current) { return; } index = getScalar(index); F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ]; F.router = router || 'jumpto'; if (current.loop) { if (index < 0) { in...
javascript
{ "resource": "" }
q6584
train
function (e, onlyAbsolute) { var current = F.current, wrap = current ? current.wrap : null, pos; if (wrap) { pos = F._getPosition(onlyAbsolute); if (e && e.type === 'scroll') { delete pos.position; wrap.stop(true, true).animate(pos, 200); } else { wrap.css(pos); cur...
javascript
{ "resource": "" }
q6585
train
function ( action ) { if (F.isOpen) { F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView; // Help browser to restore document dimensions if (isTouch) { F.wrap.removeAttr('style').addClass('fancybox-tmp'); F.trigger('onUpdate'); } F.update(); } }
javascript
{ "resource": "" }
q6586
train
function(opts) { opts = $.extend({}, this.defaults, opts); if (this.overlay) { this.close(); } this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( F.coming ? F.coming.parent : opts.parent ); this.fixed = false; if (opts.fixed && F.defaults.fixed) { this.overlay.addClass('fa...
javascript
{ "resource": "" }
q6587
train
function (opts, obj) { var overlay = this.overlay; $('.fancybox-overlay').stop(true, true); if (!overlay) { this.create(opts); } if (opts.locked && this.fixed && obj.fixed) { if (!overlay) { this.margin = D.height() > W.height() ? $('html').css('margin-right').replace("px", "") : false; ...
javascript
{ "resource": "" }
q6588
train
function(conversationId, callback) { conversationId = utils.toUUID(conversationId); if (!conversationId) return callback(new Error(utils.i18n.conversations.id)); utils.debug('Conversation get: ' + conversationId); request.get({ path: '/conversations/' + conversationId }, callback)...
javascript
{ "resource": "" }
q6589
train
function(userId, conversationId, callback) { if (!userId) return callback(new Error(utils.i18n.conversations.userId)); conversationId = utils.toUUID(conversationId); if (!conversationId) return callback(new Error(utils.i18n.conversations.id)); utils.debug('Conversation getFromUser: ' + userId + ...
javascript
{ "resource": "" }
q6590
train
function(userId, params, callback) { if (!userId) return callback(new Error(utils.i18n.conversations.userId)); utils.debug('Conversation getAllFromUser: ' + userId); var queryParams = ''; if (typeof params === 'function') callback = params; else queryParams = '?' + querystring.stringify(p...
javascript
{ "resource": "" }
q6591
train
function(conversationId, operations, callback) { conversationId = utils.toUUID(conversationId); if (!conversationId) return callback(new Error(utils.i18n.conversations.id)); if (!utils.isArray(operations)) return callback(new Error(utils.i18n.conversations.operations)); utils.debug('Conversation...
javascript
{ "resource": "" }
q6592
train
function(conversationId, properties, callback) { conversationId = utils.toUUID(conversationId); if (!conversationId) return callback(new Error(utils.i18n.conversations.id)); utils.debug('Conversation setMetadataProperties: ' + conversationId); var operations = []; Object.keys(properties)....
javascript
{ "resource": "" }
q6593
train
function(conversationId, properties, callback) { conversationId = utils.toUUID(conversationId); if (!conversationId) return callback(new Error(utils.i18n.conversations.id)); utils.debug('Conversation deleteMetadataProperties: ' + conversationId); var operations = []; Object.keys(propertie...
javascript
{ "resource": "" }
q6594
resolveArgument
train
function resolveArgument(expr, argIndex) { if (typeof argIndex === 'undefined') { argIndex = 0; } if (!expr.arguments.length || !expr.arguments[argIndex]) { return; } this.applyPluginsBailResult('call require:commonjs:item', expr, this.evaluateExpression(expr.arguments[ar...
javascript
{ "resource": "" }
q6595
getEntryPoints
train
function getEntryPoints(globPattern) { var testFiles = glob.sync(globPattern); var entryPoints = {}; testFiles.forEach(function(file) { entryPoints[file.replace(/\.js$/, '')] = './' + file; }); return entryPoints; }
javascript
{ "resource": "" }
q6596
polymerBuild
train
function polymerBuild(config) { const skipRootFolder = function(file) { const rootFolder = config.root || '.'; file.dirname = path.relative(rootFolder, file.dirname); }; const project = new build.PolymerProject(config); const bundler = project.bundler({ // XXX: sourcemaps makes V8 run out of memory source...
javascript
{ "resource": "" }
q6597
serializeError
train
function serializeError(err) { var o = {}; Object.getOwnPropertyNames(err).forEach(function (k) { o[k] = err[k]; }); return _.omit(o, ['stack', 'type', 'arguments']); }
javascript
{ "resource": "" }
q6598
serializeCookie
train
function serializeCookie(cookie) { return { path: cookie.path, name: cookie.key, value: cookie.value, domain: cookie.domain }; }
javascript
{ "resource": "" }
q6599
norm16
train
function norm16(v) { v = parseInt(v, 16); return size == 2 ? v : // 16 bit size == 1 ? v << 4 : // 8 bit v >> (4 * (size - 2)); // 24 or 32 bit }
javascript
{ "resource": "" }