1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/css-tree/lib/common/adopt-buffer.js

11 lines
364 B
JavaScript
Raw Normal View History

2023-12-18 13:12:25 +08:00
var MIN_SIZE = 16 * 1024;
var SafeUint32Array = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; // fallback on Array when TypedArray is not supported
module.exports = function adoptBuffer(buffer, size) {
if (buffer === null || buffer.length < size) {
return new SafeUint32Array(Math.max(size + 1024, MIN_SIZE));
}
return buffer;
};