Projekt

Obecné

Profil

Stáhnout (498 Bajtů) Statistiky
| Větev: | Revize:
1
module.exports = shift
2

    
3
function shift (stream) {
4
  var rs = stream._readableState
5
  if (!rs) return null
6
  return (rs.objectMode || typeof stream._duplexState === 'number') ? stream.read() : stream.read(getStateLength(rs))
7
}
8

    
9
function getStateLength (state) {
10
  if (state.buffer.length) {
11
    // Since node 6.3.0 state.buffer is a BufferList not an array
12
    if (state.buffer.head) {
13
      return state.buffer.head.data.length
14
    }
15

    
16
    return state.buffer[0].length
17
  }
18

    
19
  return state.length
20
}
(4-4/6)