File tree Expand file tree Collapse file tree 7 files changed +18
-25
lines changed Expand file tree Collapse file tree 7 files changed +18
-25
lines changed Original file line number Diff line number Diff line change @@ -10,13 +10,12 @@ jobs:
1010 fail-fast : false
1111 matrix :
1212 node-version :
13+ - 16
1314 - 14
1415 - 12
15- - 10
16- - 8
1716 steps :
1817 - uses : actions/checkout@v2
19- - uses : actions/setup-node@v1
18+ - uses : actions/setup-node@v2
2019 with :
2120 node-version : ${{ matrix.node-version }}
2221 - run : npm install
Original file line number Diff line number Diff line change @@ -3,12 +3,10 @@ Humanize a URL: `https://sindresorhus.com` → `sindresorhus.com`.
33
44@example
55```
6- import humanizeUrl = require( 'humanize-url') ;
6+ import humanizeUrl from 'humanize-url';
77
88humanizeUrl('https://www.sindresorhus.com/');
99//=> 'sindresorhus.com'
1010```
1111*/
12- declare function humanizeUrl ( url : string ) : string ;
13-
14- export = humanizeUrl ;
12+ export default function humanizeUrl ( url : string ) : string ;
Original file line number Diff line number Diff line change 1- 'use strict' ;
2- const normalizeUrl = require ( 'normalize-url' ) ;
1+ import normalizeUrl from 'normalize-url' ;
32
4- module . exports = url => {
3+ export default function humanizeUrl ( url ) {
54 if ( typeof url !== 'string' ) {
65 throw new TypeError ( 'Expected a string' ) ;
76 }
87
98 return normalizeUrl ( url , { stripProtocol : true } ) ;
10- } ;
9+ }
Original file line number Diff line number Diff line change 11import { expectType } from 'tsd' ;
2- import humanizeUrl = require ( '.' ) ;
2+ import humanizeUrl from './index.js' ;
33
44expectType < string > ( humanizeUrl ( 'https://www.sindresorhus.com/' ) ) ;
Original file line number Diff line number Diff line change 77 "author" : {
88 "name" : " Sindre Sorhus" ,
9910- "url" : " sindresorhus.com"
10+ "url" : " https:// sindresorhus.com"
1111 },
12+ "type" : " module" ,
13+ "exports" : " ./index.js" ,
1214 "engines" : {
13- "node" : " >=8 "
15+ "node" : " >=12.20 "
1416 },
1517 "scripts" : {
1618 "test" : " xo && ava && tsd"
3941 " prettify"
4042 ],
4143 "dependencies" : {
42- "normalize-url" : " ^4.5.1 "
44+ "normalize-url" : " ^7.0.0 "
4345 },
4446 "devDependencies" : {
45- "ava" : " ^1.4.1 " ,
46- "tsd" : " ^0.7.2 " ,
47- "xo" : " ^0.24 .0"
47+ "ava" : " ^3.15.0 " ,
48+ "tsd" : " ^0.17.0 " ,
49+ "xo" : " ^0.41 .0"
4850 }
4951}
Original file line number Diff line number Diff line change @@ -13,13 +13,8 @@ $ npm install humanize-url
1313## Usage
1414
1515``` js
16- const humanizeUrl = require ( ' humanize-url' ) ;
16+ import humanizeUrl from ' humanize-url' ;
1717
1818humanizeUrl (' https://www.sindresorhus.com/' );
1919// => 'sindresorhus.com'
2020```
21-
22-
23- ## License
24-
25- MIT © [ Sindre Sorhus] ( https://sindresorhus.com )
Original file line number Diff line number Diff line change 11import test from 'ava' ;
2- import humanizeUrl from '.' ;
2+ import humanizeUrl from './index.js ' ;
33
44test ( 'main' , t => {
55 t . is ( humanizeUrl ( 'http://sindresorhus.com' ) , 'sindresorhus.com' ) ;
You can’t perform that action at this time.
0 commit comments