Skip to content
This repository has been archived by the owner on Jan 11, 2022. It is now read-only.

Commit

Permalink
Merge a747c77 into d1272cc
Browse files Browse the repository at this point in the history
  • Loading branch information
krzkaczor committed Nov 13, 2018
2 parents d1272cc + a747c77 commit a11af88
Show file tree
Hide file tree
Showing 10 changed files with 346 additions and 289 deletions.
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.vscode
package.json
dist
.nyc_output
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"tabWidth": 2,
"semi": false,
"singleQuote": true,
"trailingComma": "all"
}
25 changes: 16 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
(modification: no type change headlines) and this project adheres to
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
(modification: no type change headlines) and this project adheres to
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).


## [v2.1.0] - 2018-06-28

- Updated supported Node versions, PR [#13](https://github.com/ethereumjs/rlp/pull/13)
- Switched to ``safe-buffer`` for backwards compatibility, PR [#18](https://github.com/ethereumjs/rlp/pull/18)
- Switched to `safe-buffer` for backwards compatibility, PR [#18](https://github.com/ethereumjs/rlp/pull/18)
- Increased test coverage, PR [#22](https://github.com/ethereumjs/rlp/pull/22)
- Example code tweaks, PR [#12](https://github.com/ethereumjs/rlp/pull/12)
- Fix test runs on Windows, Issue [#7](https://github.com/ethereumjs/rlp/issues/7)
Expand All @@ -17,33 +18,39 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
[v2.1.0]: https://github.com/ethereumjs/rlp/compare/2.0.0...v2.1.0

## [2.0.0] - 2015-09-23
- User ``Buffer`` values as input for encoding

- User `Buffer` values as input for encoding

[2.0.0]: https://github.com/ethereumjs/rlp/compare/1.1.2...2.0.0

## [1.1.2] - 2015-09-22

- Fix zero encoding

[1.1.2]: https://github.com/ethereumjs/rlp/compare/1.1.1...1.1.2

## [1.1.1] - 2015-09-21
- Fixes for ``bin``

- Fixes for `bin`

[1.1.1]: https://github.com/ethereumjs/rlp/compare/1.1.0...1.1.1

## [1.1.0] - 2015-09-21
- Added ``getLength()`` method
- Added hex prefix stripping (``isHexPrefix()`` / ``stripHexPrefix()``)

- Added `getLength()` method
- Added hex prefix stripping (`isHexPrefix()` / `stripHexPrefix()`)
- Code formatting clean-ups

[1.1.0]: https://github.com/ethereumjs/rlp/compare/1.0.1...1.1.0

## [1.0.1] - 2015-06-27

- Code formatting clean-ups

[1.0.1]: https://github.com/ethereumjs/rlp/compare/1.0.0...1.0.1

## [1.0.0] - 2015-06-06

- Added check for invalid 0
- Hardened rlp

Expand All @@ -53,4 +60,4 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

- [0.0.14](https://github.com/ethereumjs/rlp/compare/0.0.13...0.0.14) - 2015-03-31
- [0.0.13](https://github.com/ethereumjs/rlp/compare/0.0.12...0.0.13) - 2015-03-30
- [0.0.12](https://github.com/ethereumjs/rlp/compare/0.0.11...0.0.12) - 2014-12-26
- [0.0.12](https://github.com/ethereumjs/rlp/compare/0.0.11...0.0.12) - 2014-12-26
50 changes: 23 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,49 @@
SYNOPSIS
=====
# SYNOPSIS

[![NPM Package](https://img.shields.io/npm/v/rlp.svg?style=flat-square)](https://www.npmjs.org/package/rlp)
[![Build Status](https://img.shields.io/travis/ethereumjs/rlp.svg?branch=master&style=flat-square)](https://travis-ci.org/ethereumjs/rlp)
[![Coverage Status](https://img.shields.io/coveralls/ethereumjs/rlp.svg?style=flat-square)](https://coveralls.io/r/ethereumjs/rlp)
[![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs-lib.svg?style=flat-square)](https://gitter.im/ethereum/ethereumjs-lib) or #ethereumjs on freenode

[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)


[Recursive Length](https://github.com/ethereum/wiki/wiki/RLP) Prefix Encoding for node.js.

INSTALL
======
`npm install rlp`
# INSTALL

`npm install rlp`

install with `-g` if you want to use the cli.

USAGE
=======
# USAGE

```javascript
var RLP = require('rlp');
var assert = require('assert');

var nestedList = [ [], [[]], [ [], [[]] ] ];
var encoded = RLP.encode(nestedList);
var decoded = RLP.decode(encoded);
assert.deepEqual(nestedList, decoded);

var RLP = require('rlp')
var assert = require('assert')

var nestedList = [[], [[]], [[], [[]]]]
var encoded = RLP.encode(nestedList)
var decoded = RLP.decode(encoded)
assert.deepEqual(nestedList, decoded)
```

API
=====
# API

`rlp.encode(plain)` - RLP encodes an `Array`, `Buffer` or `String` and returns a `Buffer`.

`rlp.decode(encoded, [skipRemainderCheck=false])` - Decodes an RLP encoded `Buffer`, `Array` or `String` and returns a `Buffer` or an `Array` of `Buffers`. If `skipRemainderCheck` is enabled, `rlp` will just decode the first rlp sequence in the buffer. By default, it would throw an error if there are more bytes in Buffer than used by rlp sequence.

CLI
===
`rlp decode <hex string>`
`rlp encode <json String>`
# CLI

`rlp decode <hex string>`
`rlp encode <json String>`

# TESTS

Test uses mocha. To run tests and linting: `npm test`. To auto fix linting problems use: `npm run test:fix`.

TESTS
=====
Test uses mocha. To run `npm test`
# CODE COVERAGE

CODE COVERAGE
=============
Install dev dependencies
`npm install`

Expand Down
25 changes: 14 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@
"build": "tsc",
"coverage": "nyc mocha --reporter spec --require ts-node/register 'test/index.ts'",
"coveralls": "npm run coverage && nyc report --reporter=text-lcov | coveralls",
"lint": "standard",
"test": "mocha --reporter spec --require ts-node/register 'test/index.ts'",
"format": "prettier --list-different '**/*.{ts,json,md,gql}'",
"format:fix": "prettier --write '**/*.{ts,json,md,gql}'",
"tslint": "tslint -p ./tsconfig.json -e 'node_modules/**/*' -e '**/node_modules/**/*' -e 'dist/**/*' '**/*.ts'",
"tslint:fix": "tslint --fix --format stylish -p ./tsconfig.json -e 'node_modules/**/*' -e '**/node_modules/**/*' -e 'dist/**/*' '**/*.ts'",
"tsc": "tsc --noEmit",
"lint": "yarn format && yarn tslint && yarn tsc",
"lint:fix": "yarn format:fix && yarn tslint:fix && yarn tsc",
"test": "yarn lint && mocha --reporter spec --require ts-node/register 'test/index.ts'",
"test:fix": "yarn lint:fix && mocha --reporter spec --require ts-node/register 'test/index.ts'",
"webtest": "browserify test/max.js | testling -u"
},
"repository": {
Expand Down Expand Up @@ -42,13 +49,15 @@
"@types/mocha": "^5.2.5",
"@types/node": "^10.12.2",
"bn.js": "^4.11.1",
"nyc": "^13.1.0",
"coveralls": "^2.11.4",
"ethereumjs-testing": "git+https://github.com/ethereumjs/ethereumjs-testing.git",
"mocha": "4.1.0",
"standard": "^6.0.8",
"nyc": "^13.1.0",
"prettier": "^1.15.2",
"ts-node": "^7.0.1",
"typescript": "^3.1.6"
"tslint": "^5.11.0",
"typescript": "^3.1.6",
"typestrict": "^1.0.1"
},
"bin": {
"rlp": "./bin/rlp"
Expand All @@ -65,11 +74,5 @@
"ipad/6",
"android-browser/latest"
]
},
"standard": {
"globals": [
"describe",
"it"
]
}
}
Loading

0 comments on commit a11af88

Please sign in to comment.