(n, state)
| 6961 | // This function is designed to be inlinable, so please take care when making |
| 6962 | // changes to the function body. |
| 6963 | function fromList(n, state) { |
| 6964 | // nothing buffered |
| 6965 | if (state.length === 0) return null; |
| 6966 | |
| 6967 | var ret; |
| 6968 | if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { |
| 6969 | // read it all, truncate the list |
| 6970 | if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); |
| 6971 | state.buffer.clear(); |
| 6972 | } else { |
| 6973 | // read part of list |
| 6974 | ret = fromListPartial(n, state.buffer, state.decoder); |
| 6975 | } |
| 6976 | |
| 6977 | return ret; |
| 6978 | } |
| 6979 | |
| 6980 | // Extracts only enough buffered data to satisfy the amount requested. |
| 6981 | // This function is designed to be inlinable, so please take care when making |
no test coverage detected