{"id":21835739,"url":"https://github.com/vtex/msk","last_synced_at":"2025-04-14T09:15:06.842Z","repository":{"id":46933634,"uuid":"96364528","full_name":"vtex/msk","owner":"vtex","description":"Small library to mask strings","archived":false,"fork":false,"pushed_at":"2023-07-11T13:23:21.000Z","size":464,"stargazers_count":24,"open_issues_count":15,"forks_count":3,"subscribers_count":155,"default_branch":"master","last_synced_at":"2025-03-27T22:39:17.777Z","etag":null,"topics":["srv-my-account","xp-post-purchase"],"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/vtex.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-07-05T21:59:04.000Z","updated_at":"2024-12-03T13:00:10.000Z","dependencies_parsed_at":"2024-01-06T23:58:45.602Z","dependency_job_id":"1b9022af-baab-4cba-8095-c3d22b92850b","html_url":"https://github.com/vtex/msk","commit_stats":{"total_commits":19,"total_committers":3,"mean_commits":6.333333333333333,"dds":"0.42105263157894735","last_synced_commit":"4be6878a41604b319153eb810386a200ace51992"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Fmsk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Fmsk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Fmsk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Fmsk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vtex","download_url":"https://codeload.github.com/vtex/msk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248815702,"owners_count":21165969,"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":["srv-my-account","xp-post-purchase"],"created_at":"2024-11-27T20:24:18.399Z","updated_at":"2025-04-14T09:15:06.817Z","avatar_url":"https://github.com/vtex.png","language":"JavaScript","funding_links":[],"categories":["Framework agnostic packages"],"sub_categories":["General utilities"],"readme":"# msk [![Build Status](https://travis-ci.org/vtex/msk.svg?branch=master)](https://travis-ci.org/vtex/msk)\n\n\u003e Small library to mask strings\n\n## Install\n\n```sh\n$ npm install msk\n```\n\n## Usage\n\n```js\nconst msk = require(\"msk\");\n\nmsk(\"552122222222\", \"+99 (99) 9999-9999\")\n// \"+55 (21) 2222-2222\"\n\nmsk.fit(\"22231-0004131\", \"99999-999\")\n// \"22231-000\"\n``` \n\n## API\n\n### msk(str, mask)\n\nReturns a formatted string based on the mask prodived\n\n#### str\n\nType: `string`\n\nA string to apply the mask.\n\n#### mask\n\nType: `string`\n\nA mask is formed based on the following symbols:\n\nSymbol | Accepts\n---|---\n`9` | Numbers (`[0-9]`)\n`A` | Letters (`[A-ú]`)\n`S` | Alphanumeric chars (`[A-ú0-9]`)\n`*` | Anything\nother char | Specified char\n\n### msk.fit(str, mask)\n\nReturns a formatted string removing the exceeding characters.\n\n\n## Examples\n\n```js\nmsk(\"552122222222\", \"+99 (99) 9999-9999\")\n// \"+55 (21) 2222-2222\"\n```\n\n```js\nmsk(\"V6G1C9\", \"A9A 9A9\")\n// \"V6G 1C9\"\n```\n\n```js\nmsk(\"I love msk\", \"*-****-***\")\n// \"I-love-msk\"\n```\n\n```js\nmsk.fit(\"22231-0004131\", \"99999-999\")\n// \"22231-000\"\n```\n\n## License\n\nMIT © [VTEX](https://www.vtex.com)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvtex%2Fmsk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvtex%2Fmsk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvtex%2Fmsk/lists"}