(n, list, hasStrings)
| 6981 | // This function is designed to be inlinable, so please take care when making |
| 6982 | // changes to the function body. |
| 6983 | function fromListPartial(n, list, hasStrings) { |
| 6984 | var ret; |
| 6985 | if (n < list.head.data.length) { |
| 6986 | // slice is the same for buffers and strings |
| 6987 | ret = list.head.data.slice(0, n); |
| 6988 | list.head.data = list.head.data.slice(n); |
| 6989 | } else if (n === list.head.data.length) { |
| 6990 | // first chunk is a perfect match |
| 6991 | ret = list.shift(); |
| 6992 | } else { |
| 6993 | // result spans more than one buffer |
| 6994 | ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); |
| 6995 | } |
| 6996 | return ret; |
| 6997 | } |
| 6998 | |
| 6999 | // Copies a specified amount of characters from the list of buffered data |
| 7000 | // chunks. |
no test coverage detected