UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

22 lines 723 B
//#region src/string/match.d.ts /** * `match(target, source)` * * Returns the result of matching `target` string against `source` string or regular expression, or null if no match is found. * * ```ts * match("hello world", "world"); // ["world", index: 6, input: "hello world", groups: undefined] * match("hello world", /\d+/); // null * ``` * * ```ts * pipe("hello world", match("world")); // ["world", index: 6, input: "hello world", groups: undefined] * pipe("hello world", match(/\d+/)); // null * ``` */ declare const match: { (source: string | RegExp): (target: string) => RegExpMatchArray | null; (target: string, source: string | RegExp): RegExpMatchArray | null; }; //#endregion export { match };