Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Commit

Permalink
update readme with examples and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanio committed Feb 5, 2020
1 parent ae4c300 commit a18f0bc
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 9 deletions.
54 changes: 49 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,61 @@
[![Coverage Status](https://img.shields.io/coveralls/ethereumjs/ethereumjs-util.svg?style=flat-square)](https://coveralls.io/r/ethereumjs/ethereumjs-util)
[![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs-lib.svg?style=flat-square)](https://gitter.im/ethereum/ethereumjs-lib) or #ethereumjs on freenode

A collection of utility functions for ethereum. It can be used in node.js or can be in the browser with browserify.
A collection of utility functions for Ethereum. It can be used in Node.js and in the browser with [browserify](http://browserify.org/).

# INSTALL

`npm install ethereumjs-util`

# USAGE

```js
import assert from 'assert'
import { isValidChecksumAddress, unpad, BN } from 'ethereumjs-util'

const address = '0x2F015C60E0be116B1f0CD534704Db9c92118FB6A'
assert.ok(isValidChecksumAddress(address))

assert.equal(unpad('0000000006600'), '6600')

assert.equal(new BN('dead', 16).add(new BN('101010', 2)), 57047)
```

# API

[./docs/](./docs/README.md)
## Documentation

### Modules

- [account](docs/modules/_account_.md)
- [bytes](docs/modules/_bytes_.md)
- [constants](docs/modules/_constants_.md)
- [hash](docs/modules/_hash_.md)
- [object](docs/modules/_object_.md)
- [signature](docs/modules/_signature_.md)
- [externals](docs/modules/_externals_.md)

### ethjs-util methods

The following methods are available, provided by [ethjs-util](https://github.com/ethjs/ethjs-util):

Most of the string manipulation methods are provided by [ethjs-util](https://github.com/ethjs/ethjs-util)
- arrayContainsArray
- toBuffer
- getBinarySize
- stripHexPrefix
- isHexPrefixed
- isHexString
- padToEven
- intToHex
- fromAscii
- fromUtf8
- toUtf8
- toAscii
- getKeys

---
### Re-Exports

Additionally ethereumjs-util re-exports a few commonly-used libraries. These include:
Additionally `ethereumjs-util` re-exports a few commonly-used libraries. These include:

- `BN` ([bn.js](https://github.com/indutny/bn.js))
- `rlp` ([rlp](https://github.com/ethereumjs/rlp))
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/_externals_.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# Module: "externals"

Re-exports commonly used modules:
* Adds [`ethjsUtil`](https://github.com/ethjs/ethjs-util) methods.
* Exports [`BN`](https://github.com/indutny/bn.js), [`rlp`](https://github.com/ethereumjs/rlp), [`secp256k1`](https://github.com/cryptocoinjs/secp256k1-node/)`.
* Adds [`ethjs-util`](https://github.com/ethjs/ethjs-util) methods.
* Exports [`BN`](https://github.com/indutny/bn.js), [`rlp`](https://github.com/ethereumjs/rlp), [`secp256k1`](https://github.com/cryptocoinjs/secp256k1-node/).
4 changes: 2 additions & 2 deletions src/externals.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Re-exports commonly used modules:
* * Adds [`ethjsUtil`](https://github.com/ethjs/ethjs-util) methods.
* * Exports [`BN`](https://github.com/indutny/bn.js), [`rlp`](https://github.com/ethereumjs/rlp), [`secp256k1`](https://github.com/cryptocoinjs/secp256k1-node/)`.
* * Adds [`ethjs-util`](https://github.com/ethjs/ethjs-util) methods.
* * Exports [`BN`](https://github.com/indutny/bn.js), [`rlp`](https://github.com/ethereumjs/rlp), [`secp256k1`](https://github.com/cryptocoinjs/secp256k1-node/).
* @packageDocumentation
*/

Expand Down

0 comments on commit a18f0bc

Please sign in to comment.