{"id":19824762,"url":"https://github.com/stephangeorg/postal-code-helpers","last_synced_at":"2025-05-01T13:31:38.396Z","repository":{"id":40518591,"uuid":"259725297","full_name":"StephanGeorg/postal-code-helpers","owner":"StephanGeorg","description":"Helpers for intl. postal codes.","archived":false,"fork":false,"pushed_at":"2023-01-08T04:33:51.000Z","size":241,"stargazers_count":4,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-16T05:08:07.172Z","etag":null,"topics":["extraction","postal","postal-codes","postcode","postcodes","validation"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/StephanGeorg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-28T18:57:02.000Z","updated_at":"2023-01-01T14:04:22.000Z","dependencies_parsed_at":"2023-02-08T04:46:35.410Z","dependency_job_id":null,"html_url":"https://github.com/StephanGeorg/postal-code-helpers","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephanGeorg%2Fpostal-code-helpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephanGeorg%2Fpostal-code-helpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephanGeorg%2Fpostal-code-helpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StephanGeorg%2Fpostal-code-helpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StephanGeorg","download_url":"https://codeload.github.com/StephanGeorg/postal-code-helpers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251881705,"owners_count":21659145,"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":["extraction","postal","postal-codes","postcode","postcodes","validation"],"created_at":"2024-11-12T11:05:49.750Z","updated_at":"2025-05-01T13:31:38.087Z","avatar_url":"https://github.com/StephanGeorg.png","language":"JavaScript","readme":"# Postal code helpers [![npm version](https://badge.fury.io/js/postal-code-helpers.svg)](https://badge.fury.io/js/postal-code-helpers)\n\nLightweight helpers for working with [international postal code](#supported-countries) data to [extract](#extract-postal-code-from-string), [validate](#validate-postal-code) or [locate](#locate-countries-for-postal-codes) postal codes based on [GeoNames](https://www.geonames.org/postal-codes/) data.\n\n## Installation\n\n```\nnpm i postal-code-helpers\n```\n\n```javascript\nimport postalCodeHelpers from 'postal-code-helpers';\n```\n\n## Usage\n### Extract postal code from string\n\n```javascript\n\npostalCodeHelpers.extract('this is a postal code 10999', 'DE'); \n// ['10999']\n\npostalCodeHelpers.extract('this .10247, is a r23412345341 postal code 10999', 'DE'); \n// ['10247', '10999']\n\npostalCodeHelpers.extract('this is a post code 1099921342345 inside a 1024 string', 'DE'); \n// null\n\n```\n\n### Validate postal code\n\nValidates a postal codes against the country pattern. Attention: This validation does not check whether a postal code actually exists!\n\n```javascript\n\npostalCodeHelpers.validate('10999', 'DE');\n// true\n\npostalCodeHelpers.validate('1234', 'DE'); \n// false\n\n```\n\n### Locate countries for postal codes\n\n```javascript\n\npostalCodeHelpers.locate('SE1 6DR'); \n// [ 'GB' ]\n\npostalCodeHelpers.locate('this is not a postal code'); \n// null\n\n```\n\n## Data source\nGeonames\n\n## Supported countries\n\nAD, AL, AM, AR, AS, AT, AU, AX, AZ, BA, BB, BD, BE, BG, BH, BL, BM, BN, BR, BY, CA, CH, CL, CN, CO, CS, CR, CU, CV, CX, CY, CZ, DE, DK, DO, DZ, EC, EE, EG, ES, ET, FI, FM, FO, FR, GB, GE, GF, GG, GL, GP, GR, GT, GU, GW, HN, HR, HT, HU, ID, IE, IL, IM, IN, IQ, IR, IS, IT, JE, JO, JP, KE, KG, KH, KP, KR, KW, KZ, LA, LB, LI, LK, LR, LS, LT, LU, LV, MA, MC, MD, ME, MF, MG, MH, MK, MM, MN, MP, MQ, MT, MV, MW, MX, MY, MZ, NC, NE, NF, NG, NI, NL, NO, NP, NZ, OM, PF, PG, PH, PK, PL, PM, PR, PT, PW, PY, RE, RO, RS, RU, SA, SD, SE, SG, SH, SI, SJ, SK, SM, SN, SO, SV, SZ, TC, TH, TJ, TM, TN, TR, TW, UA, US, UY, UZ, VA, VE, VI, VN, WF, YT, ZA, ZM\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephangeorg%2Fpostal-code-helpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephangeorg%2Fpostal-code-helpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephangeorg%2Fpostal-code-helpers/lists"}