1.3.6 • Published 3 months ago

tagged-comment-parser v1.3.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

tagged-comment-parser

This is a simple parser for tagged comments.

import { parse, tryParse } from "tagged-comment-parser";

const result = parse("@cached @alias:foo this comment is tagged!");
/*
result:
{
  "comment": "this comment is tagged!",
  "tags": {
    "cached": true,
    "alias": "foo"
  }
}
*/

// If you want to avoid exceptions, use tryParse
const result = tryParse(null);
/*
result:
{
  "comment": undefined,
  "tags": {}
}
*/

The tags can appear as the first xor last part of the string.

Syntax

  • '@tag' (no value specified): tag will have a value of true
  • '@tag:something' (value after colon): tag will be the string 'something'
  • '@tag(12, "some string")' (parentheses with multiple values): tag will be the array ["12", "some string"]
1.3.6

3 months ago

1.3.5

5 months ago

1.3.4

5 months ago

1.3.3

7 months ago

1.3.2

12 months ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago