Commit 3eaec20 1 parent 8b92404 commit 3eaec20 Copy full SHA for 3eaec20
File tree 2 files changed +3
-5
lines changed
2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change 3
3
let ports , services ;
4
4
5
5
// port -> service
6
- module . exports . getService = function getService ( port , protocol = "tcp" ) {
6
+ module . exports . getService = ( port , protocol = "tcp" ) => {
7
7
if ( typeof port !== "number" ) throw new Error ( "expected a 'number'" ) ;
8
8
if ( ! ports ) ports = require ( "./ports.json" ) ;
9
-
10
9
return ports [ `${ port } /${ protocol } ` ] || null ;
11
10
} ;
12
11
13
12
// service -> port
14
- module . exports . getPort = function getPort ( service , protocol = "tcp" ) {
13
+ module . exports . getPort = ( service , protocol = "tcp" ) => {
15
14
if ( typeof service !== "string" ) throw new Error ( "expected a 'string'" ) ;
16
15
if ( ! services ) services = require ( "./services.json" ) ;
17
16
Original file line number Diff line number Diff line change 1
1
"use strict" ;
2
2
3
- const getService = require ( "." ) . getService ;
4
- const getPort = require ( "." ) . getPort ;
3
+ const { getService, getPort} = require ( "." ) ;
5
4
const { test, expect} = global ;
6
5
7
6
test ( "getService" , ( ) => {
You can’t perform that action at this time.
0 commit comments