function getNextVertexInPool() { if ( _vertexCount === _vertexPoolLength ) { var vertex = new THREE.RenderableVertex(); _vertexPool.push( vertex ); _vertexPoolLength ++; _vertexCount ++; return vertex; } return _vertexPool[ _vertexCount ++ ]; }
// Defines function generateDefines ( defines ) { var value, chunk, chunks = []; for ( var d in defines ) { value = defines[ d ]; if ( value === false ) continue; chunk = "#define " + d + " " + value; chunks.push( chunk ); } return chunks.join( "\n" ); }
export default function getBufferFromStream(stream) { return new Promise(resolve => { const chunks = []; stream.on('data', chunk => { chunks.push(chunk); }); stream.on('end', () => { resolve(Buffer.concat(chunks)); }); }); }
function generateRecordingName(context) { const { currentTest } = context; const parts = [currentTest.title]; let parent = currentTest.parent; while (parent && parent.title) { parts.push(parent.title); parent = parent.parent; } return parts.reverse().join('/'); }
it('.emit()', async function() { expect(emitter.emit('a')).to.be.a('promise'); const array = []; emitter.on('a', () => array.push(1)); emitter.on('a', async () => { await timeout(10); array.push(2); }); emitter.on('a', () => array.push(3)); expect(await emitter.emit('a')).to.be.true; expect(array).to.have.ordered.members([1, 2, 3]); });
_orderedHandlers() { return [...this.middleware, this].reduce((handlers, route) => { handlers.push(...route.handlers.map(handler => ({ route, handler }))); return handlers; }, []); }
users.forEach(user => { userOptions.push({ label: user.firstname, value: user.selector }); });
function captureRequests(server) { const reqs = []; server.any().on('request', req => reqs.push(req)); return reqs; }
function getNextFaceInPool() { if ( _faceCount === _facePoolLength ) { var face = new THREE.RenderableFace(); _facePool.push( face ); _facePoolLength ++; _faceCount ++; return face; } return _facePool[ _faceCount ++ ]; }
// Pools function getNextObjectInPool() { if ( _objectCount === _objectPoolLength ) { var object = new THREE.RenderableObject(); _objectPool.push( object ); _objectPoolLength ++; _objectCount ++; return object; } return _objectPool[ _objectCount ++ ]; }
function getNextLineInPool() { if ( _lineCount === _linePoolLength ) { var line = new THREE.RenderableLine(); _linePool.push( line ); _linePoolLength ++; _lineCount ++ return line; } return _linePool[ _lineCount ++ ]; }
function getNextVertexInPool() { if ( _vertexCount === _vertexPoolLength ) { var vertex = new THREE.RenderableVertex(); _vertexPool.push( vertex ); _vertexPoolLength ++; _vertexCount ++; return vertex; } return _vertexPool[ _vertexCount ++ ]; }
function getNextFaceInPool() { if ( _faceCount === _facePoolLength ) { var face = new THREE.RenderableFace(); _facePool.push( face ); _facePoolLength ++; _faceCount ++; return face; } return _facePool[ _faceCount ++ ]; }