@ptolemy2002/rgx 11.1.1 → 12.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,6 @@ export * from "./constants";
|
|
|
16
16
|
export * from "./walker";
|
|
17
17
|
export * from "./lexer";
|
|
18
18
|
export declare function rgxa(tokens: t.RGXToken[], flags?: string): ExtRegExp;
|
|
19
|
-
export default function rgx(flags?: string, multiline
|
|
19
|
+
export default function rgx(flags?: string, { multiline, verbatim }?: t.RGXOptions): (strings: TemplateStringsArray, ...tokens: t.RGXToken[]) => ExtRegExp;
|
|
20
20
|
export declare function rgxwa<R = unknown, S = unknown, T = unknown>(source: string, tokens: RGXTokenOrPart<R, S, T>[], options?: Omit<t.RGXWOptions<R, S>, "multiline">): RGXWalker<R, S>;
|
|
21
21
|
export declare function rgxw<R = unknown, S = unknown, T = unknown>(source: string, { multiline, verbatim, ...options }?: t.RGXWOptions<R, S>): (strings: TemplateStringsArray, ...tokens: RGXTokenOrPart<R, S, T>[]) => RGXWalker<R, S>;
|
package/dist/index.js
CHANGED
|
@@ -49,7 +49,7 @@ function rgxa(tokens, flags = '') {
|
|
|
49
49
|
const pattern = (0, concat_1.rgxConcat)(tokens, true, flags);
|
|
50
50
|
return (0, utils_1.createRegex)(pattern, flags, true);
|
|
51
51
|
}
|
|
52
|
-
function rgx(flags = '', multiline = true, verbatim = true) {
|
|
52
|
+
function rgx(flags = '', { multiline = true, verbatim = true } = {}) {
|
|
53
53
|
return (strings, ...tokens) => {
|
|
54
54
|
// It is safe to assert the result because we know there will be no parts passed in here.
|
|
55
55
|
return rgxa((0, internal_1.rgxTaggedTemplateToArray)(strings, tokens, multiline, verbatim), flags);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { RGXTokenOrPart } from "../walker";
|
|
2
|
-
export declare function rgxTaggedTemplateToArray<R = unknown, S = unknown, T = unknown>(
|
|
2
|
+
export declare function rgxTaggedTemplateToArray<R = unknown, S = unknown, T = unknown>(_strings: TemplateStringsArray, tokens: RGXTokenOrPart<R, S, T>[], multiline: boolean, verbatim: boolean): RGXTokenOrPart<R, S, T>[];
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rgxTaggedTemplateToArray = rgxTaggedTemplateToArray;
|
|
4
|
-
function rgxTaggedTemplateToArray(
|
|
4
|
+
function rgxTaggedTemplateToArray(_strings, tokens, multiline, verbatim) {
|
|
5
|
+
// Process the strings with escape sequences left alone.
|
|
6
|
+
const strings = _strings.raw;
|
|
5
7
|
const array = [];
|
|
6
8
|
for (let i = 0; i < Math.max(strings.length, tokens.length); i++) {
|
|
7
9
|
const isTokensEnd = i >= tokens.length;
|