Skip to content

Commit

Permalink
feat: add not.word helper input (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
didavid61202 committed Mar 30, 2023
1 parent 5172d2b commit c73c2ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const linefeed = createInput('\\n')
export const carriageReturn = createInput('\\r')

export const not = {
word: createInput('\\W+'),
wordChar: createInput('\\W'),
wordBoundary: createInput('\\B'),
digit: createInput('\\D'),
Expand Down
2 changes: 2 additions & 0 deletions test/inputs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ describe('inputs', () => {
expectTypeOf(extractRegExp(input)).toEqualTypeOf<'\\r'>()
})
it('not', () => {
expect(not.word.toString()).toMatchInlineSnapshot('"\\\\W+"')
expectTypeOf(extractRegExp(not.word)).toEqualTypeOf<'\\W+'>()
expect(not.wordChar.toString()).toMatchInlineSnapshot('"\\\\W"')
expectTypeOf(extractRegExp(not.wordChar)).toEqualTypeOf<'\\W'>()
expect(not.wordBoundary.toString()).toMatchInlineSnapshot('"\\\\B"')
Expand Down

1 comment on commit c73c2ed

@vercel
Copy link

@vercel vercel bot commented on c73c2ed Mar 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.