source: imaps-frontend/node_modules/css-tree/lib/common/adopt-buffer.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • 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.