match-to-token
TypeScript icon, indicating that this package has built-in type declarations

3.1.0 • Public • Published

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)  =>

# RegExpToken

    # constructor(pattern)

# Token
# is(group, value)

    # group

      string

    # value

      string

    is(group, value)  =>

      boolean
# toJSON()
# create(value, group, source)
# RegExpMatchArrayLike

    # index

      number

    # input

      string

# TokenJson

    # group

      string

    # source

      {

      # index

        number

      # input

        string

      # match

        string []

      }

# value

    string

# matchToToken(match)

    # match

      null | RegExpMatchArray

    matchToToken(match)  =>

Contributing

Fork or edit and submit a PR.

All contributions are welcome!

License

MIT © 2022 stagas

Readme

Keywords

none

Package Sidebar

Install

npm i match-to-token

Weekly Downloads

58

Version

3.1.0

License

MIT

Unpacked Size

51.4 kB

Total Files

23

Last publish

Collaborators

  • stagas