{"id":19908727,"url":"https://github.com/marcelo-ribeiro/smask","last_synced_at":"2025-05-03T02:31:20.022Z","repository":{"id":37676215,"uuid":"371562382","full_name":"marcelo-ribeiro/smask","owner":"marcelo-ribeiro","description":"Smask - Vanilla JS Mask","archived":false,"fork":false,"pushed_at":"2024-03-27T13:05:06.000Z","size":839,"stargazers_count":11,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T10:35:39.766Z","etag":null,"topics":["input-mask","js","mask","vanilla-javascript","vanilla-js"],"latest_commit_sha":null,"homepage":"https://marcelo-ribeiro.github.io/smask","language":"TypeScript","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/marcelo-ribeiro.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,"governance":null}},"created_at":"2021-05-28T02:53:34.000Z","updated_at":"2024-02-01T12:25:06.000Z","dependencies_parsed_at":"2023-02-15T10:46:25.886Z","dependency_job_id":"31e6304a-233d-420c-8e16-50dc8a96acfb","html_url":"https://github.com/marcelo-ribeiro/smask","commit_stats":{"total_commits":152,"total_committers":2,"mean_commits":76.0,"dds":0.006578947368421018,"last_synced_commit":"8b4a29790930234b1fede86177f75e59a98253b9"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelo-ribeiro%2Fsmask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelo-ribeiro%2Fsmask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelo-ribeiro%2Fsmask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelo-ribeiro%2Fsmask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcelo-ribeiro","download_url":"https://codeload.github.com/marcelo-ribeiro/smask/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252133699,"owners_count":21699582,"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":["input-mask","js","mask","vanilla-javascript","vanilla-js"],"created_at":"2024-11-12T21:13:05.757Z","updated_at":"2025-05-03T02:31:19.742Z","avatar_url":"https://github.com/marcelo-ribeiro.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **sMask**\n## A Vanilla JS Mask\n\n\u003cbr/\u003e\n\n## Install\n```\nnpm i smask\n```\n\u003cbr/\u003e\n\n## Usage\n```\nimport * as smask from \"smask\";\n```\n\u003cbr/\u003e\n\n# Masking values\n## Pattern format\n#### Single pattern\n```\nsmask.mask(\"123456\", [\"ddd.ddd\"]);\n// \"123.456\"\n```\n#### Multiple patterns\n```\nsmask.mask(\"123456789\", [\"ddd.ddd\", \"ddd.ddd.ddd\"]);\n// \"123.456.789\"\n```\n#### Unmask pattern\n```\nsmask.unmask(\"123.456\", \"ddd.ddd\");\n// \"123456\"\n```\n\u003cbr/\u003e\n\n## Number format\n\n#### Get masked number from current locale\n```\nsmask.number(1234.56);\n// \"1,234.56\" if in US English locale\n```\n#### Get masked number by passing locale\n```\nsmask.number(1234.56, \"en-US\");\n// \"1,234.56\"\n```\n#### Get unmasked number by passing locale\n```\nsmask.numberUnformat(\"1,234.56\", \"en-US\");\n// \"1234.56\"\n```\n\u003cbr/\u003e\n\n## Currency format\n#### Get masked currency from current locale and currency code\n```\nsmask.currency(1234.56);\n// \"$1,234.56\" if in US English locale\n```\n#### Get masked currency by passing locale and current currency code\n```\nsmask.currency(1234.56, \"en-US\");\n// \"$1,234.56\"\n```\n#### Get masked currency by passing the locale and currency code.\n```\nsmask.currency(1234.56, \"en-US\", \"USD\");\n// \"$1,234.56\"\n```\n#### Get unformatted currency by passing locale and currency code\n```\nsmask.currencyUnformat(\"$1,234.56\", \"en-US\", \"USD\");\n// 1234.56\n```\n\u003cbr/\u003e\n\n# Masking Inputs\n### Numbers\n```\nsmask.input(document.getElementById(\"phone\"), [\"ddd\"]);\n```\n### Letters\n```\nsmask.input(document.getElementById(\"letters\"), [\"aaa\"]);\n```\n### Letters Uppercase\n```\nsmask.input(document.getElementById(\"lettersUpper\"), [\"AAA\"]);\n```\n### Alphanumeric\n```\nsmask.input(document.getElementById(\"alphanum\"), [\"www\"]);\n```\n### Alphanumeric Uppercase\n```\nsmask.input(document.getElementById(\"alphanumUpper\"), [\"WWW\"]);\n```\n### Date\n```\nsmask.input(document.getElementById(\"date\"), [\"date\"]);\n```\n### Currency\n```\nsmask.input(document.getElementById(\"currency\"), [\"currency\"]);\n```\n\n### Single pattern\n```\nsmask.input(document.getElementById(\"phone\"), [\"(dd) ddddd-dddd\"]);\n```\n\n### Multiple patterns\n```\nsmask.input(document.getElementById(\"phoneOrCellphone\"), [\"(dd) dddd-dddd\", \"(dd) ddddd-dddd\"]);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelo-ribeiro%2Fsmask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcelo-ribeiro%2Fsmask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelo-ribeiro%2Fsmask/lists"}