You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 498B

1234567891011121314151617181920
  1. module.exports = shift
  2. function shift (stream) {
  3. var rs = stream._readableState
  4. if (!rs) return null
  5. return (rs.objectMode || typeof stream._duplexState === 'number') ? stream.read() : stream.read(getStateLength(rs))
  6. }
  7. function getStateLength (state) {
  8. if (state.buffer.length) {
  9. // Since node 6.3.0 state.buffer is a BufferList not an array
  10. if (state.buffer.head) {
  11. return state.buffer.head.data.length
  12. }
  13. return state.buffer[0].length
  14. }
  15. return state.length
  16. }