_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q29600
train
function(options, callback) { if(typeof options === 'function') { callback = options; options = {}; } if(options.items) { options.users = options.users || []; for(var i = 0; i < options.items.length ; i++){ options.users.push(options.items[i]._key); } ...
javascript
{ "resource": "" }
q29601
F1
train
function F1 (config) { var valErrors = jjv.validate(configSchema, config) if (valErrors && valErrors.validation) { throw new Error('Validation errors: ' + JSON.stringify(valErrors.validation, null, 3)) } this.config = config }
javascript
{ "resource": "" }
q29602
train
function (optionCollection, key, model, collection) { if (optionCollection) { return strTo(optionCollection, model, Collection) || collection; } return strTo(key, model, Collection) || null; }
javascript
{ "resource": "" }
q29603
train
function (alias, construct) { var aliases = {}; var currAliases = Backbone.FormView.prototype.fieldAlias; if (construct) { aliases[alias] = construct; } else { aliases = alias; } defaults(currAliases, aliases); }
javascript
{ "resource": "" }
q29604
train
function (schema) { if (!this.rowConfig.options) { this.rowConfig.options = {}; } this.rowConfig.options.schema = schema || this.options.rowSchema || this.rowSchema; return this; }
javascript
{ "resource": "" }
q29605
train
function () { this.subs.detachElems(); this.$el.html(this.template(this._getTemplateVars())); if (!this.getRows() || !this.getRows().length) { this.setupRows(); } this.subs.renderByKey('row', { appendTo: this.getRowWrapper() }); ret...
javascript
{ "resource": "" }
q29606
train
function (obj) { var model = (obj instanceof Model) ? obj : null; var view = (!model && obj instanceof Backbone.View) ? obj : null; var arr = (!model && !view && isArray(obj)) ? obj : null; if (arr) { each(arr, this.deleteRow, this); retur...
javascript
{ "resource": "" }
q29607
train
function () { var $input; var id = this.inputId; var attrs = this.addId ? { id : id, name: id } : {}; var valForInput = this.getValueForInput(); $input = Backbone.$('<' + this.elementType + '>'); if (this.elementType === 'input') { attrs.type = 't...
javascript
{ "resource": "" }
q29608
train
function () { var possibleVals = result(this, 'possibleVals'); var key; var i = 0; var possibleVal; var $checkbox; var isSelected; var $inputWrapper = this.getInputWrapper().empty(); for (key in possibleVals) { ...
javascript
{ "resource": "" }
q29609
train
function (key) { var modelVal = this.getModelVal(); modelVal = this.multiple ? modelVal : [modelVal]; return (_.indexOf(_.map(modelVal, toStr), toStr(key)) > -1); }
javascript
{ "resource": "" }
q29610
train
function () { var possibleVals = result(this, 'possibleVals'); var id = this.inputId; var $select = Backbone.$('<' + this.elementType + '>') .attr(extend((this.addId ? { id: id, name: id } : {}), this.inputAttrs)); this.getInputWrapper().html($select)...
javascript
{ "resource": "" }
q29611
train
function (possibleVal, isChecked, index) { var $listItem; var $label; var id = this.inputId; var attributes = { type: 'checkbox', value: possibleVal.value}; if (this.addId) { extend(attributes, { name: id, id: (id + '-' + index) }); } attributes =...
javascript
{ "resource": "" }
q29612
RedisClient
train
function RedisClient(opts) { opts = opts || {}; BaseClient.apply(this, arguments); this.recordsToKeep = opts.recordsToKeep || 1000; this.namespace = opts.namespace || 'stats'; this.client = opts.redisClient; }
javascript
{ "resource": "" }
q29613
train
function(_options){ // bugfix for ie title with flash _title = document.title; var _parent = _e._$get(_options.parent)||document.body, _html = _t0._$get(_seed_html,_options); _parent.insertAdjacentHTML( !_options.hidden?'beforeEnd':'afterBeg...
javascript
{ "resource": "" }
q29614
train
function(_id,_event){ var _type = _event.type.toLowerCase(); _t1.requestAnimationFrame(function(){ _v._$dispatchEvent(_id,_type); }); }
javascript
{ "resource": "" }
q29615
train
function(_options){ // init flash vars var _id = _options.id, _params = _options.params; if (!_params){ _params = {}; _options.params = _params; } var _vars = _params.flashvars||''; _vars += (!_vars?'...
javascript
{ "resource": "" }
q29616
EntityProvider
train
function EntityProvider(storage, location) { EntityProvider.super_.call(this, storage); Object.defineProperties(this, { /** * The location of the entities in the storage. * * @property location * @type String * @final */ location: {value: location} }); if (Object.protot...
javascript
{ "resource": "" }
q29617
getEntities
train
function getEntities(callback) { self.get(filter, fields, null, page, sort, function(error, entities, pagination) { if (error) return callback(error); allEntities = allEntities.concat(entities); if (page < pagination.pages - 1) { // There are other pages // Get next page ...
javascript
{ "resource": "" }
q29618
registerHelper
train
function registerHelper(name, helper) { var s = this; s.helpers = s.helpers || {}; s.helpers[name] = helper; return s; }
javascript
{ "resource": "" }
q29619
registerHelpers
train
function registerHelpers(helpers) { var s = this; var names = Object.keys(helpers || {}); for (var i = 0, len = names.length; i < len; i++) { var name = names[i]; s.registerHelper(name, helpers[name]); } return s; }
javascript
{ "resource": "" }
q29620
SocketNamespace
train
function SocketNamespace() { var self = this; var namespace = null; Object.defineProperties(this, { /** * The list of messages' handlers. * * @property handlers * @type Object */ handlers: {value: {}}, /** * The list of middlewares. * * @property middlewares ...
javascript
{ "resource": "" }
q29621
train
function (params) { var element = document.createElement('script'), headElement = document.getElementsByTagName('head')[0], load = params.load, error = params.error, jsonpCallback = params.jsonpCallback, ...
javascript
{ "resource": "" }
q29622
train
function (url, key, value) { var regex = new RegExp("([?|&])" + key + "=.*?(&|#|$)(.*)", "gi"), separator, hash; if (regex.test(url)) { url = url.replace(regex, '$1' + key + "=" + value + '$2$3'); } else { ...
javascript
{ "resource": "" }
q29623
norender
train
function norender(app, ext, file, locals) { return !app.engines.hasOwnProperty(ext) || app.isTrue('norender') || app.isFalse('render') || file.norender === true || file.render === false || locals.norender === true || locals.render === false; }
javascript
{ "resource": "" }
q29624
validateProperty
train
function validateProperty(property, validator) { let isValid; if (!validator) { return void 0; } if (!property) { return void 0; } const {value} = property; const {options} = validator; const isValueNullOrUndefined = isNull(value) || isUndefined(value ); isValid = (()...
javascript
{ "resource": "" }
q29625
train
function (evt,stopBubble) { 'use strict'; //console.log('fidjBlockMove'); // All but scrollable element = .c4p-container-scroll-y //if (evt.preventDefault) evt.preventDefault() ; //if (evt.preventDefault && !$(evt.target).parents('.c4p-container-scroll-y')[0]) { // evt.preventDefault(); /...
javascript
{ "resource": "" }
q29626
fidjDateParse
train
function fidjDateParse(date) { if (!date || typeof date != 'string' || date == '') return false; // Date (choose 0 in date to force an error if parseInt fails) var yearS = parseInt(date.substr(0,4), 10) || 0; var monthS = parseInt(date.substr(5,2), 10) || 0; var dayS = parseInt(date.substr(8,2), 10)...
javascript
{ "resource": "" }
q29627
train
function (position) { var lat = position.coords.latitude; var lng = position.coords.longitude; geo_codeLatLng(lat, lng); }
javascript
{ "resource": "" }
q29628
train
function (name) { var filters = ltl.filters var filter = filters[name] if (!filter) { try { filter = filters[name] = ltl.scope[name] || (typeof require !== 'undefined' ? require(name) : null) } catch (ignore) { } } if (!filter) { var todo = 'Set window.ltl.filters.' +...
javascript
{ "resource": "" }
q29629
Courier
train
function Courier(opts) { stream.Transform.call(this, { objectMode: true }); this.options = merge(Object.create(Courier.DEFAULTS), opts || {}); }
javascript
{ "resource": "" }
q29630
SmartRelay
train
function SmartRelay(socket, options) { stream.Transform.call(this, {}); this.options = merge(Object.create(SmartRelay.DEFAULTS), options || {}); this.socket = socket; this.recentData = []; this.peers = function () { return []; }; }
javascript
{ "resource": "" }
q29631
save
train
function save() { var res = this; res.$created = true; return this.$loc.$save(this.$toObject()).then(function() { emitter.emit('updated', res); if (!res.$resolved) { res.$deferred.resolve(res); res.$resolved = true; } return res; ...
javascript
{ "resource": "" }
q29632
updateOrCreate
train
function updateOrCreate(val) { var res = _resources[val._id]; if (!res) { res = new Resource(val, false, new Date().getTime()); } else { res.$updateServer(val); } return res; }
javascript
{ "resource": "" }
q29633
train
function (modelName, plugins) { logger.debug("Getting service for model: " + modelName); var smd = this.config.resolverByModel(modelName); return this.getService(smd, plugins); }
javascript
{ "resource": "" }
q29634
train
function (serviceName, plugins) { logger.debug("Getting service: " + serviceName); var smd = this.config.resolver(serviceName); return this.getService(smd, plugins); }
javascript
{ "resource": "" }
q29635
train
function (smd, plugins) { var reader = this.newReader(smd), provider = this.config.provider, matcher = this.pluginMatcher, sentPlugins = plugins || [], mixinPlugins = [], pertinentMethods, ...
javascript
{ "resource": "" }
q29636
train
function (smd) { // zyp format by default. var ret = new ZypSMDReader(smd, this.config.resolver); if (!smd.SMDVersion) { //not zyp then fail. throw new Error("Argument is not an SMD."); } return ret; ...
javascript
{ "resource": "" }
q29637
createPromiseWithTimeout
train
async function createPromiseWithTimeout(promise, timeout, desc) { if (!(promise instanceof Promise)) throw new Error('Promise expected') if (!timeout) throw new Error('Timeout must be a number') if (timeout < 0) throw new Error('Timeout cannot be negative') const { promise: toPromise, timeout: to }...
javascript
{ "resource": "" }
q29638
ancestry
train
function ancestry(input) { const proto = input && typeof input === 'object' ? Object.getPrototypeOf(input) : null; return proto ? ancestry(proto).concat(proto) : []; }
javascript
{ "resource": "" }
q29639
typeInAncestry
train
function typeInAncestry(type, input) { return ancestry(input) .reduce((carry, obj) => carry || Type.objectName(obj) === type, false); }
javascript
{ "resource": "" }
q29640
isType
train
function isType(type, input) { if (input === null) { return type.toLowerCase() === 'null'; } return typeof input === type.toLowerCase() || Type.is(type, input); }
javascript
{ "resource": "" }
q29641
cachedTypeDetector
train
function cachedTypeDetector(type) { if (!cache.has(type)) { cache.set(type, (input) => isType(type, input) || typeInAncestry(type, input)); } return cache.get(type); }
javascript
{ "resource": "" }
q29642
mapFiles
train
async function mapFiles (customizeResult, targetDir, callback) { const files = mergeEngineResults(customizeResult) const results = mapValues(files, (file, filename) => { // Write each file const fullpath = path.join(targetDir, filename) return callback(fullpath, file.contents) }) return deep(results...
javascript
{ "resource": "" }
q29643
mapValues
train
function mapValues (obj, fn) { return Object.keys(obj).reduce(function (subresult, key) { subresult[key] = fn(obj[key], key) return subresult }, {}) }
javascript
{ "resource": "" }
q29644
train
function (elem, func) { var elt = new TeardownCallback(func); var propName = DOMBackend.Teardown._CB_PROP; if (! elem[propName]) { // create an empty node that is never unlinked elem[propName] = new TeardownCallback; // Set up the event, only the first time. $jq(elem).on(DOMBackend...
javascript
{ "resource": "" }
q29645
train
function (elem) { var elems = []; // Array.prototype.slice.call doesn't work when given a NodeList in // IE8 ("JScript object expected"). var nodeList = elem.getElementsByTagName('*'); for (var i = 0; i < nodeList.length; i++) { elems.push(nodeList[i]); } elems.push(elem); $jq.clea...
javascript
{ "resource": "" }
q29646
train
function () { var eventDict = element.$blaze_events; if (! eventDict) return; // newHandlerRecs has only one item unless you specify multiple // event types. If this code is slow, it's because we have to // iterate over handlerList here. Clearing a whole handlerList // via ...
javascript
{ "resource": "" }
q29647
train
function (content) { checkRenderContent(content); if (content instanceof Blaze.Template) { return content.constructView(); } else if (content instanceof Blaze.View) { return content; } else { var func = content; if (typeof func !== 'function') { func = function () { return content...
javascript
{ "resource": "" }
q29648
train
function (x) { if (typeof x === 'function') { return function () { var data = Blaze.getData(); if (data == null) data = {}; return x.apply(data, arguments); }; } return x; }
javascript
{ "resource": "" }
q29649
isResourceClass
train
function isResourceClass(Class) { const hitByClass = Class.prototype instanceof TheResource || Class === TheResource if (hitByClass) { return true } let named = Class while (!!named) { const hit = named.name && named.name.startsWith('TheResource') if (hit) { return true } named =...
javascript
{ "resource": "" }
q29650
Probe
train
function Probe(connection, done) { if (!(this instanceof Probe)) { return new Probe(connection, done); } if (typeof connection === 'string') { connection = Connection.from( Deployment.getId(connection)); } debug('connection is `%j`', connection); this.deployment = new Deployment({ _id: I...
javascript
{ "resource": "" }
q29651
train
function(_dest, _src){ var _nodeName, _attr; if (_dest.nodeType !== 1) { return; } // lt ie9 才有 if (_dest.clearAttributes) { _dest.clearAttributes(); _dest.mergeAttributes(_src); ...
javascript
{ "resource": "" }
q29652
PersonAddresses
train
function PersonAddresses (f1, personID) { if (!personID) { throw new Error('PersonAddresses requires a person ID!') } Addresses.call(this, f1, { path: '/People/' + personID + '/Addresses' }) }
javascript
{ "resource": "" }
q29653
TheHtmlStyle
train
function TheHtmlStyle(_ref) { var className = _ref.className, id = _ref.id, options = _ref.options; return _react.default.createElement(_theStyle.TheStyle, (0, _extends2.default)({ id: id }, { className: (0, _classnames.default)('the-html-style', className), styles: TheHtmlStyle.data(optio...
javascript
{ "resource": "" }
q29654
initFileLogger
train
function initFileLogger(filepath) { currentFilePath = filepath || currentFilePath; var logDir = path.dirname(currentFilePath); appenders.push(logToFile); if(!fs.existsSync(logDir)) fs.mkdirSync(logDir); }
javascript
{ "resource": "" }
q29655
writeLog
train
function writeLog(level, msg) { var line; if(showSourceInfo) { var si = getSourceInfo(); if (includeDate) { line = util.format("[%s] <%s>\t[%s:%s] %s", moment().format(), level, si.file, si.lineNumber, msg); } else { line = util.format("<%s>\t[%s:%s] %s", level, si.file, si.lineNumber, msg);...
javascript
{ "resource": "" }
q29656
getSourceInfo
train
function getSourceInfo() { var exec = getStack()[3]; var pos = exec.getFileName().lastIndexOf('\\'); if(pos < 0) exec.getFileName().lastIndexOf('/'); return { methodName: exec.getFunctionName() || 'anonymous', file: exec.getFileName().substring(pos + 1), lineNumber: exec.getLineNumber() }; }
javascript
{ "resource": "" }
q29657
train
function ($scope, element, attrs) { var opts = {}; if (attrs.uiAnimate) { opts = $scope.$eval(attrs.uiAnimate); if (angular.isString(opts)) { opts = {'class': opts}; } } opts = angular.extend({'class': 'ui-animate'}, options, opts); element.addC...
javascript
{ "resource": "" }
q29658
bindMapEvents
train
function bindMapEvents(scope, eventsStr, googleObject, element) { angular.forEach(eventsStr.split(' '), function (eventName) { //Prefix all googlemap events with 'map-', so eg 'click' //for the googlemap doesn't interfere with a normal 'click' event var $event = { type: 'map-' + eventName }; ...
javascript
{ "resource": "" }
q29659
resolveIncludeDirectives
train
function resolveIncludeDirectives(text, fileItem) { var result = []; // parse source code with esprima try { var srcParsed = esprima.parse(text); } catch (e) { logger.error(buildErrMsg(fileItem.ancestor, 'Failed to parse a [%s] JavaScript file. Reason : [%s]', fileItem.filePath, e)); throw buildShortErrMsg(f...
javascript
{ "resource": "" }
q29660
train
function(){ var _body,_text; try{ var _body = this.__frame.contentWindow.document.body, _text = (_body.innerText||_body.textContent||'').trim(); // check result for same domain with upload proxy html if (_text.indexOf(_xflag)>=0...
javascript
{ "resource": "" }
q29661
train
function(_url,_mode,_cookie){ _j0._$request(_url,{ type:'json', method:'POST', cookie:_cookie, mode:parseInt(_mode)||0, onload:function(_data){ if (!this.__timer) return; this._$dispatchEv...
javascript
{ "resource": "" }
q29662
Cli
train
function Cli(hydro, argv) { if (!(this instanceof Cli)) { return new Cli(hydro, argv); } this.hydro = hydro; this.argv = argv; this.options = {}; this.conf = []; this.commands = [ 'help', 'version' ]; this.arrayParams = { plugins: true }; }
javascript
{ "resource": "" }
q29663
followEntryRefs
train
function followEntryRefs( key, callback ) { return function( entry ) { const refs = entry[ key ] || []; return Promise.all( refs.map( callback ) ).then( flatten ); }; }
javascript
{ "resource": "" }
q29664
MongoDatabase
train
function MongoDatabase(configuration) { MongoDatabase.super_.call(this, configuration); Object.defineProperties(this, { /** * The name of the replica set. * * @property replicaSet * @type String * @final */ replicaSet: {value: configuration.replicaSet}, /** * A comm...
javascript
{ "resource": "" }
q29665
buildFilters
train
function buildFilters(filters) { var builtFilters = []; filters.forEach(function(filter) { builtFilters.push(MongoDatabase.buildFilter(filter)); }); return builtFilters; }
javascript
{ "resource": "" }
q29666
isValidType
train
function isValidType(value, authorizedTypes) { var valueToString = Object.prototype.toString.call(value); for (var i = 0; i < authorizedTypes.length; i++) if (valueToString === '[object ' + authorizedTypes[i] + ']') return true; return false; }
javascript
{ "resource": "" }
q29667
addComparisonOperation
train
function addComparisonOperation(field, value, operator, authorizedTypes) { if (!isValidType(field, ['String'])) throw new TypeError('Invalid field'); if (!isValidType(value, authorizedTypes)) throw new TypeError('Invalid value'); this.operations.push({ type: operator, field: field, value: value });...
javascript
{ "resource": "" }
q29668
addLogicalOperation
train
function addLogicalOperation(filters, operator) { for (var i = 0; i < filters.length; i++) if (!(filters[i] instanceof ResourceFilter)) throw new TypeError('Invalid filters'); if (this.hasOperation(operator)) { // This logical operator already exists in the list of operations // Just add the new filte...
javascript
{ "resource": "" }
q29669
hashFile
train
function hashFile(filename, callback) { var calledBack = false, md5sum = crypto.createHash('md5'), stream = fs.ReadStream(filename); stream.on('data', function (data) { md5sum.update(data); }); stream.on('end', function () { var hash = md5sum.digest('hex'); callback(...
javascript
{ "resource": "" }
q29670
train
function (state, cli) { var name = cli['<name>']; var chains = Object.keys(state.state.pointers); if(chains.indexOf(name) > -1) { console.log(`Error: Chain ${name} is already known, please choose another name.`); process.exit(); } newChain({name}, state, (err, chaindata) => { i...
javascript
{ "resource": "" }
q29671
hasOwnProperties
train
function hasOwnProperties(exclude) { const arg = this; if (!isObjectLike(arg)) return false; if (!isValid(exclude)) { const keys = Object.keys(arg); return keys.length > 0; } return !!eachProp.call(arg, resolveTestFunc(exclude, objectHasNotOwnPropertyBreakTrue, arrayContainsNotKeyBr...
javascript
{ "resource": "" }
q29672
objFiltered
train
function objFiltered(filter, thisArg) { const dst = isArray(this) ? [] : {}; copyFiltered.call(dst, this, filter, thisArg); return dst; }
javascript
{ "resource": "" }
q29673
objMapped
train
function objMapped(callback, thisArg = UNDEFINED) { const dst = isArray(this) ? [] : {}; eachProp.call(this, (value, key, src) => { const result = callback.call(thisArg, value, key, src); if (result === BREAK) return BREAK; if (result !== UNDEFINED) { dst[key] = result; ...
javascript
{ "resource": "" }
q29674
objMap
train
function objMap(callback, thisArg = UNDEFINED) { const dst = []; each.call(this, (value, key, src) => { const result = callback.call(thisArg, value, key, src); if (result === BREAK) return BREAK; if (result !== UNDEFINED) { dst.push(result); } }); return dst; ...
javascript
{ "resource": "" }
q29675
objSome
train
function objSome(callback, thisArg = UNDEFINED) { return !!each.call(this, (value, key, src) => { BREAK.setDefault(true); const result = callback.call(thisArg, value, key, src); if (result === BREAK) return BREAK; if (result) return BREAK(true); }); }
javascript
{ "resource": "" }
q29676
objReduceLeft
train
function objReduceLeft(callback/*, initialValue = UNDEFINED*/) { const args = Array.prototype.slice.call(arguments, 0); args.unshift(each); return objReduceIterated.apply(this, args); }
javascript
{ "resource": "" }
q29677
objReduceRight
train
function objReduceRight(callback/*, initialValue = UNDEFINED*/) { const args = Array.prototype.slice.call(arguments, 0); args.unshift(eachRight); return objReduceIterated.apply(this, args); }
javascript
{ "resource": "" }
q29678
encodeParams
train
function encodeParams(params) { var queryString; if (params && Object.keys(params)) { queryString = [].slice.call(arguments).reduce(function (a, b) { return a.concat(b instanceof Array ? b : [b]); }, []).filter(function (c) { return "object" === typeof c; }).reduc...
javascript
{ "resource": "" }
q29679
train
function (e) { var keyCode = e.keyCode || e.which; // If the user pressed enter if (keyCode === 13) { this.addRow(); // Get the last row viewEvents, then get the title field, then have jQuery ...
javascript
{ "resource": "" }
q29680
getAssertQueueOptions
train
function getAssertQueueOptions() { const aliases ={ queueLimit: 'maxLength', deadLetter: 'deadLetterExchange', deadLetterRoutingKey: 'deadLetterRoutingKey' }; const itemsToOmit = ['limit', 'noBatch']; let aliased = _.transform(options, function(result, value, key) { let alias = ...
javascript
{ "resource": "" }
q29681
purge
train
function purge() { qLog.info(`Purging queue ${channelName} - ${connectionName}`); return channel.purgeQueue(channelName).then(function(){ qLog.debug(`Successfully purged queue ${channelName} - ${connectionName}`); }); }
javascript
{ "resource": "" }
q29682
getNoBatchOps
train
function getNoBatchOps(raw) { messages.receivedCount += 1; return { ack: function() { qLog.debug(`Acking tag ${raw.fields.deliveryTag} on ${messages.name} - ${messages.connectionName}`); channel.ack({ fields: { deliveryTag: raw.fields.deliveryTag } }, false); }, nack: function...
javascript
{ "resource": "" }
q29683
getResolutionOperations
train
function getResolutionOperations(raw, consumeOptions) { if (consumeOptions.noAck) { return getUntrackedOps(raw); } if (consumeOptions.noBatch) { return getNoBatchOps(raw); } return getTrackedOps(raw); }
javascript
{ "resource": "" }
q29684
subscribe
train
function subscribe(callback, subscribeOptions) { let consumeOptions = {}; _.assign(consumeOptions, options, subscribeOptions); consumeOptions = _.pick(consumeOptions, ['consumerTag', 'noAck', 'noBatch', 'limit', 'exclusive', 'priority', 'arguments']); let shouldAck = !consumeOptions.noAck; let shou...
javascript
{ "resource": "" }
q29685
define
train
function define() { let aqOptions = getAssertQueueOptions(); topLog.info(`Declaring queue \'${channelName}\' on connection \'${connectionName}\' with the options: ${JSON.stringify(_.omit(aqOptions, ['name']))}`); return channel.assertQueue(channelName, aqOptions); }
javascript
{ "resource": "" }
q29686
train
function(_map,_index,_list){ if (_u._$indexOf(_checklist,_map.w)<0){ _checklist.push(_map.w); _list.splice(_index,1); _map.w.name = _map.d; } }
javascript
{ "resource": "" }
q29687
train
function(_data){ var _result = {}; _data = _data||_o; _result.origin = _data.origin||''; _result.ref = location.href; _result.self = _data.source; _result.data = JSON.stringify(_data.data); return _key+_u._$...
javascript
{ "resource": "" }
q29688
OnSwipe
train
function OnSwipe(element, fn) { var axis = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : OdoPointer.Axis.X; classCallCheck(this, OnSwipe); this.fn = fn; this.pointer = new OdoPointer(element, { axis: axis }); this._onEnd = this._handlePointerEnd.bind(...
javascript
{ "resource": "" }
q29689
swiped
train
function swiped(event) { console.log(event); event.currentTarget.querySelector('span').textContent = 'Swiped ' + event.direction; }
javascript
{ "resource": "" }
q29690
getTransitionEndEvent
train
function getTransitionEndEvent() { const div = document.createElement('div'); div.style.transitionProperty = 'width'; // Test the value which was just set. If it wasn't able to be set, // then it shouldn't use unprefixed transitions. /* istanbul ignore next */ if (div.style.transitionProperty !== 'width' &...
javascript
{ "resource": "" }
q29691
aggregateParams
train
function aggregateParams(_, pulse) { var key = _.field, value = _.value, op = (_.op === 'count' ? '__count__' : _.op) || 'sum', fields = accessorFields(key).concat(accessorFields(value)), keys = pivotKeys(key, _.limit || 0, pulse); return { key: _.key, groupby: _.groupby...
javascript
{ "resource": "" }
q29692
get
train
function get(k, key, value, fields) { return accessor( function(d) { return key(d) === k ? value(d) : NaN; }, fields, k + '' ); }
javascript
{ "resource": "" }
q29693
ViewportItem
train
function ViewportItem(options, parent) { classCallCheck(this, ViewportItem); this.parent = parent; this.id = Math.random().toString(36).substring(7); this.triggered = false; this.threshold = 200; this.isThresholdPercentage = false; // Override defaults with options. Obj...
javascript
{ "resource": "" }
q29694
Viewport
train
function Viewport() { classCallCheck(this, Viewport); this.addId = null; this.hasActiveHandlers = false; this.items = new Map(); // Assume there is no horizontal scrollbar. documentElement.clientHeight // is incorrect on iOS 8 because it includes toolbars. this.viewportHeight...
javascript
{ "resource": "" }
q29695
resolveEntry
train
function resolveEntry(options) { const cwd = options.cwd; const pkg = options.pkg; let entries = []; if (is.array(options.entry)) entries = options.entry; if (is.string(options.entry)) entries.push(options.entry); const result = new Set(); try { // set the entry that module exports result.add(re...
javascript
{ "resource": "" }
q29696
train
function () { var data = this.data; var targetEl = this.data.target; // Only set up once. if (targetEl.dataset.setImageFadeSetup) { return; } targetEl.dataset.setImageFadeSetup = true; // Create animation. targetEl.setAttribute('animation__fade', { p...
javascript
{ "resource": "" }
q29697
arrayGroup
train
function arrayGroup (set, get, reduce) { //we can use a different lookup path on the right hand object //is always the "needle" function _compare (hay, needle) { for(var i in set) { var x = u.get(hay, set[i]), y = needle[i] if(x !== y) return compare(x, y) } return 0 } return functio...
javascript
{ "resource": "" }
q29698
_compare
train
function _compare (hay, needle) { for(var i in set) { var x = u.get(hay, set[i]), y = needle[i] if(x !== y) return compare(x, y) } return 0 }
javascript
{ "resource": "" }
q29699
getTallest
train
function getTallest(elements) { let tallest = 0; for (let i = elements.length - 1; i >= 0; i--) { if (elements[i].offsetHeight > tallest) { tallest = elements[i].offsetHeight; } } return tallest; }
javascript
{ "resource": "" }