MCPcopy Create free account
hub / github.com/cure53/DOMPurify / isRegex

Function isRegex

src/utils.ts:343–355  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

341}
342
343function isRegex(value: unknown): value is RegExp {
344 // Skip the try for absent values: a thrown TypeError is slow
345 if (!value) {
346 return false;
347 }
348
349 try {
350 regExpTest(value as RegExp, '');
351 return true;
352 } catch {
353 return false;
354 }
355}
356
357export {
358 // Array

Callers 1

_parseConfigFunction · 0.85

Calls 1

regExpTestFunction · 0.85

Tested by

no test coverage detected