source: trip-planner-front/node_modules/css-tree/lib/common/adopt-buffer.js@ 8d391a1

Last change on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 364 bytes
Line 
1var MIN_SIZE = 16 * 1024;
2var SafeUint32Array = typeof Uint32Array !== 'undefined' ? Uint32Array : Array; // fallback on Array when TypedArray is not supported
3
4module.exports = function adoptBuffer(buffer, size) {
5 if (buffer === null || buffer.length < size) {
6 return new SafeUint32Array(Math.max(size + 1024, MIN_SIZE));
7 }
8
9 return buffer;
10};
Note: See TracBrowser for help on using the repository browser.