mirror of
https://github.com/musix-org/musix-oss
synced 2025-06-17 04:26:00 +00:00
Modules
This commit is contained in:
3
node_modules/@protobufjs/pool/.npmignore
generated
vendored
Normal file
3
node_modules/@protobufjs/pool/.npmignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
npm-debug.*
|
||||
node_modules/
|
||||
coverage/
|
26
node_modules/@protobufjs/pool/LICENSE
generated
vendored
Normal file
26
node_modules/@protobufjs/pool/LICENSE
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
Copyright (c) 2016, Daniel Wirtz All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of its author, nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
13
node_modules/@protobufjs/pool/README.md
generated
vendored
Normal file
13
node_modules/@protobufjs/pool/README.md
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
@protobufjs/pool
|
||||
================
|
||||
[](https://www.npmjs.com/package/@protobufjs/pool)
|
||||
|
||||
A general purpose buffer pool.
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
* **pool(alloc: `function(size: number): Uint8Array`, slice: `function(this: Uint8Array, start: number, end: number): Uint8Array`, [size=8192: `number`]): `function(size: number): Uint8Array`**<br />
|
||||
Creates a pooled allocator.
|
||||
|
||||
**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
|
32
node_modules/@protobufjs/pool/index.d.ts
generated
vendored
Normal file
32
node_modules/@protobufjs/pool/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
export = pool;
|
||||
|
||||
/**
|
||||
* An allocator as used by {@link util.pool}.
|
||||
* @typedef PoolAllocator
|
||||
* @type {function}
|
||||
* @param {number} size Buffer size
|
||||
* @returns {Uint8Array} Buffer
|
||||
*/
|
||||
type PoolAllocator = (size: number) => Uint8Array;
|
||||
|
||||
/**
|
||||
* A slicer as used by {@link util.pool}.
|
||||
* @typedef PoolSlicer
|
||||
* @type {function}
|
||||
* @param {number} start Start offset
|
||||
* @param {number} end End offset
|
||||
* @returns {Uint8Array} Buffer slice
|
||||
* @this {Uint8Array}
|
||||
*/
|
||||
type PoolSlicer = (this: Uint8Array, start: number, end: number) => Uint8Array;
|
||||
|
||||
/**
|
||||
* A general purpose buffer pool.
|
||||
* @memberof util
|
||||
* @function
|
||||
* @param {PoolAllocator} alloc Allocator
|
||||
* @param {PoolSlicer} slice Slicer
|
||||
* @param {number} [size=8192] Slab size
|
||||
* @returns {PoolAllocator} Pooled allocator
|
||||
*/
|
||||
declare function pool(alloc: PoolAllocator, slice: PoolSlicer, size?: number): PoolAllocator;
|
48
node_modules/@protobufjs/pool/index.js
generated
vendored
Normal file
48
node_modules/@protobufjs/pool/index.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
module.exports = pool;
|
||||
|
||||
/**
|
||||
* An allocator as used by {@link util.pool}.
|
||||
* @typedef PoolAllocator
|
||||
* @type {function}
|
||||
* @param {number} size Buffer size
|
||||
* @returns {Uint8Array} Buffer
|
||||
*/
|
||||
|
||||
/**
|
||||
* A slicer as used by {@link util.pool}.
|
||||
* @typedef PoolSlicer
|
||||
* @type {function}
|
||||
* @param {number} start Start offset
|
||||
* @param {number} end End offset
|
||||
* @returns {Uint8Array} Buffer slice
|
||||
* @this {Uint8Array}
|
||||
*/
|
||||
|
||||
/**
|
||||
* A general purpose buffer pool.
|
||||
* @memberof util
|
||||
* @function
|
||||
* @param {PoolAllocator} alloc Allocator
|
||||
* @param {PoolSlicer} slice Slicer
|
||||
* @param {number} [size=8192] Slab size
|
||||
* @returns {PoolAllocator} Pooled allocator
|
||||
*/
|
||||
function pool(alloc, slice, size) {
|
||||
var SIZE = size || 8192;
|
||||
var MAX = SIZE >>> 1;
|
||||
var slab = null;
|
||||
var offset = SIZE;
|
||||
return function pool_alloc(size) {
|
||||
if (size < 1 || size > MAX)
|
||||
return alloc(size);
|
||||
if (offset + size > SIZE) {
|
||||
slab = alloc(SIZE);
|
||||
offset = 0;
|
||||
}
|
||||
var buf = slice.call(slab, offset, offset += size);
|
||||
if (offset & 7) // align to 32 bit
|
||||
offset = (offset | 7) + 1;
|
||||
return buf;
|
||||
};
|
||||
}
|
57
node_modules/@protobufjs/pool/package.json
generated
vendored
Normal file
57
node_modules/@protobufjs/pool/package.json
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@protobufjs/pool@1.1.0",
|
||||
"C:\\Users\\matia\\Musix"
|
||||
]
|
||||
],
|
||||
"_from": "@protobufjs/pool@1.1.0",
|
||||
"_id": "@protobufjs/pool@1.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=",
|
||||
"_location": "/@protobufjs/pool",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@protobufjs/pool@1.1.0",
|
||||
"name": "@protobufjs/pool",
|
||||
"escapedName": "@protobufjs%2fpool",
|
||||
"scope": "@protobufjs",
|
||||
"rawSpec": "1.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/protobufjs"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
|
||||
"_spec": "1.1.0",
|
||||
"_where": "C:\\Users\\matia\\Musix",
|
||||
"author": {
|
||||
"name": "Daniel Wirtz",
|
||||
"email": "dcode+protobufjs@dcode.io"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/dcodeIO/protobuf.js/issues"
|
||||
},
|
||||
"description": "A general purpose buffer pool.",
|
||||
"devDependencies": {
|
||||
"istanbul": "^0.4.5",
|
||||
"tape": "^4.6.3"
|
||||
},
|
||||
"homepage": "https://github.com/dcodeIO/protobuf.js#readme",
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "index.js",
|
||||
"name": "@protobufjs/pool",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/dcodeIO/protobuf.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js",
|
||||
"test": "tape tests/*.js"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "1.1.0"
|
||||
}
|
33
node_modules/@protobufjs/pool/tests/index.js
generated
vendored
Normal file
33
node_modules/@protobufjs/pool/tests/index.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
var tape = require("tape");
|
||||
|
||||
var pool = require("..");
|
||||
|
||||
if (typeof Uint8Array !== "undefined")
|
||||
tape.test("pool", function(test) {
|
||||
|
||||
var alloc = pool(function(size) { return new Uint8Array(size); }, Uint8Array.prototype.subarray);
|
||||
|
||||
var buf1 = alloc(0);
|
||||
test.equal(buf1.length, 0, "should allocate a buffer of size 0");
|
||||
|
||||
var buf2 = alloc(1);
|
||||
test.equal(buf2.length, 1, "should allocate a buffer of size 1 (initializes slab)");
|
||||
|
||||
test.notEqual(buf2.buffer, buf1.buffer, "should not reference the same backing buffer if previous buffer had size 0");
|
||||
test.equal(buf2.byteOffset, 0, "should allocate at byteOffset 0 when using a new slab");
|
||||
|
||||
buf1 = alloc(1);
|
||||
test.equal(buf1.buffer, buf2.buffer, "should reference the same backing buffer when allocating a chunk fitting into the slab");
|
||||
test.equal(buf1.byteOffset, 8, "should align slices to 32 bit and this allocate at byteOffset 8");
|
||||
|
||||
var buf3 = alloc(4097);
|
||||
test.notEqual(buf3.buffer, buf2.buffer, "should not reference the same backing buffer when allocating a buffer larger than half the backing buffer's size");
|
||||
|
||||
buf2 = alloc(4096);
|
||||
test.equal(buf2.buffer, buf1.buffer, "should reference the same backing buffer when allocating a buffer smaller or equal than half the backing buffer's size");
|
||||
|
||||
buf1 = alloc(4096);
|
||||
test.notEqual(buf1.buffer, buf2.buffer, "should not reference the same backing buffer when the slab is exhausted (initializes new slab)");
|
||||
|
||||
test.end();
|
||||
});
|
Reference in New Issue
Block a user