mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-08-08 15:20:51 +00:00
vs-code server
This commit is contained in:
48
node_modules/pako/lib/utils/common.js
generated
vendored
Normal file
48
node_modules/pako/lib/utils/common.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
const _has = (obj, key) => {
|
||||
return Object.prototype.hasOwnProperty.call(obj, key);
|
||||
};
|
||||
|
||||
module.exports.assign = function (obj /*from1, from2, from3, ...*/) {
|
||||
const sources = Array.prototype.slice.call(arguments, 1);
|
||||
while (sources.length) {
|
||||
const source = sources.shift();
|
||||
if (!source) { continue; }
|
||||
|
||||
if (typeof source !== 'object') {
|
||||
throw new TypeError(source + 'must be non-object');
|
||||
}
|
||||
|
||||
for (const p in source) {
|
||||
if (_has(source, p)) {
|
||||
obj[p] = source[p];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
|
||||
// Join array of chunks to single array.
|
||||
module.exports.flattenChunks = (chunks) => {
|
||||
// calculate data length
|
||||
let len = 0;
|
||||
|
||||
for (let i = 0, l = chunks.length; i < l; i++) {
|
||||
len += chunks[i].length;
|
||||
}
|
||||
|
||||
// join chunks
|
||||
const result = new Uint8Array(len);
|
||||
|
||||
for (let i = 0, pos = 0, l = chunks.length; i < l; i++) {
|
||||
let chunk = chunks[i];
|
||||
result.set(chunk, pos);
|
||||
pos += chunk.length;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
Reference in New Issue
Block a user