Skip to content

Commit 9b2f374

Browse files
committedMar 21, 2021
Remove redundant unwrap() function
1 parent 79ab5a2 commit 9b2f374

File tree

5 files changed

+2
-29
lines changed

5 files changed

+2
-29
lines changed
 

‎README.md

-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,3 @@
1919
### `escape (literal: string) => string`
2020

2121
Returns an escaped version of a string for use in a regular expression.
22-
23-
### `unwrap (exp: RegExp) => string`
24-
25-
Returns a string containing just the pattern portion of a regular expression.

‎src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export {escape, unwrap} from './main'
1+
export {escape} from './main'

‎src/main.ts

-7
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,3 @@
99
* SyntaxError: Invalid regular expression: <expression>: Invalid escape
1010
*/
1111
export const escape: (literal: string) => string = literal => literal.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
12-
13-
/**
14-
* Returns a string containing just the pattern portion of a regular expression.
15-
*
16-
* The surrounding delimiters, and the flags/modifiers will be omitted.
17-
*/
18-
export const unwrap: (exp: RegExp) => string = exp => String(exp).split('/').slice(1, -1).join('/')

‎test/unit/index.spec.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import * as index from '../../src/index'
2-
import {escape, unwrap} from '../../src/main'
2+
import {escape} from '../../src/main'
33

44
describe('module index', () => {
55
it('should provide access to param()', () => {
66
expect(index.escape).toBe(escape)
77
})
8-
9-
it('should provide access to path()', () => {
10-
expect(index.unwrap).toBe(unwrap)
11-
})
128
})

‎test/unit/unwrap.spec.ts

-12
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.