Skip to content

Commit 4f8f6dc

Browse files
refactor: add missing exports (#63)
1 parent 2466173 commit 4f8f6dc

16 files changed

+32
-39
lines changed

src/__tests__/builder.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { buildRegExp } from '../builders';
1+
import { buildRegExp } from '..';
22

33
test('`regexBuilder` flags', () => {
44
expect(buildRegExp('a').flags).toBe('');

src/__tests__/example-email.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
oneOrMore,
99
repeat,
1010
startOfString,
11-
} from '../index';
11+
} from '..';
1212

1313
test('example: email validation', () => {
1414
const usernameChars = charClass(charRange('a', 'z'), digit, anyOf('._%+-'));

src/__tests__/example-hashtags.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { buildRegExp } from '../builders';
2-
import { capture, oneOrMore, word } from '../index';
1+
import { buildRegExp, capture, oneOrMore, word } from '..';
32

43
test('example: extracting hashtags', () => {
54
const regex = buildRegExp(

src/__tests__/example-hex-color.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
optional,
99
repeat,
1010
startOfString,
11-
} from '../index';
11+
} from '..';
1212

1313
test('example: hex color validation', () => {
1414
const hexDigit = charClass(digit, charRange('a', 'f'));

src/__tests__/example-ipv4.ts

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
import {
2-
buildRegExp,
3-
charRange,
4-
choiceOf,
5-
digit,
6-
endOfString,
7-
repeat,
8-
startOfString,
9-
} from '../index';
1+
import { buildRegExp, charRange, choiceOf, digit, endOfString, repeat, startOfString } from '..';
102

113
test('example: IPv4 address validator', () => {
124
const octet = choiceOf(

src/__tests__/example-js-number.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
optional,
99
startOfString,
1010
zeroOrMore,
11-
} from '../index';
11+
} from '..';
1212

1313
test('example: validate JavaScript number', () => {
1414
const sign = anyOf('+-');

src/__tests__/example-regexp.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { buildRegExp, choiceOf, endOfString, repeat, startOfString } from '../index';
1+
import { buildRegExp, choiceOf, endOfString, repeat, startOfString } from '..';
22

33
test('example: mixing with RegExp literals (IPv4 address validator)', () => {
44
const octet = choiceOf(

src/__tests__/example-url.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
optional,
1111
startOfString,
1212
zeroOrMore,
13-
} from '../index';
13+
} from '..';
1414

1515
// Modified from: https://stackoverflow.com/a/2015516
1616
test('example: simple url validation', () => {

src/constructs/__tests__/anchors.test.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { endOfString, startOfString } from '../anchors';
2-
import { oneOrMore } from '../quantifiers';
1+
import { endOfString, oneOrMore, startOfString } from '../..';
32

43
test('`startOfString` basic cases', () => {
54
expect(startOfString).toEqualRegex(/^/);

src/constructs/__tests__/capture.test.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { capture } from '../capture';
2-
import { oneOrMore } from '../quantifiers';
1+
import { capture, oneOrMore } from '../..';
32

43
test('`capture` base cases', () => {
54
expect(capture('a')).toEqualRegex(/(a)/);

src/constructs/__tests__/character-class.test.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
import { oneOrMore, optional, zeroOrMore } from '../quantifiers';
21
import {
32
any,
43
anyOf,
4+
buildRegExp,
55
charClass,
66
charRange,
77
digit,
88
inverted,
99
notDigit,
1010
notWhitespace,
1111
notWord,
12+
oneOrMore,
13+
optional,
1214
whitespace,
1315
word,
14-
} from '../character-class';
15-
import { buildRegExp } from '../../builders';
16+
zeroOrMore,
17+
} from '../..';
1618

1719
test('`any` character class', () => {
1820
expect(any).toEqualRegex(/./);

src/constructs/__tests__/choice-of.test.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { oneOrMore, zeroOrMore } from '../quantifiers';
2-
import { repeat } from '../repeat';
3-
import { choiceOf } from '../choice-of';
1+
import { choiceOf, oneOrMore, repeat, zeroOrMore } from '../..';
42

53
test('`choiceOf` using basic strings', () => {
64
expect(choiceOf('a')).toEqualRegex(/a/);

src/constructs/__tests__/quantifiers.test.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { buildRegExp } from '../../builders';
2-
import { any, digit } from '../character-class';
3-
import { oneOrMore, optional, zeroOrMore } from '../quantifiers';
1+
import { any, buildRegExp, digit, oneOrMore, optional, zeroOrMore } from '../..';
42

53
test('`oneOrMore` quantifier', () => {
64
expect(oneOrMore('a')).toEqualRegex(/a+/);

src/constructs/__tests__/repeat.test.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { digit } from '../character-class';
2-
import { oneOrMore, zeroOrMore } from '../quantifiers';
3-
import { repeat } from '../repeat';
1+
import { digit, oneOrMore, repeat, zeroOrMore } from '../..';
42

53
test('`repeat` quantifier', () => {
64
expect(['a', repeat('b', { min: 1, max: 5 })]).toEqualRegex(/ab{1,5}/);

src/encoder/__tests__/encoder.test.tsx

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
import { buildPattern, buildRegExp } from '../../builders';
2-
import { capture } from '../../constructs/capture';
3-
import { choiceOf } from '../../constructs/choice-of';
4-
import { oneOrMore, optional, zeroOrMore } from '../../constructs/quantifiers';
5-
import { repeat } from '../../constructs/repeat';
1+
import {
2+
buildPattern,
3+
buildRegExp,
4+
capture,
5+
choiceOf,
6+
oneOrMore,
7+
optional,
8+
repeat,
9+
zeroOrMore,
10+
} from '../..';
611

712
test('basic quantifies', () => {
813
expect('a').toEqualRegex(/a/);
@@ -26,7 +31,7 @@ test('basic quantifies', () => {
2631
expect([optional('a'), 'b', oneOrMore('d')]).toEqualRegex(/a?bd+/);
2732
});
2833

29-
test('`buildPattern` escapes special characters', () => {
34+
test('`buildRegExp` escapes special characters', () => {
3035
expect('.').toEqualRegex(/\./);
3136
expect('*').toEqualRegex(/\*/);
3237
expect('+').toEqualRegex(/\+/);

src/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ export {
1313
charRange,
1414
charClass,
1515
inverted,
16+
notDigit,
17+
notWhitespace,
18+
notWord,
1619
} from './constructs/character-class';
1720
export { choiceOf } from './constructs/choice-of';
1821
export { oneOrMore, optional, zeroOrMore } from './constructs/quantifiers';

0 commit comments

Comments
 (0)