@yookue/ts-lang-utils
    Preparing search index...

    Function isCompilable

    • Returns whether the given pattern can be compiled to a regex

      Parameters

      • Optionalpattern: null | string

        the pattern to check

      • Optionalflags: string

        any combination of flag values

      Returns boolean

      whether the given pattern can be compiled to a regex

      David Hsing

      isCompilable(undefined);    // false
      isCompilable('foobar'); // true
      isCompilable('[a-zA-Z0-9]+', 'g'); // true