Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@etclabscore/eserialize

Package Overview
Dependencies
Maintainers
4
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@etclabscore/eserialize

This goal if this module is to provide easy functions to serialize and deserialize data for the Ethereum Stack.

latest
npmnpm
Version
1.1.2
Version published
Weekly downloads
64
8.47%
Maintainers
4
Weekly downloads
 
Created
Source

eserialize

This goal of this module is to provide easy functions to serialize and deserialize data for the Ethereum Stack.

Usage

npm install @etclabscore/eserialize --save

Examples

Serialize

import { stringToHex, dateToHex, numberToHex } from "@etclabscore/eserialize";

stringToHex("foo");
// "0x666F6F"

dateToHex(new Date("2019-09-28T22:47:08.000Z"));
// "0x5d8fe2ec"

numberToHex(0);
// "0x0"

Deserialize

import { hexToString, hexToDate, hexToNumber } from "@etclabscore/eserialize";

hexToString("0x666F6F");
// "foo"

hexToDate("0x5d8fe2ec").toISOString();
// "2019-09-28T22:47:08.000Z"

hexToNumber("0x0");
// 0

hexToNumber("0x1");
// 1

hexToNumber("0x878328");
// 8880936

Contributing

How to contribute, build and release are outlined in CONTRIBUTING.md, BUILDING.md and RELEASING.md respectively. Commits in this repository follow the CONVENTIONAL_COMMITS.md specification.

FAQs

Package last updated on 13 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts