match-to-token transform a RegExp named group match to a more useful object npm i match-to-token pnpm add match-to-token yarn add match-to-token API # matchToToken(match) # match null | RegExpMatchArray matchToToken(match) => null | Token # RegExpToken # constructor(pattern) # new RegExpToken() RegExpToken # pattern string | RegExp # new RegExpToken() RegExpToken # pattern string # flags string # new RegExpToken() RegExpToken # pattern string | RegExp # flags string # Token # constructor(value) # new Token() Token # value TokenJson # new Token() Token # value string # group string # source RegExpMatchArrayLike # group string # source RegExpMatchArrayLike # index # value # as(value, group) # value string # group = ... string as(value, group) => Token # is(group, value) # group string # value string is(group, value) => boolean # toJSON() toJSON() => TokenJson # create(value, group, source) # value string # group string # source RegExpMatchArrayLike create(value, group, source) => Token # RegExpMatchArrayLike # index number # input string # TokenJson # group string # source { # index number # input string # match string [] } # value string # matchToToken(match) # match null | RegExpMatchArray matchToToken(match) => null | Token Contributing Fork or edit and submit a PR. All contributions are welcome! License MIT © 2022 stagas