test-string
Version:
Checks if a string matches given string, RegExp or function.
15 lines • 545 B
TypeScript
/** @module test-string
*/
declare module "test-string" {
/**
* @function
* @param {string} haystack
* @param {string|Function|RegExp} tester
* @returns {boolean} `true` if given `tester` says that given `haystack` matches the conditions
* @example
* import testString from "test-string"
* const result = testString("hello", string => string.startsWith("hell"))
* result === true
*/
export default function(haystack: string, tester: string | ((...params: any[]) => any) | RegExp): boolean;
}