{"id":23646826,"url":"https://github.com/anthgrim/general-formatter","last_synced_at":"2025-08-31T22:32:09.212Z","repository":{"id":61446888,"uuid":"551639889","full_name":"anthgrim/general-formatter","owner":"anthgrim","description":"general-formatter","archived":false,"fork":false,"pushed_at":"2023-01-26T00:41:57.000Z","size":24,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-28T10:42:06.378Z","etag":null,"topics":["currency-formatter","dateformatter","npm","npm-module","npm-package","package"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/general-formatter","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/anthgrim.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":"2022-10-14T19:51:50.000Z","updated_at":"2023-06-13T22:45:19.000Z","dependencies_parsed_at":"2023-02-14T12:45:38.540Z","dependency_job_id":null,"html_url":"https://github.com/anthgrim/general-formatter","commit_stats":null,"previous_names":["anthgrim/formatter-npm-package"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthgrim%2Fgeneral-formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthgrim%2Fgeneral-formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthgrim%2Fgeneral-formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthgrim%2Fgeneral-formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anthgrim","download_url":"https://codeload.github.com/anthgrim/general-formatter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231632873,"owners_count":18403398,"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":["currency-formatter","dateformatter","npm","npm-module","npm-package","package"],"created_at":"2024-12-28T13:40:34.034Z","updated_at":"2024-12-28T13:40:34.561Z","avatar_url":"https://github.com/anthgrim.png","language":"TypeScript","readme":"# general-formatter\n\n## [general-formatter](https://www.npmjs.com/package/general-formatter)\n\n## Description\n\nThis is a small npm package, with a few functions that I use very often. I got tired of having to code it many different projects :)\n\nThe functions a very straightforward. I'm using the `Intl` object from JavaScript that provides language sensitive string comparison, number formatting, and date-time formatting. Check the official MDN docs here [JS Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl)\n\n### Disclaimer\n\nThis is my first ever npm package, so if you have any suggestions or a better solution you are more than welcome to contribute to this project. Or if you want to keep adding more formatting or format validation functions :). But please let's keep it simple.\n\n## Installation\n\nFork this repository, and follow the git commands bellow:\n\n```\ncd \u003cYourProjectName\u003e\nnpm i general-formatter\n```\n\n## How to use?\n\ngeneral-formatter uses ES6 so you need to use imports :)\n\n```JavaScript\nimport {convertToMoneyString, convertToDateString, validateEmailFormat} from \"general-formatter\"\n```\n\n## Sample Functions\n\n### convertToMoneyString\n\nThis function takes a number amount, string country code, the style you want the number to be returned to, and the currency code\n\n```JavaScript\nconst myMoneyString = convertToMoneyString(29.465654023, \"en-US\", \"currency\", \"USD\")\n\nconsole.log(myMoneyString) // Logs $29.47\n```\n\n### convertToDateString\n\nThis function takes a date-like string, and a country code string referring to the country date format you want your date to be returned.\n\n```JavaScript\nconst myDateString = convertToDateString(\"2022-10-10T22:11:02.024+00:00\", \"en-US\")\n\nconsole.log(myDateString) // Logs 10/10/2022\n```\n\n### validateEmailFormat\n\nThis function takes an string, and uses regex to validate if the string has a valid email format.\n\n```JavaScript\nconst isValidEmail = validateEmailFormat(\"johndoe\")\n\nconsole.log(isValidEmail) // Logs false\n```\n\n## How to contribute\n\n- Fork this repository\n- Follow the git commands in your favorite terminal\n  ```bash\n  git clone git@github.com:\u003cgitHubUsername\u003e/formatter-npm-package.git\n  cd formatter-npm-package\n  git checkout -b \u003cNameYourNewBranch\u003e\n  ```\n- After adding your changes please commit the new branch and open a PR\n  ```bash\n  git add \u003cYourChanges\u003e\n  git commit -m \u003cYour changes comments\u003e\n  git push origin \u003cYour branch name\u003e\n  ```\n- Pull Request in GitHub [Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanthgrim%2Fgeneral-formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanthgrim%2Fgeneral-formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanthgrim%2Fgeneral-formatter/lists"}