// 每次读取时推送一定量数据 makeData() { if (!dataSource.data.length) return null; return dataSource.data.splice(dataSource.data.length - 5000).reduce((a,b) => a + '' + b) }
onClearTagButtonClick(event) { const index = event.target.getAttribute('data-index'); const newTags = this.state.selectedTags.slice(); newTags.splice(index, 1); this.setState({ selectedTags: newTags }); }
fs.unlink(path.join(LOCAL_FILES, name), function(err) { var index = indexOfUploadFiles(name); if (index === -1 || !err || err.code === 'ENOENT') { if (index !== -1) { uploadFiles.splice(index, 1); } return callback(); } callback(err); });
var addFrame = function(frame) { framesList.push(frame); if (framesList.length > 600) { framesList.splice(0, 80); } }
router.delete('/users/:userId', (req, res) => { const userIndex = getUserIndex(req.params.userId) if (userIndex === -1) return res.status(404).json({}) users.splice(userIndex, 1) res.json(users) })
function clearHinder() { hinderArray.forEach(function(item, index) { if(item.shot) { if($('#' + item.id).css('left') == canvasW + 'px' || $('#' + item.id).css('left') == -item.width + 'px') { $('#' + item.id).remove() hinderArray.splice(index, 1) } } }) setTimeout(clearHinder, 1000) }
constructor(window) { this._window = window; this._info = JSON.parse(Buffer.from(window.paramsForReuse().data, 'base64').toString('utf8')); this._handles = []; this._window.on('close', () => this._handles.splice(0).forEach(handle => handle.dispose())); }
test('negative priority', async () => { delayCount = 0; const results = []; await Promise.all([ queue.executeInQueue('delay', '31', { delay: 400, result: '4' }, -10).then(r => results.push(r)), queue.executeInQueue('delay', '32', { delay: 100, result: '3' }, -9).then(r => results.push(r)), queue.executeInQueue('delay', '33', { delay: 100, result: '2' }, -8).then(r => results.push(r)), queue.executeInQueue('delay', '34', { delay: 100, result: '1' }, -7).then(r => results.push(r)) ]); results.splice(0, 1); expect(results.map(r => parseInt(r[0], 10) - parseInt(results[0][0], 10))).toEqual([0, 1, 2]); });
removeLanguage(locales) { if (Array.isArray(locales)) { locales.forEach((locale) => this.removeLanguage(locale)); } else { delete this.domainManagers[locales]; const index = this.locales.indexOf(locales); if (index !== -1) { this.locales.splice(index, 1); } } }
test('10. Deletes 2 super admin users (successfully)', async () => { const users = testData.otherSuperAdminUsers.splice(0, 2); const res = await rq({ url: `/admin/users/batch-delete`, method: 'POST', body: { ids: users.map(u => u.id), }, }); expect(res.statusCode).toBe(200); expect(res.body.data).toMatchObject(users); });
resetExcludedStep( stepName ) { const index = Flows.excludedSteps.indexOf( stepName ); if ( index > -1 ) { Flows.excludedSteps.splice( index, 1 ); } }
/** * Close a client socket * * @param {Socket} socket */ closeSocket(socket) { socket.destroy(); this.sockets.splice(this.sockets.indexOf(socket), 1); }
function delWindowId(tabId){ var windowId = getWindowId(tabId); if(windowId !== -1){ arrWindows.splice(windowId, 1); console.log('closeWindow: { id: '+ windowId + ' }'); } }
router.delete('/users/:userId', (req, res) => { const userIndex = getUserIndex(req.params.userId) if (userIndex === -1) return res.status(404).json({}) users.splice(userIndex, 1) res.json(users) })