Simple Serialize in pure Javascript (SSZ)
TEST BRANCH
Install:
$ npm install sszInstall mocha globally:
$ npm install -g mochaRun tests:
$ npm testSimply Serializes (SSZ)
value(Buffer | array | number | object) Value to serialize: hash32 (Buffer) | address (Buffer) | int8/16/32 | bytes (Buffer) | array | objecttype(string | object) A type string ('hash32', 'address', 'int8', 'int16', 'int32', 'bytes'), or type array ['hash32'], or type object containing fields property
Returns Buffer the byte output
Simply Deserializes (SSZ)
dataBuffer bytes (buffer) to deserializetype(string | object) A type string ('hash32', 'address', 'int8', 'int16', 'int32', 'bytes'), or type array ['hash32'], or type object containing fields property
Returns (Buffer | array | number | object) deserialized value : hash32 (Buffer) | address (Buffer) | int8/16/32/64/256 | uint8/16/32/64/256 | bytes (Buffer) | array | object
Checks if 2 simply serialized objects are equal (SSZ)
Returns Bool the byte output
Returns a deep copy of a simply serialized object (SSZ)
xBuffer Value to deep copy
Returns Buffer the deep copy of x
Very special thank you to Darren Langley for helping build this.