1.5.3 • Published 6 years ago

ssz v1.5.3

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

ssz-js

Simple Serialize (SSZ) in pure Javascript

Install:

$ npm install ssz

Install mocha globally:

$ npm install -g mocha

Run tests:

$ npm test

Usage

Table of Contents

serialize

src/index.js:13-116

Simply Serializes (SSZ)

Parameters

  • value (Buffer | array | number | object) Value to serialize: hash32 (Buffer) | address (Buffer) | int8/16/32 | bytes (Buffer) | array | object
  • type (string | object) A type string ('hash32', 'address', 'int8', 'int16', 'int32', 'bytes', 'bool', 'hash96', 'hash97'), or type array 'hash32', or type object containing fields property

Returns Buffer the byte output

deserialize

src/index.js:125-252

Simply Deserializes (SSZ)

Parameters

  • data Buffer bytes (buffer) to deserialize
  • type (string | object) A type string ('hash32', 'address', 'int8', 'int16', 'int32', 'bytes', 'bool', 'hash96', 'hash97'), 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

eq

src/index.js:261-265

Checks if 2 simply serialized objects are equal (SSZ)

Parameters

  • x Buffer simply serialized object
  • y Buffer simply serialized object

Returns Bool the byte output

deepcopy

src/index.js:273-276

Returns a deep copy of a simply serialized object (SSZ)

Parameters

Returns Buffer the deep copy of x

Contributors

Very special thank you to Darren Langley for helping build this.

1.5.3

6 years ago

1.5.2

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

0.5.0

6 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago