Skip to content

Commit

Permalink
feat: esm (#33)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: ESM only
  • Loading branch information
ThaUnknown committed Dec 5, 2022
1 parent 7959255 commit 64f6d68
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const addrToIPPort = require('addr-to-ip-port')
const ipaddr = require('ipaddr.js')
import addrToIPPort from 'addr-to-ip-port'
import ipaddr from 'ipaddr.js'

module.exports = addrs => {
const addrs = addrs => {
if (typeof addrs === 'string') {
addrs = [addrs]
}
Expand All @@ -27,5 +27,5 @@ module.exports = addrs => {
*
* for parallelism with the `compact2string` module.
*/
module.exports.multi = module.exports
module.exports.multi6 = module.exports
export default addrs
export { addrs as multi, addrs as multi6 }
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"bugs": {
"url": "https://github.com/webtorrent/string2compact/issues"
},
"type": "module",
"dependencies": {
"addr-to-ip-port": "^1.0.1",
"ipaddr.js": "^2.0.0"
Expand All @@ -34,7 +35,12 @@
"webtorrent"
],
"license": "MIT",
"main": "index.js",
"engines": {
"node": ">=12.20.0"
},
"exports": {
"import": "./index.js"
},
"repository": {
"type": "git",
"url": "git://github.com/webtorrent/string2compact.git"
Expand Down
6 changes: 3 additions & 3 deletions test/basic.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const compact2string = require('compact2string')
const test = require('tape')
import compact2string from 'compact2string'
import test from 'tape'

const string2compact = require('../')
import string2compact from '../index.js'

test('single', t => {
const compact = string2compact('10.10.10.5:65408')
Expand Down

0 comments on commit 64f6d68

Please sign in to comment.