@monstermann/fn
Version:
A utility library for TypeScript.
24 lines (22 loc) • 429 B
JavaScript
import { dfdlT } from "@monstermann/dfdl";
//#region src/function/isRegExp.ts
/**
* `isRegExp(target)`
*
* Checks if a value is a RegExp instance.
*
* ```ts
* isRegExp(/hello/); // true
* isRegExp("hello"); // false
* ```
*
* ```ts
* pipe(/hello/, isRegExp()); // true
* pipe("hello", isRegExp()); // false
* ```
*/
const isRegExp = dfdlT((target) => {
return target instanceof RegExp;
}, 1);
//#endregion
export { isRegExp };