File tree 7 files changed +14
-17
lines changed
7 files changed +14
-17
lines changed Original file line number Diff line number Diff line change 12
12
node-version :
13
13
- 14
14
14
- 12
15
- - 10
16
15
steps :
17
16
- uses : actions/checkout@v2
18
- - uses : actions/setup-node@v1
17
+ - uses : actions/setup-node@v2
19
18
with :
20
19
node-version : ${{ matrix.node-version }}
21
20
- run : npm install
Original file line number Diff line number Diff line change @@ -5,14 +5,12 @@ You can also use this to escape a string that is inserted into the middle of a r
5
5
6
6
@example
7
7
```
8
- import escapeStringRegexp = require( 'escape-string-regexp') ;
8
+ import escapeStringRegexp from 'escape-string-regexp';
9
9
10
10
const escapedString = escapeStringRegexp('How much $ for a 🦄?');
11
11
//=> 'How much \\$ for a 🦄\\?'
12
12
13
13
new RegExp(escapedString);
14
14
```
15
15
*/
16
- declare const escapeStringRegexp : ( string : string ) => string ;
17
-
18
- export = escapeStringRegexp ;
16
+ export default function escapeStringRegexp ( string : string ) : string ;
Original file line number Diff line number Diff line change 1
- 'use strict' ;
2
-
3
- module . exports = string => {
1
+ export default function escapeStringRegexp ( string ) {
4
2
if ( typeof string !== 'string' ) {
5
3
throw new TypeError ( 'Expected a string' ) ;
6
4
}
@@ -10,4 +8,4 @@ module.exports = string => {
10
8
return string
11
9
. replace ( / [ | \\ { } ( ) [ \] ^ $ + * ? . ] / g, '\\$&' )
12
10
. replace ( / - / g, '\\x2d' ) ;
13
- } ;
11
+ }
Original file line number Diff line number Diff line change 1
1
import { expectType } from 'tsd' ;
2
- import escapeStringRegexp = require ( '.' ) ;
2
+ import escapeStringRegexp from './index.js' ;
3
3
4
4
expectType < string > ( escapeStringRegexp ( 'how much $ for a 🦄?' ) ) ;
Original file line number Diff line number Diff line change 10
10
11
11
"url" : " https://sindresorhus.com"
12
12
},
13
+ "type" : " module" ,
14
+ "exports" : " ./index.js" ,
13
15
"engines" : {
14
- "node" : " >=10 "
16
+ "node" : " >=12 "
15
17
},
16
18
"scripts" : {
17
19
"test" : " xo && ava && tsd"
31
33
" characters"
32
34
],
33
35
"devDependencies" : {
34
- "ava" : " ^1.4.1 " ,
35
- "tsd" : " ^0.11 .0" ,
36
- "xo" : " ^0.28.3 "
36
+ "ava" : " ^3.15.0 " ,
37
+ "tsd" : " ^0.14 .0" ,
38
+ "xo" : " ^0.38.2 "
37
39
}
38
40
}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ $ npm install escape-string-regexp
11
11
## Usage
12
12
13
13
``` js
14
- const escapeStringRegexp = require ( ' escape-string-regexp' ) ;
14
+ import escapeStringRegexp from ' escape-string-regexp' ;
15
15
16
16
const escapedString = escapeStringRegexp (' How much $ for a 🦄?' );
17
17
// => 'How much \\$ for a 🦄\\?'
Original file line number Diff line number Diff line change 1
1
import test from 'ava' ;
2
- import escapeStringRegexp from '.' ;
2
+ import escapeStringRegexp from './index.js ' ;
3
3
4
4
test ( 'main' , t => {
5
5
t . is (
You can’t perform that action at this time.
0 commit comments