createSelector( ( state, siteId, productSlug ) => { const plansBySiteId = getPlansBySiteId( state, siteId ); if ( ! plansBySiteId || ! plansBySiteId.data ) { return null; } return plansBySiteId.data.filter( ( plan ) => plan.productSlug === productSlug ).shift(); }, ( state, siteId ) => getPlansBySiteId( state, siteId ) )
rows() { const copy = this.raw(); copy.shift(); return copy; }
client.on('message', message => { if (!message.content.startsWith(prefix) || message.author.bot) return; message.content = message.content .replace(prefix, '') .trim() .split(' '); const command = message.content.shift(); message.content = message.content.join(' '); // eslint-disable-next-line no-console console.log('COMMAND', command, message.content); if (command in commands) commands[command](message); });
/** * returns a selected container from the containers listbox * @return {string} container id */ getSelectedContainer () { return this.widget.getItem(this.widget.selected).getContent().toString().trim().split(' ').shift() }
compose('getId', data).then(id => { if (!_.isEmpty(id)) { // @todo: this assumes that the container we want // is probably the first id returned. What happens if that is // not true or we need other ids for this service? const ids = id.split('\n'); return docker.scan(_.trim(ids.shift())); } })
sendDefferedMethodCall() { if (this.pendingRequests.length > 0) { this.isRequestPending = true; const nextRequest = this.pendingRequests.shift(); this.sendMethodCall(nextRequest.methodName, nextRequest.parameters) .then(nextRequest.resolve) .catch(nextRequest.reject); } }
_.each(values, (value, seriesName) => { if (!this.series[seriesName]) { return; } if (this._isHighwater(seriesName)) { this.series[seriesName].y = _.times(this.limit, _.constant(value)); } else { this.series[seriesName].y.shift(); this.series[seriesName].y.push(value); } });
// Connect to MongoDB Database and return user connection MongoClient.connect(process.env.MONGO_URI, (err, mongoClient) => { if (err) throw new Error(err) const dbName = process.env.MONGO_URI.split('/').pop().split('?').shift() const db = mongoClient.db(dbName) usersCollection = db.collection('users') })
const deCap = (match, endOfWord) => { const arr = match.split('') const first = arr.shift().toUpperCase() const last = endOfWord ? arr.pop().toLowerCase() : arr.pop() return first + arr.join('').toLowerCase() + last }
release(key){ let locked = this.locked.get(key); if(locked) { if(locked.length > 0) { locked.shift()(); // Release the lock } else { this.locked.delete(key); } } return Promise.resolve(); }
export function getNextBlocksList(editorState, startKey) { return editorState .getCurrentContent() .getBlockMap() .toSeq() .skipUntil((_, k) => k === startKey) .toList() .shift() .concat([createNewBlock()]); }
Object.keys(update).forEach((fieldName) => { if (fieldName.indexOf('.') > -1) { const components = fieldName.split('.'); const first = components.shift(); dotNotationOptions[first] = true; } else { dotNotationOptions[fieldName] = false; } });
_.each(data, (values) => { _.each(values, (value, seriesName) => { if (!this.series[seriesName]) { return; } if (!this._isHighwater(seriesName)) { this.series[seriesName].y.shift(); this.series[seriesName].y.push(value); } }); });
bench1.run() .then(() => { if (dataFiles.length > 0) return runTest(dataFiles.shift()); })
/** * returns a selected service from the services listbox * @return {string} service id */ getSelectedService () { return this.widget.getItem(this.widget.selected).getContent().toString().trim().split(' ').shift() }