UNPKG

test-openapi

Version:
18 lines (14 loc) 383 B
'use strict' // Check RegExp string against a value. // Can be an array for alternatives. const testRegExp = function(regExp, value) { if (Array.isArray(regExp)) { return regExp.some(regExpA => testRegExp(regExpA, value)) } // Always matched case-insensitively const regExpB = new RegExp(regExp, 'iu') return regExpB.test(value) } module.exports = { testRegExp, }