Skip to content

Commit

Permalink
chore: review
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjastrzebski committed Mar 14, 2024
1 parent c54ade6 commit ab9c462
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/constructs/character-class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ export function negated(element: CharacterClass): CharacterClass {
};
}

/**
* @deprecated Renamed to `negated`.
*/
export const inverted = negated;

function encodeCharacterClass(this: CharacterClass): EncodeResult {
if (this.chars.length === 0 && this.ranges.length === 0) {
throw new Error('Character class should contain at least one character or character range');
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export {
charRange,
digit,
negated,
inverted,
nonDigit,
nonWhitespace,
nonWord,
Expand Down
4 changes: 2 additions & 2 deletions website/docs/api/assertions.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ _This API was added in version 1.3.0._

```ts
const wordBoundary: Anchor;
const notWordBoundary: Anchor;
const nonWordBoundary: Anchor;
```

- `wordBoundary` matches the positions where a word character is not followed or preceded by another word character, effectively indicating the start or end of a word. Regex syntax: `\b`.
- `notWordBoundary` matches the positions where a word character is followed or preceded by another word character, indicating that it is not at the start or end of a word. Regex syntax: `\B`.
- `nonWordBoundary` matches the positions where a word character is followed or preceded by another word character, indicating that it is not at the start or end of a word. Regex syntax: `\B`.

Note: word characters are letters, digits, and underscore (`_`). Other special characters like `#`, `$`, etc are not considered word characters.

Expand Down

0 comments on commit ab9c462

Please sign in to comment.