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

Commit

Permalink
feat: remove base1 and readme tweaks
Browse files Browse the repository at this point in the history
closes #48
closes #44
  • Loading branch information
hugomrdias committed Mar 16, 2020
1 parent 5128f2a commit 05cd102
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,12 @@ Loading this module through a script tag will make the ```Multibase``` obj avail
<script src="https://unpkg.com/multibase/dist/index.js"></script>
```

#### Gotchas

You will need to use Node.js `Buffer` API compatible, if you are running inside the browser, you can access it by `multibase.Buffer` or you can load Feross's [Buffer](https://github.com/feross/buffer) module.

## Usage

### Example

```JavaScript
const { Buffer } = require('buffer')
const multibase = require('multibase')

const encodedBuf = multibase.encode('base58btc', new Buffer('hey, how is it going'))
Expand Down Expand Up @@ -147,7 +144,6 @@ const baseX = require('base-x')
//const newPackage = require('your-package-name')

const constants = [
['base1', '1', '', '1'],
['base2', '0', baseX, '01'],
['base8', '7', baseX, '01234567'],
// ... [ 'your-base-name', 'code-to-be-defined', newPackage, 'alphabet']
Expand All @@ -157,7 +153,7 @@ The required package defines the implementation of the encoding/decoding process
- `encode` and `decode` functions with to-be-encoded buffer as the only expected argument
- the require call use the `alphabet` given as an argument for the encoding/decoding process

*If no package is specified (such as for base1 in the above example, it means the base is not implemented yet)*
*If no package is specified , it means the base is not implemented yet*

Adding a new base requires the tests to be updated. Test files to be updated are :
- constants.spec.js
Expand Down Expand Up @@ -200,4 +196,4 @@ Small note: If editing the README, please conform to the [standard-readme](https

## License

[MIT](LICENSE) © 2016 Protocol Labs Inc.
[MIT](LICENSE) © Protocol Labs Inc.
6 changes: 2 additions & 4 deletions test/multibase.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ chai.use(dirtyChai)
const multibase = require('../src')
const constants = require('../src/constants.js')

const unsupportedBases = [
['base1']
]
const unsupportedBases = []

const supportedBases = [
['base2', 'yes mani !', '01111001011001010111001100100000011011010110000101101110011010010010000000100001'],
Expand Down Expand Up @@ -99,7 +97,7 @@ describe('multibase', () => {

it('fails on no buf', () => {
expect(() => {
multibase('base1')
multibase('base16')
}).to.throw(Error)
})

Expand Down

0 comments on commit 05cd102

Please sign in to comment.