|
5 | 5 | [](https://coveralls.io/r/ethereumjs/ethereumjs-util)
|
6 | 6 | [](https://gitter.im/ethereum/ethereumjs-lib) or #ethereumjs on freenode
|
7 | 7 |
|
8 |
| -A collection of utility functions for ethereum. It can be used in node.js or can be in the browser with browserify. |
| 8 | +A collection of utility functions for Ethereum. It can be used in Node.js and in the browser with [browserify](http://browserify.org/). |
| 9 | + |
| 10 | +# INSTALL |
| 11 | + |
| 12 | +`npm install ethereumjs-util` |
| 13 | + |
| 14 | +# USAGE |
| 15 | + |
| 16 | +```js |
| 17 | +import assert from 'assert' |
| 18 | +import { isValidChecksumAddress, unpad, BN } from 'ethereumjs-util' |
| 19 | + |
| 20 | +const address = '0x2F015C60E0be116B1f0CD534704Db9c92118FB6A' |
| 21 | +assert.ok(isValidChecksumAddress(address)) |
| 22 | + |
| 23 | +assert.equal(unpad('0000000006600'), '6600') |
| 24 | + |
| 25 | +assert.equal(new BN('dead', 16).add(new BN('101010', 2)), 57047) |
| 26 | +``` |
9 | 27 |
|
10 | 28 | # API
|
11 | 29 |
|
12 |
| -[./docs/](./docs/README.md) |
| 30 | +## Documentation |
| 31 | + |
| 32 | +### Modules |
| 33 | + |
| 34 | +- [account](docs/modules/_account_.md) |
| 35 | + - Private/public key and address-related functionality (creation, validation, conversion) |
| 36 | +- [bytes](docs/modules/_bytes_.md) |
| 37 | + - Byte-related helper and conversion functions |
| 38 | +- [constants](docs/modules/_constants_.md) |
| 39 | + - Exposed constants |
| 40 | + - e.g. KECCAK256_NULL_S for string representation of Keccak-256 hash of null |
| 41 | +- [hash](docs/modules/_hash_.md) |
| 42 | + - Hash functions |
| 43 | +- [object](docs/modules/_object_.md) |
| 44 | + - Helper function for creating a binary object (`DEPRECATED`) |
| 45 | +- [signature](docs/modules/_signature_.md) |
| 46 | + - Signing, signature validation, conversion, recovery |
| 47 | +- [externals](docs/modules/_externals_.md) |
| 48 | + - Helper methods from `ethjs-util` |
| 49 | + - Re-exports of `BN`, `rlp`, `secp256k1` |
| 50 | + |
| 51 | +### ethjs-util methods |
| 52 | + |
| 53 | +The following methods are available provided by [ethjs-util](https://github.com/ethjs/ethjs-util): |
13 | 54 |
|
14 |
| -Most of the string manipulation methods are provided by [ethjs-util](https://github.com/ethjs/ethjs-util) |
| 55 | +- arrayContainsArray |
| 56 | +- toBuffer |
| 57 | +- getBinarySize |
| 58 | +- stripHexPrefix |
| 59 | +- isHexPrefixed |
| 60 | +- isHexString |
| 61 | +- padToEven |
| 62 | +- intToHex |
| 63 | +- fromAscii |
| 64 | +- fromUtf8 |
| 65 | +- toUtf8 |
| 66 | +- toAscii |
| 67 | +- getKeys |
15 | 68 |
|
16 |
| ---- |
| 69 | +### Re-Exports |
17 | 70 |
|
18 |
| -Additionally ethereumjs-util re-exports a few commonly-used libraries. These include: |
| 71 | +Additionally `ethereumjs-util` re-exports a few commonly-used libraries. These include: |
19 | 72 |
|
20 | 73 | - `BN` ([bn.js](https://github.com/indutny/bn.js))
|
21 | 74 | - `rlp` ([rlp](https://github.com/ethereumjs/rlp))
|
|
0 commit comments