memstreams
Version:
Memory Streams library for JavaScript based on readable-stream
22 lines • 803 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyMixins = exports.chunk2buf = exports.any2buf = void 0;
function any2buf(value, encoding) {
return Number.isInteger(value)
? Buffer.from([value])
: Buffer.from(value, encoding);
}
exports.any2buf = any2buf;
function chunk2buf(chunk, encoding) {
return typeof chunk === 'string' ? Buffer.from(chunk, encoding) : chunk;
}
exports.chunk2buf = chunk2buf;
function applyMixins(derive, bases) {
bases.forEach(base => {
Object.getOwnPropertyNames(base.prototype).forEach(name => {
Object.defineProperty(derive.prototype, name, Object.getOwnPropertyDescriptor(base.prototype, name));
});
});
}
exports.applyMixins = applyMixins;
//# sourceMappingURL=utils.js.map