队列一个简单但正式的javascript队列。这是对的正式更新,主要是因为我需要一个不能被猴子修补的。用var Q = require ( 'queue' ) ; var q = new Q ( ) ; // obviously empty... if ( q . isEmpty ) { console . log ( 'oopsy, nobody home' ) ; } // it has a length... if ( q . length === 0 ) { console . log ( 'still, nobody home' ) ; } // we can enqueue... q . enqueue ( 'Phillip' ) ; // we can peek... if ( q . peek ( ) ) { console . log ( ''