🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

arkregex

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arkregex - npm Package Compare versions

Comparing version
0.0.1
to
0.0.2
+1
-1
out/regex.d.ts

@@ -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;

export const regex = ((src, flags) => new RegExp(src, flags));
Object.assign(regex, { cast: regex });
Object.assign(regex, { as: regex });
{
"name": "arkregex",
"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": {

@@ -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 @@ )