Sha256: 5bf8978a3583ed2a0fd37636c2d342891a34aec44b76053daf56fb0945004a0a

Contents?: true

Size: 364 Bytes

Versions: 41

Compression:

Stored size: 364 Bytes

Contents

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;
};

Version data entries

41 entries across 31 versions & 9 rubygems

Version Path
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/css-tree/lib/common/adopt-buffer.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/css-tree/lib/common/adopt-buffer.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/csso/node_modules/css-tree/lib/common/adopt-buffer.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/csso/node_modules/css-tree/lib/common/adopt-buffer.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/css-tree/lib/common/adopt-buffer.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/csso/node_modules/css-tree/lib/common/adopt-buffer.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/css-tree/lib/common/adopt-buffer.js
tang-0.2.0 spec/tang_app/node_modules/css-tree/lib/common/adopt-buffer.js
tang-0.2.0 spec/tang_app/node_modules/csso/node_modules/css-tree/lib/common/adopt-buffer.js
tang-0.1.0 spec/tang_app/node_modules/csso/node_modules/css-tree/lib/common/adopt-buffer.js
tang-0.1.0 spec/tang_app/node_modules/css-tree/lib/common/adopt-buffer.js
tang-0.0.9 spec/tang_app/node_modules/css-tree/lib/common/adopt-buffer.js
tang-0.0.9 spec/tang_app/node_modules/csso/node_modules/css-tree/lib/common/adopt-buffer.js
enju_library-0.3.8 spec/dummy/node_modules/css-tree/lib/common/adopt-buffer.js
jester-data-8.0.0 node_modules/css-tree/lib/common/adopt-buffer.js
ezii-os-5.2.1 node_modules/css-tree/lib/common/adopt-buffer.js
ezii-os-2.0.1 node_modules/css-tree/lib/common/adopt-buffer.js
ezii-os-1.1.0 node_modules/css-tree/lib/common/adopt-buffer.js
ezii-os-1.0.0 node_modules/css-tree/lib/common/adopt-buffer.js
ezii-os-0.0.0.1.0 node_modules/css-tree/lib/common/adopt-buffer.js