(n, list, hasStrings)
| 5702 | // This function is designed to be inlinable, so please take care when making |
| 5703 | // changes to the function body. |
| 5704 | function fromListPartial(n, list, hasStrings) { |
| 5705 | var ret; |
| 5706 | if (n < list.head.data.length) { |
| 5707 | // slice is the same for buffers and strings |
| 5708 | ret = list.head.data.slice(0, n); |
| 5709 | list.head.data = list.head.data.slice(n); |
| 5710 | } else if (n === list.head.data.length) { |
| 5711 | // first chunk is a perfect match |
| 5712 | ret = list.shift(); |
| 5713 | } else { |
| 5714 | // result spans more than one buffer |
| 5715 | ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); |
| 5716 | } |
| 5717 | return ret; |
| 5718 | } |
| 5719 | |
| 5720 | // Copies a specified amount of characters from the list of buffered data |
| 5721 | // chunks. |
no test coverage detected