Should the flags be exposed as a record or as some canonicalised string? Either way, should there be a function for converting between the two formats?
edit: JS RegExp flags can be retrieved as a string like this:
function flags(re) {
var s = '' + re;
return s.slice(s.lastIndexOf('/') + 1);
}
or as a record like this:
function flags(re) {
return {
multiline: re.multiline,
ignoreCase: re.ignoreCase,
global: re.global,
sticky: !!re.sticky,
unicode: !!re.unicode
};
}
Should the flags be exposed as a record or as some canonicalised string? Either way, should there be a function for converting between the two formats?
edit: JS RegExp flags can be retrieved as a string like this:
or as a record like this: