{"id":19294174,"url":"https://github.com/holasoycael/make-mask","last_synced_at":"2025-10-08T16:09:32.306Z","repository":{"id":203449593,"uuid":"705441458","full_name":"holasoycael/make-mask","owner":"holasoycael","description":"👺✨ Biblioteca para criar mascaras de texto em Java Script moderno.","archived":false,"fork":false,"pushed_at":"2023-11-06T02:34:13.000Z","size":42,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T21:07:28.327Z","etag":null,"topics":["formatter","input","javascript-library","mask","text","typescript","utilities"],"latest_commit_sha":null,"homepage":"","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/holasoycael.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-16T02:24:52.000Z","updated_at":"2025-03-02T21:05:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"8045d6a2-c7fb-4737-8168-d25b3e147125","html_url":"https://github.com/holasoycael/make-mask","commit_stats":null,"previous_names":["holasoycael/make-mask"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holasoycael%2Fmake-mask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holasoycael%2Fmake-mask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holasoycael%2Fmake-mask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holasoycael%2Fmake-mask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/holasoycael","download_url":"https://codeload.github.com/holasoycael/make-mask/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250205958,"owners_count":21392156,"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":["formatter","input","javascript-library","mask","text","typescript","utilities"],"created_at":"2024-11-09T22:37:23.714Z","updated_at":"2025-10-08T16:09:27.242Z","avatar_url":"https://github.com/holasoycael.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `Make Mask`\n\n[![NPM](https://img.shields.io/npm/l/make-mask)](https://www.npmjs.com/package/make-mask)\n[![Coverage Status](https://coveralls.io/repos/github/holasoycael/make-mask/badge.svg?branch=main)](https://coveralls.io/github/holasoycael/make-mask?branch=main)\n[![npm](https://img.shields.io/npm/v/make-mask)](https://www.npmjs.com/package/make-mask)\n[![gzip size](https://img.badgesize.io/https://unpkg.com/make-mask/dist/make.min.js?compression=gzip)](https://unpkg.com/make-mask/dist/make.min.js)\n\n`make-mask` is a lightweight javascript library of approximately 1kb for working with text masks. It was built to solve problems mainly in HTML inputs with javascript free from any other library. It was designed to solve inputs, but it is also valid when used to print texts in a simple and objective way. I guarantee a secure library covered with tests and open source!\n\nIt is very simple to use to create masks using the patterns below:\n\n`0` — Digits\u003cbr /\u003e\nOnly numbers\n\n`9` — Optional digits\u003cbr /\u003e\nIndicates whether there will be a number or not\n\n`#` — Recursive digits\u003cbr /\u003e\nUse this pattern to create infinitely repeatable formulas\n\n`A` — Letters and numbers\u003cbr /\u003e\nUppercase, lowercase letters and numbers\n\n`S` — Letters\u003cbr /\u003e\nUppercase, lowercase letters\n\n## Installing\n\nUsing npm:\n```sh\nnpm install make-mask\n```\nUsing yarn:\n```sh\nyarn add make-mask\n```\nUsing jsDelivr CDN:\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/make-mask/dist/make.min.js\"\u003e\u003c/script\u003e\n```\nUsing unpkg CDN:\n```html\n\u003cscript src=\"https://unpkg.com/make-mask/dist/make.min.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n* [Vanilla JS](https://stackblitz.com/edit/vanillajs-make-mask) → [Preview](https://vanillajs-make-mask.stackblitz.io/)\n* [React](https://stackblitz.com/edit/react-make-mask) → [Preview](https://react-make-mask.stackblitz.io/)\n\n#\n### Default function arguments\n\nIt's very simple to use!\n\n```ts\nimport mask from 'make-mask'\n\nmask('12345678', '00000-000') // =\u003e 12345-678\n```\n\nType information about the function\n\n```ts\n/**\n * Returns the transformed value\n * @param   {string} value    original value\n * @param   {string} mask     syntax pattern\n * @param   {object} options  options object\n * @return  {string}          mask result\n*/\nfn(value, mask[ , options])\n```\n\n\n\n### Most common examples\n\n### `Date `\n\n```js\nmask('27101', '00/00/0000')     // =\u003e 27/10/1\nmask('271018', '00/00/0000')    // =\u003e 27/10/18\nmask('2710182', '00/00/0000')   // =\u003e 27/10/182\nmask('27101820', '00/00/0000')  // =\u003e 27/10/1820\n```\n\n### `Hour`\n\n```js\nmask('203', '00:00:00')     // =\u003e 20:3\nmask('2039', '00:00:00')    // =\u003e 20:39\nmask('20392', '00:00:00')   // =\u003e 20:39:2\nmask('203922', '00:00:00')  // =\u003e 20:39:22\n```\n\n### `ZIP Code`\n\n```js\nmask('01310', '00000-000')    // =\u003e 01310\nmask('013109', '00000-000')   // =\u003e 01310-9\nmask('0131093', '00000-000')  // =\u003e 01310-93\nmask('01310930', '00000-000') // =\u003e 01310-930\n```\n\n### `Money`\n\n```js\nconst options = { reverse: true }\nmask('6689', '#.##0,00', options)     // =\u003e 66,89\nmask('66899', '#.##0,00', options)    // =\u003e 668,99\nmask('668993', '#.##0,00', options)   // =\u003e 6.689,93\nmask('6689932', '#.##0,00', options)  // =\u003e 66.899,32\n```\n\n### `Telephone with DDD`\n\n```js\nconst m = '(00) 0000-0000'\nmask('11994132', m)     // =\u003e (11) 9413-2\nmask('119941325', m)    // =\u003e (11) 9413-25\nmask('1199413256', m)   // =\u003e (11) 9413-256\nmask('11994132568', m)  // =\u003e (11) 9413-2568\n```\n\n### `CPF`\n\n```js\nconst options = { reverse: true }\nconst m = '000.000.000-00'\nmask('6698', m, options)    // =\u003e 66-98\nmask('66980', m, options)   // =\u003e 669-80\nmask('669809', m, options)  // =\u003e 6.698-09\nmask('6698090', m, options) // =\u003e 66.980-90\n```\n\n### `CNPJ`\n\n```js\nconst options = { reverse: true }\nconst m = '00.000.000/0000-00'\nmask('0000', m, options)    // =\u003e 00-00\nmask('00001', m, options)   // =\u003e 000-01\nmask('000016', m, options)  // =\u003e 0000-16\nmask('0000168', m, options) // =\u003e 0/0001-68\n```\n\n### `IP Address`\n\n```js\nconst m = '099.099.099.099'\nmask('255255', m)       // =\u003e 255.255\nmask('25525525', m)     // =\u003e 255.255.25\nmask('2552552552', m)   // =\u003e 255.255.255.2\nmask('255255255255', m) // =\u003e 255.255.255.255\n```\n\n### We recommended for you\nMaybe when working with price values directly in inputs, this library is not suitable for your needs. And we recommend exploring the [make-currency](https://www.npmjs.com/package/make-currency) library!\n\n\n### License\n\n[MIT](/license)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholasoycael%2Fmake-mask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fholasoycael%2Fmake-mask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholasoycael%2Fmake-mask/lists"}