This commit is contained in:
dela
2026-02-21 18:27:49 +08:00
parent 0ac4b23f07
commit 5dc86ccfbf
270 changed files with 49508 additions and 4636 deletions

41
node_modules/msgpack-lite/lib/bufferish-array.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
// bufferish-array.js
var Bufferish = require("./bufferish");
var exports = module.exports = alloc(0);
exports.alloc = alloc;
exports.concat = Bufferish.concat;
exports.from = from;
/**
* @param size {Number}
* @returns {Buffer|Uint8Array|Array}
*/
function alloc(size) {
return new Array(size);
}
/**
* @param value {Array|ArrayBuffer|Buffer|String}
* @returns {Array}
*/
function from(value) {
if (!Bufferish.isBuffer(value) && Bufferish.isView(value)) {
// TypedArray to Uint8Array
value = Bufferish.Uint8Array.from(value);
} else if (Bufferish.isArrayBuffer(value)) {
// ArrayBuffer to Uint8Array
value = new Uint8Array(value);
} else if (typeof value === "string") {
// String to Array
return Bufferish.from.call(exports, value);
} else if (typeof value === "number") {
throw new TypeError('"value" argument must not be a number');
}
// Array-like to Array
return Array.prototype.slice.call(value);
}