https://github.com/stagas/match-to-token
transform a RegExp named group match to a more useful object
https://github.com/stagas/match-to-token
regexp regexp-match
Last synced: 3 months ago
JSON representation
transform a RegExp named group match to a more useful object
- Host: GitHub
- URL: https://github.com/stagas/match-to-token
- Owner: stagas
- License: mit
- Created: 2021-11-03T02:37:24.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-07T16:46:48.000Z (over 2 years ago)
- Last Synced: 2025-02-18T08:56:13.565Z (5 months ago)
- Topics: regexp, regexp-match
- Language: TypeScript
- Homepage:
- Size: 313 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#
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)
RegExpToken
# constructor
(pattern)
# new RegExpToken
()
# pattern
string | RegExp
new RegExpToken
() # new RegExpToken
() Token
# constructor
(value)
group
string
source
# index
value
as
(value, group) is
(group, value) # toJSON
()
toJSON() =>
create
(value, group, source) # RegExpMatchArrayLike
# TokenJson
# value
string
matchToToken
(match)
## Contributing
[Fork](https://github.com/stagas/match-to-token/fork) or [edit](https://github.dev/stagas/match-to-token) and submit a PR.
All contributions are welcome!
## License
MIT © 2022 [stagas](https://github.com/stagas)