Comparing version 2.0.2 to 2.0.3
@@ -30,4 +30,4 @@ 'use strict'; | ||
} else { | ||
throw new Error('addr must be a string, Buffer, or another Multiaddr'); | ||
} | ||
throw new Error('addr must be a string, Buffer, or another Multiaddr'); | ||
} | ||
} | ||
@@ -168,2 +168,10 @@ | ||
// patch this in | ||
Multiaddr.protocols = protocols; | ||
Multiaddr.protocols = protocols; | ||
Multiaddr.isMultiaddr = function isMultiaddr(addr) { | ||
if (addr.constructor && addr.constructor.name) { | ||
return addr.constructor.name === 'Multiaddr'; | ||
} | ||
return Boolean(addr.fromStupidString && addr.protos); | ||
}; |
{ | ||
"name": "multiaddr", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "multiaddr implementation (binary + string representation of network addresses)", | ||
@@ -39,22 +39,23 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"babel-runtime": "^6.6.1", | ||
"babel-runtime": "^6.11.6", | ||
"bs58": "^3.0.0", | ||
"ip": "^1.0.2", | ||
"lodash.filter": "^4.2.1", | ||
"lodash.map": "^4.2.1", | ||
"varint": "^4.0.0", | ||
"ip": "^1.1.3", | ||
"lodash.filter": "^4.6.0", | ||
"lodash.map": "^4.6.0", | ||
"varint": "^4.0.1", | ||
"xtend": "^4.0.1" | ||
}, | ||
"devDependencies": { | ||
"aegir": "^3.0.4", | ||
"aegir": "^8.0.0", | ||
"buffer-loader": "0.0.1", | ||
"chai": "^3.5.0", | ||
"pre-commit": "^1.1.2" | ||
"pre-commit": "^1.1.3" | ||
}, | ||
"contributors": [ | ||
"David Dias <daviddias.p@gmail.com>", | ||
"Friedel Ziegelmayer <dignifiedquire@gmail.com>", | ||
"Juan Batiz-Benet <juan@benet.ai>", | ||
"Stephen Whitmore <stephen.whitmore@gmail.com>", | ||
"dignifiedquire <dignifiedquire@gmail.com>" | ||
"Richard Littauer <richard.littauer@gmail.com>", | ||
"Stephen Whitmore <stephen.whitmore@gmail.com>" | ||
] | ||
} |
116
README.md
@@ -5,3 +5,3 @@ js-multiaddr | ||
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) | ||
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) | ||
[![](https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square)](http://github.com/multiformats/multiformats) | ||
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) | ||
@@ -13,6 +13,28 @@ [![Coverage Status](https://coveralls.io/repos/github/jbenet/js-multiaddr/badge.svg?branch=master)](https://coveralls.io/github/jbenet/js-multiaddr?branch=master) | ||
> JavaScript implementation of [multiaddr](https://github.com/jbenet/multiaddr). | ||
> JavaScript implementation of [multiaddr](https://github.com/multiformats/multiaddr). | ||
## What is multiaddr? | ||
## Table of Contents | ||
- [Background](#background) | ||
- [What is multiaddr?](#what-is-multiaddr) | ||
- [Install](#install) | ||
- [Setup](#setup) | ||
- [Node.js](#nodejs) | ||
- [Browser: Browserify, Webpack, other bundlers](#browser-browserify-webpack-other-bundlers) | ||
- [Browser: `<script>` Tag](#browser-script-tag) | ||
- [Usage](#usage) | ||
- [API](#api) | ||
- [Create](#create) | ||
- [Protocols](#protocols) | ||
- [Node-Friendly Addresses](#node-friendly-addresses) | ||
- [En/decapsulate](#endecapsulate) | ||
- [Tunneling](#tunneling) | ||
- [Maintainers](#maintainers) | ||
- [Contribute](#contribute) | ||
- [License](#license) | ||
## Background | ||
### What is multiaddr? | ||
A standard way to represent addresses that | ||
@@ -26,5 +48,45 @@ | ||
## Example | ||
## Install | ||
```sh | ||
npm i multiaddr | ||
``` | ||
### Setup | ||
#### Node.js | ||
```js | ||
const multiaddr = require('multiaddr') | ||
``` | ||
#### Browser: Browserify, Webpack, other bundlers | ||
The code published to npm that gets loaded on require is in fact a ES5 | ||
transpiled version with the right shims added. This means that you can require | ||
it and use with your favourite bundler without having to adjust asset management | ||
process. | ||
```js | ||
const multiaddr = require('multiaddr') | ||
``` | ||
#### Browser: `<script>` Tag | ||
Loading this module through a script tag will make the `Multiaddr` obj available in | ||
the global namespace. | ||
```html | ||
<script src="https://npmcdn.com/multiaddr/dist/index.min.js"></script> | ||
<!-- OR --> | ||
<script src="https://npmcdn.com/multiaddr/dist/index.js"></script> | ||
``` | ||
**NOTE**: You will need access to the Node.js `Buffer` API. If you are running | ||
in the browser, you can access it with `multiaddr.Buffer` or you can install | ||
[feross/buffer](https://github.com/feross/buffer). | ||
## Usage | ||
```js | ||
$ node | ||
@@ -197,46 +259,22 @@ | ||
## Installation | ||
### Misc | ||
### npm | ||
#### `multiaddr.isMultiaddr(addr)` | ||
```sh | ||
> npm i multiaddr | ||
``` | ||
Returns `true` if the passed in `addr` is a valid `multiaddr`. | ||
## Setup | ||
## Maintainers | ||
### Node.js | ||
Captain: [@diasdavid](https://github.com/diasdavid). | ||
```js | ||
const multiaddr = require('multiaddr') | ||
``` | ||
## Contribute | ||
### Browser: Browserify, Webpack, other bundlers | ||
Contributions welcome. Please check out [the issues](https://github.com/multiformats/js-multiaddr/issues). | ||
The code published to npm that gets loaded on require is in fact a ES5 | ||
transpiled version with the right shims added. This means that you can require | ||
it and use with your favourite bundler without having to adjust asset management | ||
process. | ||
Check out our [contributing document](https://github.com/multiformats/multiformats/blob/master/contributing.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). | ||
```js | ||
const multiaddr = require('multiaddr') | ||
``` | ||
Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. | ||
### Browser: `<script>` Tag | ||
## License | ||
Loading this module through a script tag will make the `Multiaddr` obj available in | ||
the global namespace. | ||
```html | ||
<script src="https://npmcdn.com/multiaddr/dist/index.min.js"></script> | ||
<!-- OR --> | ||
<script src="https://npmcdn.com/multiaddr/dist/index.js"></script> | ||
``` | ||
**NOTE**: You will need access to the Node.js `Buffer` API. If you are running | ||
in the browser, you can access it with `multiaddr.Buffer` or you can install | ||
[feross/buffer](https://github.com/feross/buffer). | ||
# License | ||
MIT | ||
[MIT](LICENSE) © Protocol Labs Inc. |
@@ -169,1 +169,12 @@ 'use strict' | ||
Multiaddr.protocols = protocols | ||
Multiaddr.isMultiaddr = function isMultiaddr (addr) { | ||
if (addr.constructor && addr.constructor.name) { | ||
return addr.constructor.name === 'Multiaddr' | ||
} | ||
return Boolean( | ||
addr.fromStupidString && | ||
addr.protos | ||
) | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1379024
20
277
16276
Updatedbabel-runtime@^6.11.6
Updatedip@^1.1.3
Updatedlodash.filter@^4.6.0
Updatedlodash.map@^4.6.0
Updatedvarint@^4.0.1