forked from olcxjas-softworks/LarpixClient
big updat:
- update dependencies - add webp support and webp conversion for profile images
This commit is contained in:
parent
19c3dbb42d
commit
95aaaa69ea
244 changed files with 121382 additions and 86 deletions
66
node_modules/js-binary-schema-parser/lib/index.js
generated
vendored
Normal file
66
node_modules/js-binary-schema-parser/lib/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.loop = exports.conditional = exports.parse = void 0;
|
||||
|
||||
var parse = function parse(stream, schema) {
|
||||
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
var parent = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : result;
|
||||
|
||||
if (Array.isArray(schema)) {
|
||||
schema.forEach(function (partSchema) {
|
||||
return parse(stream, partSchema, result, parent);
|
||||
});
|
||||
} else if (typeof schema === 'function') {
|
||||
schema(stream, result, parent, parse);
|
||||
} else {
|
||||
var key = Object.keys(schema)[0];
|
||||
|
||||
if (Array.isArray(schema[key])) {
|
||||
parent[key] = {};
|
||||
parse(stream, schema[key], result, parent[key]);
|
||||
} else {
|
||||
parent[key] = schema[key](stream, result, parent, parse);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
exports.parse = parse;
|
||||
|
||||
var conditional = function conditional(schema, conditionFunc) {
|
||||
return function (stream, result, parent, parse) {
|
||||
if (conditionFunc(stream, result, parent)) {
|
||||
parse(stream, schema, result, parent);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
exports.conditional = conditional;
|
||||
|
||||
var loop = function loop(schema, continueFunc) {
|
||||
return function (stream, result, parent, parse) {
|
||||
var arr = [];
|
||||
var lastStreamPos = stream.pos;
|
||||
|
||||
while (continueFunc(stream, result, parent)) {
|
||||
var newParent = {};
|
||||
parse(stream, schema, result, newParent); // cases when whole file is parsed but no termination is there and stream position is not getting updated as well
|
||||
// it falls into infinite recursion, null check to avoid the same
|
||||
|
||||
if (stream.pos === lastStreamPos) {
|
||||
break;
|
||||
}
|
||||
|
||||
lastStreamPos = stream.pos;
|
||||
arr.push(newParent);
|
||||
}
|
||||
|
||||
return arr;
|
||||
};
|
||||
};
|
||||
|
||||
exports.loop = loop;
|
||||
Loading…
Add table
Add a link
Reference in a new issue