Skip to content

Commit

Permalink
version 2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
stagas committed Jan 22, 2022
1 parent e2711d8 commit f479914
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 30 deletions.
63 changes: 34 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,65 +54,70 @@ for (const match of matches) {

#### Table of Contents

* [matchToToken](#matchtotoken)
* [Parameters](#parameters)
* [Token](#token)
* [Parameters](#parameters-1)
* [group](#group)
* [value](#value)
* [index](#index)
* [TokenReturn](#tokenreturn)
* [matchToToken](#matchtotoken)
* [Parameters](#parameters)
* [source](#source)

### matchToToken

[src/index.ts:20-28](https://github.com/stagas/match-to-token/blob/e2711d8f14f9d1fe3b5bdfa8f9e8883991c08256/src/index.ts#L20-L28 "Source code on GitHub")

Convert a match object from `string.match()` or `string.matchAll()`
with a named group RegExp such as `/(?<group>[a-z])/` to a more
useful [Token](#token) object.

#### Parameters

* `match` **(RegExpMatchArray | null)** The match object

Returns **(MatchToken | null)**&#x20;

### Token

[src/index.ts:6-19](https://github.com/stagas/match-to-token/blob/66e05f167b9cddf7cca8418f3938683f65c2f1d8/src/index.ts#L6-L19 "Source code on GitHub")
[src/token.ts:6-44](https://github.com/stagas/match-to-token/blob/e2711d8f14f9d1fe3b5bdfa8f9e8883991c08256/src/token.ts#L6-L44 "Source code on GitHub")

**Extends String**

Token interface

#### Parameters

* `value` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
* `group` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
* `source` **RegExpMatchArrayLike**&#x20;

#### group

[src/index.ts:10-10](https://github.com/stagas/match-to-token/blob/66e05f167b9cddf7cca8418f3938683f65c2f1d8/src/index.ts#L10-L10 "Source code on GitHub")
[src/token.ts:13-13](https://github.com/stagas/match-to-token/blob/e2711d8f14f9d1fe3b5bdfa8f9e8883991c08256/src/token.ts#L13-L13 "Source code on GitHub")

The group it matched.

Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)

#### value

[src/index.ts:14-14](https://github.com/stagas/match-to-token/blob/66e05f167b9cddf7cca8418f3938683f65c2f1d8/src/index.ts#L14-L14 "Source code on GitHub")
[src/token.ts:17-19](https://github.com/stagas/match-to-token/blob/e2711d8f14f9d1fe3b5bdfa8f9e8883991c08256/src/token.ts#L17-L19 "Source code on GitHub")

The value of the match.

Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)

#### index

[src/index.ts:18-18](https://github.com/stagas/match-to-token/blob/66e05f167b9cddf7cca8418f3938683f65c2f1d8/src/index.ts#L18-L18 "Source code on GitHub")
[src/token.ts:23-25](https://github.com/stagas/match-to-token/blob/e2711d8f14f9d1fe3b5bdfa8f9e8883991c08256/src/token.ts#L23-L25 "Source code on GitHub")

The index position of the match.

Type: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)

### TokenReturn

[src/index.ts:24-24](https://github.com/stagas/match-to-token/blob/66e05f167b9cddf7cca8418f3938683f65c2f1d8/src/index.ts#L21-L23 "Source code on GitHub")

The return value type.

Type: ([Token](#token) | void)
#### source

### matchToToken

[src/index.ts:33-49](https://github.com/stagas/match-to-token/blob/66e05f167b9cddf7cca8418f3938683f65c2f1d8/src/index.ts#L33-L49 "Source code on GitHub")

Convert a match object from `string.match()` or `string.matchAll()`
with a named group RegExp such as `/(?<group>[a-z])/` to a more
useful [Token](#token) object.

#### Parameters
[src/token.ts:29-29](https://github.com/stagas/match-to-token/blob/e2711d8f14f9d1fe3b5bdfa8f9e8883991c08256/src/token.ts#L29-L29 "Source code on GitHub")

* `match` **RegExpMatchArray** The match object
The input string.

Returns **[TokenReturn](#tokenreturn)**
Type: RegExpMatchArrayLike

## Contribute

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "stagas",
"short": "stagas/match-to-token",
"description": "transform a RegExp named group match to a more useful object",
"version": "2.0.0",
"version": "2.0.1",
"license": "MIT",
"repository": {
"type": "git",
Expand Down

0 comments on commit f479914

Please sign in to comment.