UNPKG

@qntm-code/utils

Version:

A collection of useful utility functions with associated TypeScript types. All functions have been unit tested.

22 lines (21 loc) 803 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const isRegExp_1 = require("./isRegExp"); describe(`isRegExp`, () => { it(`should return true if value is a RegExp`, () => { const value = /x/; expect((0, isRegExp_1.isRegExp)(value)).toBe(true); }); it(`should return true if value is a RegExp (constructor)`, () => { const value = new RegExp('x'); expect((0, isRegExp_1.isRegExp)(value)).toBe(true); }); it(`should return false if value is not a RegExp`, () => { const value = RegExp; expect((0, isRegExp_1.isRegExp)(value)).toBe(false); }); it(`should return false if value is a string`, () => { const value = '/x/'; expect((0, isRegExp_1.isRegExp)(value)).toBe(false); }); });