Dev (#12)
* health check * Update Dockerfile * simplifying the deployment * Update Bot.js makes the find team command public * test (#9) * Dev (#7) * health check * Update Dockerfile * simplifying the deployment * Dev (#8) * health check * Update Dockerfile * simplifying the deployment * Update Bot.js makes the find team command public * Update PlayerService.js * massive update???? could break stuff * Update Bot.js update
This commit is contained in:
23
node_modules/magic-bytes.js/dist/model/tree.js
generated
vendored
23
node_modules/magic-bytes.js/dist/model/tree.js
generated
vendored
@@ -6,22 +6,19 @@ const createMatch = (leaf) => ({
|
||||
mime: leaf.info.mime,
|
||||
extension: leaf.info.extension,
|
||||
});
|
||||
const isMatchingNode = (tree, path) => tree && path.length === 0;
|
||||
const head = (arr) => arr[0];
|
||||
const tail = (arr) => arr.slice(1, arr.length);
|
||||
const isLeafNode = (tree, path) => tree && path.length === 0;
|
||||
const merge = (node, tree) => {
|
||||
if (node.bytes.length === 0)
|
||||
return tree;
|
||||
const currentByte = head(node.bytes); // 0
|
||||
const path = tail(node.bytes); // [1,2]
|
||||
const [currentByte, ...path] = node.bytes;
|
||||
const currentTree = tree.bytes[currentByte];
|
||||
// traversed to end. Just add key to leaf.
|
||||
if (isMatchingNode(currentTree, path)) {
|
||||
if (isLeafNode(currentTree, path)) {
|
||||
const matchingNode = tree.bytes[currentByte];
|
||||
tree.bytes[currentByte] = {
|
||||
...matchingNode,
|
||||
matches: [
|
||||
...(matchingNode.matches ? matchingNode.matches : []),
|
||||
...(matchingNode.matches ?? []),
|
||||
createMatch(node),
|
||||
],
|
||||
};
|
||||
@@ -30,14 +27,9 @@ const merge = (node, tree) => {
|
||||
// Path exists already, Merge subtree
|
||||
if (tree.bytes[currentByte]) {
|
||||
tree.bytes[currentByte] = exports.merge(exports.createNode(node.typename, path, node.info), tree.bytes[currentByte]);
|
||||
return tree;
|
||||
}
|
||||
// Tree did not exist before
|
||||
if (!tree.bytes[currentByte]) {
|
||||
tree.bytes[currentByte] = {
|
||||
...tree.bytes[currentByte],
|
||||
...exports.createComplexNode(node.typename, path, node.info),
|
||||
};
|
||||
else { // Tree did not exist before
|
||||
tree.bytes[currentByte] = exports.createComplexNode(node.typename, path, node.info);
|
||||
}
|
||||
return tree;
|
||||
};
|
||||
@@ -51,8 +43,7 @@ const createComplexNode = (typename, bytes, info) => {
|
||||
bytes: {},
|
||||
matches: undefined,
|
||||
};
|
||||
const currentKey = head(bytes); // 0
|
||||
const path = tail(bytes); // [1,2]
|
||||
const [currentKey, ...path] = bytes;
|
||||
if (bytes.length === 0) {
|
||||
return {
|
||||
matches: [
|
||||
|
||||
Reference in New Issue
Block a user