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
|
# matchToToken
(match)
# match
matchToToken(match) =>
# RegExpToken
# constructor
(pattern)
# new RegExpToken
()
# new RegExpToken
()
# new RegExpToken
()
# Token
# constructor
(value)
# new Token
()
# new Token
()
# group
# source
# index
# value
# as
(value, group)
# value
# group
= ...
as(value, group) =>
# is
(group, value)
# group
# value
is(group, value) =>
# toJSON
()
# create
(value, group, source)
# value
# group
# source
create(value, group, source) =>
# RegExpMatchArrayLike
# TokenJson
# group
# source
{
# index
# input
# match
}
# value
# matchToToken
(match)
# match
matchToToken(match) =>
Fork or edit and submit a PR.
All contributions are welcome!
MIT © 2022 stagas