Skip to content

Commit

Permalink
chore(deps-dev): bump @types/node from 13.13.10 to 14.0.11 (#125)
Browse files Browse the repository at this point in the history
* chore(deps-dev): bump @types/node from 13.13.10 to 14.0.11

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.13.10 to 14.0.11.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* chore: fix types

* chore: add travis type check

* chore: add typescript dev dep

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Jacob Heun <jacobheun@gmail.com>
  • Loading branch information
dependabot-preview[bot] and jacobheun authored Jun 5, 2020
1 parent b10ba86 commit 46bb352
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
script:
- npx aegir dep-check
- npm run lint
- npm run test:types

- stage: test
name: chrome
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@
"@types/chai": "^4.2.8",
"@types/dirty-chai": "^2.0.2",
"@types/mocha": "^7.0.1",
"@types/node": "^13.7.0",
"@types/node": "^14.0.11",
"aegir": "^22.0.0",
"bundlesize": "~0.18.0",
"chai": "^4.2.0",
"dirty-chai": "^2.0.1"
"dirty-chai": "^2.0.1",
"typescript": "^3.9.5"
},
"contributors": [
"David Dias <daviddias.p@gmail.com>",
Expand Down
2 changes: 1 addition & 1 deletion src/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function ip2buf (ipString) {

function buf2ip (ipBuff) {
const ipString = ip.toString(ipBuff)
if (!ip.isIP(ipString)) {
if (!ipString || !ip.isIP(ipString)) {
throw new Error('invalid ip address')
}
return ipString
Expand Down
13 changes: 7 additions & 6 deletions src/ip.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const toBuffer = function (ip, buff, offset) {
while (sections.length < 8) sections.push('0')
} else if (sections.length < 8) {
for (i = 0; i < sections.length && sections[i] !== ''; i++);
var argv = [i, 1]
var argv = [i, '1']
for (i = 9 - sections.length; i > 0; i--) {
argv.push('0')
}
Expand Down Expand Up @@ -70,23 +70,24 @@ const toString = function (buff, offset, length) {
length = length || (buff.length - offset)

var result = []
var string
if (length === 4) {
// IPv4
for (let i = 0; i < length; i++) {
result.push(buff[offset + i])
}
result = result.join('.')
string = result.join('.')
} else if (length === 16) {
// IPv6
for (let i = 0; i < length; i += 2) {
result.push(buff.readUInt16BE(offset + i).toString(16))
}
result = result.join(':')
result = result.replace(/(^|:)0(:0)*:0(:|$)/, '$1::$3')
result = result.replace(/:{3,4}/, '::')
string = result.join(':')
string = string.replace(/(^|:)0(:0)*:0(:|$)/, '$1::$3')
string = string.replace(/:{3,4}/, '::')
}

return result
return string
}

module.exports = {
Expand Down
1 change: 1 addition & 0 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,7 @@ describe('helpers', () => {
const addr = multiaddr(str)

return multiaddr.resolve(addr)
// @ts-ignore
.then(expect.fail, (err) => {
expect(err).to.exist()
expect(err.message).to.eql('not a valid name')
Expand Down

0 comments on commit 46bb352

Please sign in to comment.