(n, list, hasStrings)
| 24982 | // This function is designed to be inlinable, so please take care when making |
| 24983 | // changes to the function body. |
| 24984 | function fromListPartial(n, list, hasStrings) { |
| 24985 | var ret; |
| 24986 | if (n < list.head.data.length) { |
| 24987 | // slice is the same for buffers and strings |
| 24988 | ret = list.head.data.slice(0, n); |
| 24989 | list.head.data = list.head.data.slice(n); |
| 24990 | } else if (n === list.head.data.length) { |
| 24991 | // first chunk is a perfect match |
| 24992 | ret = list.shift(); |
| 24993 | } else { |
| 24994 | // result spans more than one buffer |
| 24995 | ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); |
| 24996 | } |
| 24997 | return ret; |
| 24998 | } |
| 24999 | |
| 25000 | // Copies a specified amount of characters from the list of buffered data |
| 25001 | // chunks. |
no test coverage detected