{"id":16269543,"url":"https://github.com/av/your-script","last_synced_at":"2025-09-03T01:38:15.687Z","repository":{"id":57404219,"uuid":"38975795","full_name":"av/your-script","owner":"av","description":"Module allows you to create your own subset of JavaScript","archived":false,"fork":false,"pushed_at":"2015-10-04T09:53:18.000Z","size":168,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-02T19:45:07.478Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/av.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-12T19:56:46.000Z","updated_at":"2025-08-22T16:00:09.000Z","dependencies_parsed_at":"2022-09-11T00:51:11.708Z","dependency_job_id":null,"html_url":"https://github.com/av/your-script","commit_stats":null,"previous_names":["iamfrontender/your-script"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/av/your-script","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/av%2Fyour-script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/av%2Fyour-script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/av%2Fyour-script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/av%2Fyour-script/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/av","download_url":"https://codeload.github.com/av/your-script/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/av%2Fyour-script/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273377148,"owners_count":25094526,"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","status":"online","status_checked_at":"2025-09-02T02:00:09.530Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-10T18:08:35.326Z","updated_at":"2025-09-03T01:38:15.647Z","avatar_url":"https://github.com/av.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# your-script\nModule allows you to create your own subset of keywords for JavaScript\n\nDo you ever dreamed of MeowScript or BroScript? Now it's easier then ever.\n\n## Distribution\nThis module is distributed via npm, run `npm i your-script` just where you need it.\n\n## Usage\n\n#### Easy way:\n```javascript\nvar yourScript = require('your-script');\nvar yoscript = new yourScript();\n\nyoscript.parse('var barrio = foorio;');\n```\n\nAnd if you'll log the result of this operation, you'll see... No difference :) \nThis happens due the default `.lex` configurations, there is no difference \nbetween `javascript.lex` and `yourscript.lex` by default.\nSo, the easiest way to change keywords is just edit `yourscript.lex`\nin the way you like it and than translate everything from end to end.\n\nThis module is bundled with some dialects inside:\n* geoscript — keywords are random places on earth\n* meowscript — 50 shades of meow\n\n#### True way:\nThis module assumed to be used for creating custom `.lex` definitions,\nso create a folder somewhere, and put there `javascript.lex` \n(it's required for this module to work, default could be found in `lexems` folder), and\n`literally-any-script.lex`, when instantiating the `yourScript` instance, just pass the path (yeah), in config object:\n```javascript\nvar translator = new yourScript({\n  lexemsFolder: './per/some/folder/ad/lexems'\n  from: 'javascript',\n  to: 'somescript'\n});\n```\n\nNow you have a translator, which will replace all keywords in given source from `javascript` to `somescript` definitions.\nIf initial folder contains more then two file, it's totally ok, you can set the `source` and `destination` subsets right\nbefore parsing:\n\n```javascript\nvar translator = new yourScript({\n  lexemsFoalder: './lexems'\n});\n```\n\nand then...\n\n```javascript\ntranslator.parse(sourceString, {\n  from: 'subset you source written in'\n  to 'subset to translate your source to'\n});\n```\n\nnow we're ready to...\n\n## How to create MeowScript\n___\n\n* `npm i your-script` somewhere you like it\n* open `node_modules/your-script/lexems` folder\n* create `meowscript.lex` file\n* open `javascript.lex` somewhere nearby\n* replace all the keywords! The order doesn't matters, just be imaginative :)\nExample:\n```txt\nVAR meow\nLET meoww\nCONST meOw\nFOR meowwr\n...\n```\n* `var translator = require('your-script');`\n* \n```javascript\nmeowScript = new translator({\n  to: 'meowscript'\n});\n```\n\n* Pass some source through it:\n```txt\nvar kitty = new Kitty(); if (kitty.isHungry()) {kitty.feed()}\n                            ||\n                           \\||/\n                            \\/\nmeow kitty = MEW Kitty(); meeow (kitty.isHungry()) {kitty.feed()}\n\n```\n* Have fun :)\n\n## YourScript object interface:\n```java\n    /**\n     * Applies given config.\n     *\n     * @param {Object} config\n     *   @config {String} lexemsFolder Path to lookup for keywords\n     *   @config {String} sourceSubset Subset to parse from\n     *   @config {String} destinationSubset Subset to parse to\n     */\n    applyConfig: function(config)\n    \n    /**\n     * Parses the given string, translating it between subsets.\n     *\n     * @param {String} string Source to parse\n     * @param {Object} options\n     *   @config {String} sourceSubset Subset to parse from\n     *   @config {String} destinationSubset Subset to parse to\n     * @returns {String} translated source\n     */\n    parse: function (string, options)\n    \n    /**\n     * Replaces tokens with their translations from preset subsets.\n     *\n     * @param {String} string source, contains tokens from source subset\n     * @param {Object[]} tokens Array of esprima tokens to be used in replacing.\n     * @returns {String} source, contains target subset tokens\n     */\n    replaceTokens: function(string, tokens)\n    \n    /**\n     * Translates the keyword from the preset source subset to target subset.\n     *\n     * @param {String} keyword actual keyword value\n     * @returns {String} translated keyword\n     */\n    translate: function(keyword)\n    \n    /**\n     * Checks whether this token should be replaced or not.\n     *\n     * @param {Object} token esprima token\n     * @returns {Boolean} true if should be replaced\n     */\n    isTargetToken: function(token)\n    \n    /**\n     * Applies translation offset to the given position.\n     *\n     * @param {Number} position\n     * @returns {Number} position with offset\n     */\n    applyOffset: function(position)\n    \n    /**\n     * Increments translation offset (different subsets - different keyword length)\n     *\n     * @param {String} tokenValue\n     */\n    incrementOffset: function(tokenValue)\n```\n\n## Under the hood.\nThis module uses esprima fork, which supports custom keywords, can be found at:\n\nhttps://github.com/iamfrontender/esprima-custom-keywords\n\nAnd small yet useful keywords-provider:\n\nhttps://github.com/iamfrontender/keywords-provider\n\nCheers, mate!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fav%2Fyour-script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fav%2Fyour-script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fav%2Fyour-script/lists"}