{"id":21287779,"url":"https://github.com/levidavidmurray/input-formatter","last_synced_at":"2025-03-15T15:25:48.965Z","repository":{"id":41673684,"uuid":"166546260","full_name":"levidavidmurray/input-formatter","owner":"levidavidmurray","description":"Configurable input formatter to dynamically change input value","archived":false,"fork":false,"pushed_at":"2023-01-07T16:57:18.000Z","size":1895,"stargazers_count":1,"open_issues_count":19,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-24T06:02:51.419Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/levidavidmurray.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":"2019-01-19T12:50:31.000Z","updated_at":"2020-04-13T00:46:12.000Z","dependencies_parsed_at":"2023-02-07T17:00:50.134Z","dependency_job_id":null,"html_url":"https://github.com/levidavidmurray/input-formatter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levidavidmurray%2Finput-formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levidavidmurray%2Finput-formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levidavidmurray%2Finput-formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levidavidmurray%2Finput-formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/levidavidmurray","download_url":"https://codeload.github.com/levidavidmurray/input-formatter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243748151,"owners_count":20341637,"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":[],"created_at":"2024-11-21T12:15:50.953Z","updated_at":"2025-03-15T15:25:48.943Z","avatar_url":"https://github.com/levidavidmurray.png","language":"TypeScript","readme":"# Input Formatter\n\n\u003ca href=\"https://www.npmjs.com/package/@levidavidmurray/input-formatter\" alt=\"npm Repository Link\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/v/@levidavidmurray/input-formatter?logo=npm\" /\u003e\n\u003c/a\u003e\n\nInput that only allows numbers, and formats the input text to your desired format as you type.\n\n[Try it out!](https://levidavidmurray.github.io/input-formatter)\n\n\u003cimg src=\"https://github.com/levidavidmurray/phone-input-formatter/raw/master/public/showcase.gif\" alt=\"\" width=\"480\"\u003e\n\n## Usage\n```shell script\nyarn add @levidavidmurray/input-formatter\n```\n\n```typescript\nimport {InputFormatter} from '@levidavidmurray/input-formatter';\n\nconst formatter = InputFormatter({\n  formats: {\n    3: '(xxx',\n    6: '(xxx) xxx',\n    10: '(xxx) xxx-xxxx',\n    11: '+x (xxx) xxx-xxxx'\n  },\n  replaceChar: 'x',\n  skipFormatOpts: [{length: 10, position: 1, skip: false}],\n});\n\nformatter.on('#input');\n```\n\n## Formatter Config\n\n```js\n{\n  // `formats` takes a specified input max-length as a key, and the desired format \n  // for any numeric input string whose length is less than or equal to the max-length\n  formats: {\n    3: '(xxx',\n    6: '(xxx) xxx',\n    10: '(xxx) xxx-xxxx',\n    11: '+x (xxx) xxx-xxxx'\n  },\n\n  // `replaceChar` specifies the character to replace in each format string\n  replaceChar: 'x', // default 'x'\n\n  // `skipFormatOpts` an array specifying whether or not to skip formatting when\n  // the input length and caret position are at the specified length and position\n  skipFormatOpts: [{length: 10, position: 1, skip: false}],\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevidavidmurray%2Finput-formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flevidavidmurray%2Finput-formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevidavidmurray%2Finput-formatter/lists"}