mirror of
https://github.com/0x5eal/rbxts-pako.git
synced 2025-04-10 22:00:58 +01:00
Added package main file
This commit is contained in:
parent
5d14848c85
commit
2a73de5f69
2 changed files with 30 additions and 2 deletions
7
index.js
7
index.js
|
@ -1,7 +1,14 @@
|
||||||
|
// Top level file is just a mixin of submodules & constants
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
var assign = require('./lib/zlib/utils').assign;
|
||||||
|
|
||||||
|
var deflate = require('./lib/deflate');
|
||||||
|
var inflate = require('./lib/inflate');
|
||||||
|
var constants = require('./lib/zlib/constants');
|
||||||
|
|
||||||
var pako = {};
|
var pako = {};
|
||||||
|
|
||||||
|
assign(pako, deflate, inflate, constants);
|
||||||
|
|
||||||
module.exports = pako;
|
module.exports = pako;
|
|
@ -1,12 +1,33 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
exports.arraySet = function(dest, src, src_offs, len, dest_offs) {
|
exports.assign = function(obj /*from1, from2, from3, ...*/) {
|
||||||
|
var sources = Array.prototype.slice.call(arguments, 1);
|
||||||
|
while (sources.length) {
|
||||||
|
var source = sources.shift();
|
||||||
|
if (!source) { continue }
|
||||||
|
|
||||||
|
if (typeof(source) !== 'object') {
|
||||||
|
throw new TypeError(source + 'must be non-object');
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var p in source) {
|
||||||
|
if (source.hasOwnProperty(p)) {
|
||||||
|
obj[p] = source[p];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.arraySet = function(dest, src, src_offs, len, dest_offs) {
|
||||||
for(var i=0; i<len; i++) {
|
for(var i=0; i<len; i++) {
|
||||||
dest[dest_offs + i] = src[src_offs + i];
|
dest[dest_offs + i] = src[src_offs + i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.arrayCreate = function(length) {
|
exports.arrayCreate = function(length) {
|
||||||
return new Array(length);
|
return new Array(length);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue