{"id":23221369,"url":"https://github.com/thesharks/jagtag-js","last_synced_at":"2025-08-19T10:32:23.325Z","repository":{"id":31053292,"uuid":"126734475","full_name":"TheSharks/JagTag-JS","owner":"TheSharks","description":"A JavaScript port of the JagTag text parsing language.","archived":false,"fork":false,"pushed_at":"2023-01-20T07:01:48.000Z","size":33251,"stargazers_count":17,"open_issues_count":16,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-07-31T09:35:00.864Z","etag":null,"topics":["discord","jagtag","jagtag-js","jagtag-notation","javascript"],"latest_commit_sha":null,"homepage":"https://thesharks.github.io/JagTag-JS","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheSharks.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null},"funding":{"ko_fi":"dougley","github":"dougley"}},"created_at":"2018-03-25T19:54:37.000Z","updated_at":"2022-10-20T02:16:42.000Z","dependencies_parsed_at":"2023-02-12T00:30:46.709Z","dependency_job_id":null,"html_url":"https://github.com/TheSharks/JagTag-JS","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheSharks%2FJagTag-JS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheSharks%2FJagTag-JS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheSharks%2FJagTag-JS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheSharks%2FJagTag-JS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheSharks","download_url":"https://codeload.github.com/TheSharks/JagTag-JS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230345955,"owners_count":18212000,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["discord","jagtag","jagtag-js","jagtag-notation","javascript"],"created_at":"2024-12-18T22:16:18.402Z","updated_at":"2024-12-18T22:16:19.186Z","avatar_url":"https://github.com/TheSharks.png","language":"TypeScript","funding_links":["https://ko-fi.com/dougley","https://github.com/sponsors/dougley"],"categories":[],"sub_categories":[],"readme":"# JagTag-JS\n\n![Codecov](https://img.shields.io/codecov/c/github/thesharks/jagtag-js.svg) ![License](https://img.shields.io/github/license/thesharks/jagtag-js.svg) \n\nA JavaScript port of the [JagTag text parsing language](https://github.com/jagrosh/JagTag), originally written in Java by [@jagrosh](https://github.com/jagrosh).\n\nThis readme only covers technical information about JagTag-JS, for more comprehensive documentation about JagTag itself please see [the Spectra wiki](https://github.com/jagrosh/Spectra/wiki/JagTag) and the [original JagTag repo](https://github.com/jagrosh/JagTag)\n\n## What is JagTag?\n\nJagTag is, in the author's own words, a simple yet powerful and customisable interpreted text parsing language. In practice, JagTag notation is used to customise user input with tags which use the format **{name:arg1|arg2}**.\n\n## How does this differ?\n\nFirst of all, the implementation of JagTag has been ported to JavaScript. The key thing to note here is that the actual code has not been ported due to language limitations. Instead, this system is essentially JagTag notation implemented in JavaScript with a slightly different methodology.\n\nDue to language-level limitations, some of the methods are also not fully compatible. This project has been developed with maximum compatibility in mind, but some minor changes have been made. More details can be found in the documentation.\n\nIt's worth noting that the Discord-related tag functions have been developed to suit [Eris](https://github.com/abalabahaha/eris) and have not been tested with other libraries. For now it's recommended to use Eris in conjunction with the Discord-related tags, if you wish to use those.\n\n## Installation and usage\n\nJagTag-JS is available on NPM and you can install it with `npm i @thesharks/jagtag-js`. Make sure you have Node.js \u003e= 8 installed.\n\nBasic syntax:\n\n```js\nimport JagTagParser from '@thesharks/jagtag-js'\n\nJagTagParser('string to parse', argsObject)\n```\n\nFor more information about the args object, see the [API reference](https://thesharks.github.io/JagTag-JS/interfaces/interfaces_iparserarguments.iparserarguments.html).\n\n### Simple example\n\nAt its most basic level, JagTag-JS can be used to perform simple string-related operations without any complications.\n\n```js\nimport JagTagParser from '@thesharks/jagtag-js'\n\nJagTagParser('change {upper:this} to uppercase')\n// Returns 'change THIS to uppercase'\n```\n\n### Advanced example\n\nMore advanced operations may require you to pass arguments to the parser in order to function correctly. Please check the [documentation](https://thesharks.github.io/JagTag-JS/interfaces/interfaces_iparserarguments.iparserarguments.html) for information on what parser-level arguments need to be passed for which method.\n\n```js\nimport JagTagParser from '@thesharks/jagtag-js'\n\nJagTagParser('{argslen} arguments were passed to this tag', { tagArgs: [ 'item1', 'item2', 'item3' ] })\n// Returns '3 arguments were passed to this tag'\n```\n\n### String interpolation\n\nSince Javascript will attempt to interpret strings such as `'\\d'` as character escapes, it's recommended to call the parser using `String.raw`.\n\n```js\nimport JagTagParser from '@thesharks/jagtag-js'\n\nJagTagParser('{replaceregex:\\d|with:#|in:I have 5 cats and 23 shirts}')\n// Returns: \"I have 5 cats an# 23 shirts\"\n// Probably not what you wanted!\n\nJagTagParser(String.raw`{replaceregex:\\d|with:#|in:I have 5 cats and 23 shirts}`)\n// Returns: \"I have # cats and ## shirts\"\n```\n\n## Contributing\n\nSee [CONTRIBUTING.md](.github/CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthesharks%2Fjagtag-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthesharks%2Fjagtag-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthesharks%2Fjagtag-js/lists"}