File tree 6 files changed +15
-8
lines changed
6 files changed +15
-8
lines changed Original file line number Diff line number Diff line change 20
20
### Usage
21
21
22
22
``` js
23
- const is_ip_private = require ( ' private-ip' )
23
+ import is_ip_private from ' private-ip'
24
24
25
25
is_ip_private (' 10.0.0.0' )
26
26
// => true
Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
- module . exports = require ( './lib' ) . default
3
+ import is_ip_private from './lib/index.js'
4
+ export default is_ip_private
Original file line number Diff line number Diff line change 2
2
"name" : " private-ip" ,
3
3
"version" : " 2.3.4" ,
4
4
"description" : " Check if IP address is private." ,
5
- "main" : " index.js" ,
5
+ "exports" : " ./index.js" ,
6
+ "type" : " module" ,
6
7
"types" : " lib/index.d.ts" ,
7
8
"repository" : {
8
9
"type" : " git" ,
54
55
"ipaddr.js" : " ^2.0.1" ,
55
56
"@chainsafe/is-ip" : " ^2.0.1" ,
56
57
"netmask" : " ^2.0.2"
58
+ },
59
+ "engines" : {
60
+ "node" : " >=14.16"
57
61
}
58
62
}
Original file line number Diff line number Diff line change 1
1
import { Netmask } from 'netmask'
2
2
import ip_regex from 'ip-regex'
3
3
import { isIP } from '@chainsafe/is-ip'
4
- import { isValid as is_valid , parse , IPv4 } from 'ipaddr.js'
4
+ import ipaddr , { IPv4 } from 'ipaddr.js'
5
+ const { isValid : is_valid , parse } = ipaddr
5
6
6
7
const PRIVATE_IP_RANGES = [
7
8
'0.0.0.0/8' ,
Original file line number Diff line number Diff line change 1
- const test = require ( 'ava' )
2
- const is_ip_private = require ( './' )
1
+ import test from 'ava'
2
+ import is_ip_private from './index.js'
3
3
4
4
const pub_ips = [
5
5
'44.37.112.180' ,
Original file line number Diff line number Diff line change 1
1
{
2
2
"compilerOptions" : {
3
- "target" : " es6" ,
4
- "module" : " commonjs" ,
3
+ "target" : " ES2020" ,
4
+ "module" : " ES2020" ,
5
+ "moduleResolution" : " node" ,
5
6
"esModuleInterop" : true ,
6
7
"declaration" : true
7
8
}
You can’t perform that action at this time.
0 commit comments