Son CV dans un terminal web en Javascript! https://terminal-cv.gregandev.fr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
terminal-cv/node_modules/@parcel/graph/test/integration/adjacency-list-shared-array.js

21 lines
581 B

require('@parcel/babel-register');
const {parentPort} = require('worker_threads');
const {
default: AdjacencyList,
NodeTypeMap,
EdgeTypeMap,
} = require('../../src/AdjacencyList');
parentPort.once('message', (serialized) => {
let graph = AdjacencyList.deserialize(serialized);
serialized.nodes.forEach((v, i) => {
if (i < NodeTypeMap.HEADER_SIZE) return;
serialized.nodes[i] = v * 2;
});
serialized.edges.forEach((v, i) => {
if (i < EdgeTypeMap.HEADER_SIZE) return;
serialized.edges[i] = v * 2;
});
parentPort.postMessage(graph.serialize());
});