aboutsummaryrefslogtreecommitdiffstats
path: root/vanilla/node_modules/css-tree/lib/tokenizer/adopt-buffer.js
blob: ab4566dadf3259dca2eea4cf7455317d48a70b6b (plain) (blame)
1
2
3
4
5
6
7
8
9
const MIN_SIZE = 16 * 1024;

export function adoptBuffer(buffer = null, size) {
    if (buffer === null || buffer.length < size) {
        return new Uint32Array(Math.max(size + 1024, MIN_SIZE));
    }

    return buffer;
};