+1
-1
@@ -29,3 +29,3 @@ import type { ErrorMessage, inferred } from "@ark/util"; | ||
| <src extends string, flags extends Flags = "">(src: regex.validate<src, flags>, flags?: flags): regex.parse<src, flags>; | ||
| cast: <pattern extends string = string, ctx extends RegexContext = {}>(src: string, flags?: Flags) => Regex<pattern, ctx>; | ||
| as: <pattern extends string = string, ctx extends RegexContext = {}>(src: string, flags?: Flags) => Regex<pattern, ctx>; | ||
| } | ||
@@ -32,0 +32,0 @@ export declare const regex: RegexParser; |
+1
-1
| export const regex = ((src, flags) => new RegExp(src, flags)); | ||
| Object.assign(regex, { cast: regex }); | ||
| Object.assign(regex, { as: regex }); |
+2
-2
| { | ||
| "name": "@ark/regex", | ||
| "description": "A drop-in replacement for new RegExp() with types", | ||
| "version": "0.0.1", | ||
| "version": "0.0.2", | ||
| "license": "MIT", | ||
@@ -32,3 +32,3 @@ "author": { | ||
| "dependencies": { | ||
| "@ark/util": "0.52.0" | ||
| "@ark/util": "0.53.0" | ||
| }, | ||
@@ -35,0 +35,0 @@ "publishConfig": { |
+2
-2
@@ -43,6 +43,6 @@ # arkregex | ||
| If your types start to slow down or you see the dreaded `Type is excessively deep...`, you can manually type your expression using `regex.cast`: | ||
| If your types start to slow down or you see the dreaded `Type is excessively deep...`, you can manually type your expression using `regex.as`: | ||
| ```ts | ||
| const complexPattern = regex.cast<`pattern-${string}`, { captures: [string] }>( | ||
| const complexPattern = regex.as<`pattern-${string}`, { captures: [string] }>( | ||
| "very-long-complex-expression-here" | ||
@@ -49,0 +49,0 @@ ) |
47469
-0.02%+ Added
- Removed
Updated