Skip to content

Commit 83f55a9

Browse files
deps(dev): bump aegir from 37.12.1 to 38.1.7 (#142)
* deps(dev): bump aegir from 37.12.1 to 38.1.7 Bumps [aegir](https://github.com/ipfs/aegir) from 37.12.1 to 38.1.7. - [Release notes](https://github.com/ipfs/aegir/releases) - [Changelog](https://github.com/ipfs/aegir/blob/master/CHANGELOG.md) - [Commits](ipfs/aegir@v37.12.1...v38.1.7) --- updated-dependencies: - dependency-name: aegir dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * chore: fix linting --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: achingbrain <alex@achingbrain.net>
1 parent 3d8a401 commit 83f55a9

File tree

5 files changed

+37
-56
lines changed

5 files changed

+37
-56
lines changed

.gitignore

+6-40
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,9 @@
1-
**/node_modules/
2-
**/*.log
3-
test/repo-tests*
4-
**/bundle.js
5-
6-
# Logs
7-
logs
8-
*.log
9-
10-
coverage
11-
12-
# Runtime data
13-
pids
14-
*.pid
15-
*.seed
16-
17-
# Directory for instrumented libs generated by jscoverage/JSCover
18-
lib-cov
19-
20-
# Coverage directory used by tools like istanbul
21-
coverage
22-
23-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24-
.grunt
25-
26-
# node-waf configuration
27-
.lock-wscript
28-
29-
build
30-
docs
31-
32-
# Dependency directory
33-
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
341
node_modules
35-
36-
lib
2+
build
373
dist
38-
test/test-data/go-ipfs-repo/LOCK
39-
test/test-data/go-ipfs-repo/LOG
40-
test/test-data/go-ipfs-repo/LOG.old
41-
42-
# while testing npm5
4+
.docs
5+
.coverage
6+
node_modules
437
package-lock.json
8+
yarn.lock
9+
.vscode

README.md

+18-4
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,35 @@
22

33
[![multiformats.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://multiformats.io)
44
[![codecov](https://img.shields.io/codecov/c/github/multiformats/js-mafmt.svg?style=flat-square)](https://codecov.io/gh/multiformats/js-mafmt)
5-
[![CI](https://img.shields.io/github/workflow/status/multiformats/js-mafmt/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/multiformats/js-mafmt/actions/workflows/js-test-and-release.yml)
5+
[![CI](https://img.shields.io/github/actions/workflow/status/multiformats/js-mafmt/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/multiformats/js-mafmt/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)
66

77
> A multiaddr validator
88
99
## Table of contents <!-- omit in toc -->
1010

1111
- [Install](#install)
12+
- [Browser `<script>` tag](#browser-script-tag)
1213
- [Usage](#usage)
1314
- [API](#api)
14-
- [`mafmt.<FORMAT>.matches(multiaddr)`](#mafmtformatmatchesmultiaddr)
15+
- - [`mafmt.<FORMAT>.matches(multiaddr)`](#mafmtformatmatchesmultiaddr)
16+
- [API Docs](#api-docs)
1517
- [License](#license)
16-
- [Contribute](#contribute)
18+
- [Contribution](#contribution)
1719

1820
## Install
1921

2022
```console
2123
$ npm i @multiformats/mafmt
2224
```
2325

26+
### Browser `<script>` tag
27+
28+
Loading this module through a script tag will make it's exports available as `MultiformatsMafmt` in the global namespace.
29+
30+
```html
31+
<script src="https://unpkg.com/@multiformats/mafmt/dist/index.min.js"></script>
32+
```
33+
2434
## Usage
2535

2636
```js
@@ -64,13 +74,17 @@ Where `multiaddr` may be:
6474

6575
Returns `true`/`false`
6676

77+
## API Docs
78+
79+
- <https://multiformats.github.io/js-mafmt>
80+
6781
## License
6882

6983
Licensed under either of
7084

7185
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
7286
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
7387

74-
## Contribute
88+
## Contribution
7589

7690
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"types": "./dist/src/index.d.ts",
2323
"files": [
2424
"src",
25-
"dist/src",
25+
"dist",
2626
"!dist/test",
2727
"!**/*.tsbuildinfo"
2828
],
@@ -135,13 +135,14 @@
135135
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
136136
"test:node": "aegir test -t node",
137137
"test:electron-main": "aegir test -t electron-main",
138-
"release": "aegir release"
138+
"release": "aegir release",
139+
"docs": "aegir docs"
139140
},
140141
"dependencies": {
141142
"@multiformats/multiaddr": "^11.0.0"
142143
},
143144
"devDependencies": {
144-
"aegir": "^37.5.3",
145+
"aegir": "^38.1.7",
145146
"uint8arrays": "^3.0.0",
146147
"util": "^0.12.3"
147148
}

src/index.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ const _Circuit = or(
122122
base('p2p-circuit')
123123
)
124124

125-
const CircuitRecursive = () => or(
125+
const CircuitRecursive = (): Mafmt => or(
126126
and(_Circuit, CircuitRecursive),
127127
_Circuit
128128
)
@@ -143,7 +143,7 @@ export const IPFS = P2P
143143
* Validation funcs
144144
*/
145145

146-
function makeMatchesFunction (partialMatch: PartialMatchesFunction) {
146+
function makeMatchesFunction (partialMatch: PartialMatchesFunction): (a: string | Uint8Array | Multiaddr) => boolean {
147147
function matches (a: string | Uint8Array | Multiaddr): boolean {
148148
let ma
149149

@@ -199,7 +199,7 @@ function and (...args: Array<Mafmt | (() => Mafmt)>): Mafmt {
199199
toString: function () { return '{ ' + args.join(' ') + ' }' },
200200
input: args,
201201
matches: makeMatchesFunction(partialMatch),
202-
partialMatch: partialMatch
202+
partialMatch
203203
}
204204
}
205205

@@ -224,7 +224,7 @@ function or (...args: Array<Mafmt | (() => Mafmt)>): Mafmt {
224224
toString: function () { return '{ ' + args.join(' ') + ' }' },
225225
input: args,
226226
matches: makeMatchesFunction(partialMatch),
227-
partialMatch: partialMatch
227+
partialMatch
228228
}
229229

230230
return result
@@ -233,7 +233,7 @@ function or (...args: Array<Mafmt | (() => Mafmt)>): Mafmt {
233233
function base (n: string): Mafmt {
234234
const name = n
235235

236-
function matches (a: string | Uint8Array | Multiaddr) {
236+
function matches (a: string | Uint8Array | Multiaddr): boolean {
237237
let ma: Multiaddr
238238

239239
try {
@@ -262,7 +262,7 @@ function base (n: string): Mafmt {
262262

263263
return {
264264
toString: function () { return name },
265-
matches: matches,
266-
partialMatch: partialMatch
265+
matches,
266+
partialMatch
267267
}
268268
}

test/index.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ describe('multiaddr validation', function () {
201201
'/ip4/0.0.0.0/udp/4004/webrtc/uEiAeP0OEmBbGVTH5Bhnm3WopwRNSQ0et46xNkn2dIagnGw/p2p/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64'
202202
]
203203

204-
function assertMatches (p: Mafmt, ...tests: string[][]) {
204+
function assertMatches (p: Mafmt, ...tests: string[][]): void {
205205
tests.forEach(function (test) {
206206
test.forEach(function (testcase) {
207207
try {
@@ -217,7 +217,7 @@ describe('multiaddr validation', function () {
217217
})
218218
}
219219

220-
function assertMismatches (p: Mafmt, ...tests: string[][]) {
220+
function assertMismatches (p: Mafmt, ...tests: string[][]): void {
221221
tests.forEach(function (test) {
222222
test.forEach(function (testcase) {
223223
try {

0 commit comments

Comments
 (0)