UNPKG

mathjs

Version:

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif

23 lines (19 loc) 398 B
/* MIT License http://www.opensource.org/licenses/mit-license.php */ "use strict"; class ArraySerializer { serialize(array, { write }) { write(array.length); for (const item of array) write(item); } deserialize({ read }) { const length = read(); const array = []; for (let i = 0; i < length; i++) { array.push(read()); } return array; } } module.exports = ArraySerializer;