{"id":25195974,"url":"https://github.com/simplisticated/zip-monster","last_synced_at":"2025-05-08T17:11:07.837Z","repository":{"id":58933270,"uuid":"501944940","full_name":"simplisticated/zip-monster","owner":"simplisticated","description":"The most reliable solution for working with US zip codes. Free replacement for paid APIs.","archived":false,"fork":false,"pushed_at":"2024-06-21T06:27:10.000Z","size":4105,"stargazers_count":98,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-08T17:03:59.905Z","etag":null,"topics":["postal-code","united-states","zipcode"],"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/simplisticated.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-10T07:33:33.000Z","updated_at":"2025-01-25T20:55:22.000Z","dependencies_parsed_at":"2024-05-16T06:38:19.398Z","dependency_job_id":null,"html_url":"https://github.com/simplisticated/zip-monster","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplisticated%2Fzip-monster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplisticated%2Fzip-monster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplisticated%2Fzip-monster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplisticated%2Fzip-monster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simplisticated","download_url":"https://codeload.github.com/simplisticated/zip-monster/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253112073,"owners_count":21856070,"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":["postal-code","united-states","zipcode"],"created_at":"2025-02-10T01:39:15.951Z","updated_at":"2025-05-08T17:11:05.924Z","avatar_url":"https://github.com/simplisticated.png","language":"TypeScript","readme":"\u003cp align=\"center\"\u003e\r\n    \u003ca href=\"https://nodejs.org\"\u003e\r\n        \u003cimg src=\"https://img.shields.io/badge/Created for-Node.js-teal.svg?style=flat\"\u003e\r\n    \u003c/a\u003e\r\n    \u003ca href=\"https://www.typescriptlang.org\"\u003e\r\n        \u003cimg src=\"https://img.shields.io/badge/Written in-TypeScript-purple.svg?style=flat\"\u003e\r\n    \u003c/a\u003e\r\n    \u003ca href=\"https://tldrlegal.com/license/mit-license\"\u003e\r\n        \u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg?style=flat\"\u003e\r\n    \u003c/a\u003e\r\n\u003c/p\u003e\r\n\r\n## At a Glance\r\n\r\n**ZipMonster** is a library that simplifies work with zip codes and addresses in the United States. This solution is a reliable replacement for paid APIs that you can find on the Internet.\r\n\r\n## How to Get Started\r\n\r\nType in Terminal:\r\n\r\n```\r\nnpm install --save @simplisticated/zip-monster\r\n```\r\n\r\nor, if you prefer **yarn** over **npm**, type:\r\n\r\n```\r\nyarn add @simplisticated/zip-monster\r\n```\r\n\r\nThen add import instruction to your code:\r\n\r\n```typescript\r\nimport ZipMonster from '@simplisticated/zip-monster'\r\n```\r\n\r\n## Requirements\r\n\r\nIt's strongly recommended to add `NODE_OPTIONS` flag to your `.env` file:\r\n\r\n```\r\nNODE_OPTIONS=--max-old-space-size=\u003cAVAILABLE RAM SIZE IN MB\u003e\r\n```\r\n\r\nFor example, if you have 2GB RAM:\r\n\r\n```\r\nNODE_OPTIONS=--max-old-space-size=2048\r\n```\r\n\r\n## Usage\r\n\r\nEverything starts from `ZipMonster` object.\r\n\r\nThe main method is `ZipMonster.find`. It's a super flexible way to search the information.\r\n\r\n----\r\n\r\n### Search by zip code\r\n\r\nIf you know exactly what zip code you're looking for, simply write:\r\n\r\n```typescript\r\nZipMonster.find({\r\n    zip: \"91360\"\r\n})\r\n```\r\n\r\nIn response, you will receive an array of `ZipInformation` objects that correspond to your search request. Each object includes the following data:\r\n\r\n```typescript\r\n{\r\n    stateCode: \"CA\",\r\n    city: \"Thousand Oaks\",\r\n    county: \"Ventura\",\r\n    zip: \"91360\",\r\n    zipType: \"Non-Unique\",\r\n    location: {\r\n        latitude: 34.2090940366232,\r\n        longitude: -118.875059125606\r\n    }\r\n}\r\n```\r\n\r\nTo get city name, you can write:\r\n\r\n```typescript\r\nconst zipCodes = ZipMonster.find({\r\n    zip: \"91360\"\r\n});\r\nconst city = zipCodes[0].city // Thousand Oaks\r\n```\r\n\r\n----\r\n\r\n### Search by city\r\n\r\nYou can also search by city:\r\n\r\n```typescript\r\nZipMonster.find({\r\n    city: \"Thousand Oaks\"\r\n})\r\n```\r\n\r\nThe expression above will return array of `ZipInformation` objects related to Thousand Oaks.\r\n\r\nAlso, you can search by part of city name:\r\n\r\n```typescript\r\nZipMonster.find({\r\n    city: {\r\n        value: \"THOUSAND\",\r\n        caseSensitive: false,\r\n        wholeMatch: false\r\n    }\r\n})\r\n```\r\n\r\nwhich returns zip code information for all cities that contain `THOUSAND` in the name.\r\n\r\n----\r\n\r\n### Search by county\r\n\r\n```typescript\r\nZipMonster.find({\r\n    county: \"Vermont\"\r\n})\r\n```\r\n\r\nor\r\n\r\n```typescript\r\nZipMonster.find({\r\n    county: {\r\n        value: \"vermont\",\r\n        caseSensitive: false,\r\n        wholeMatch: true\r\n    }\r\n})\r\n```\r\n\r\n----\r\n\r\n### Search by state\r\n\r\n```typescript\r\nZipMonster.find({\r\n    stateCode: \"CA\"\r\n})\r\n```\r\n\r\n----\r\n\r\n### Search by location\r\n\r\nLet's find cities that are further to north than Palo Alto. That's a very simple task:\r\n\r\n```typescript\r\nconst PaloAlto = ZipMonster.find({\r\n    city: \"Palo Alto\",\r\n    stateCode: \"CA\",\r\n    withLocationOnly: true\r\n})[0];\r\nconst placesFurtherToNorth = ZipMonster.find({\r\n    location: {\r\n        latitude: {\r\n            value: PaloAlto.location!.latitude,\r\n            direction: \"to-north\"\r\n        }\r\n    }\r\n});\r\nplacesFurtherToNorth.length // 21404 places are further to north than Palo Alto\r\n```\r\n\r\n----\r\n\r\n### Combine search parameters\r\n\r\nYou can also combine search parameters with each other:\r\n\r\n```typescript\r\nconst result = ZipMonster.find({\r\n    city: {\r\n        value: \"THOUSAND\",\r\n        caseSensitive: false,\r\n        wholeMatch: false\r\n    },\r\n    county: {\r\n        value: \"Vent\",\r\n        caseSensitive: false,\r\n        wholeMatch: false\r\n    },\r\n    stateCode: \"CA\"\r\n})\r\nconst city = result[0].city // Thousand Oaks\r\n```\r\n\r\n----\r\n\r\n### What about more complicated logic?\r\n\r\nLet's find all zip codes between Austin and Oklahoma City:\r\n\r\n```typescript\r\n// Take the first zip code in Austin\r\nconst Austin = ZipMonster.find({\r\n    city: \"Austin\",\r\n    stateCode: \"TX\",\r\n    withLocationOnly: true\r\n})[0];\r\n\r\n// Find places to north and east from Austin\r\nconst placesToNorthFromAustin = ZipMonster.find({\r\n    location: {\r\n        latitude: {\r\n            value: Austin.location!.latitude,\r\n            direction: \"to-north\"\r\n        },\r\n        longitude: {\r\n            value: Austin.location!.longitude,\r\n            direction: \"to-east\"\r\n        }\r\n    }\r\n});\r\n\r\n// Take the first zip code in Oklahoma City\r\nconst OklahomaCity = ZipMonster.find({\r\n    city: \"Oklahoma City\",\r\n    stateCode: \"OK\",\r\n    withLocationOnly: true\r\n})[0];\r\n\r\n// Find places to south and west from Oklahoma City, but stop at Austin\r\nconst placesBetweenAustinAndOklahomaCity = ZipMonster.find({\r\n    location: {\r\n        latitude: {\r\n            value: OklahomaCity.location!.latitude,\r\n            direction: \"to-south\"\r\n        },\r\n        longitude: {\r\n            value: OklahomaCity.location!.longitude,\r\n            direction: \"to-west\"\r\n        }\r\n    },\r\n    source: placesToNorthFromAustin\r\n});\r\n\r\nplacesBetweenAustinAndOklahomaCity.length // 79 zip codes found\r\n```\r\n\r\n----\r\n\r\n### Other cases\r\n\r\nIf you don't use any filter with the method, it will return information about **all existing zip codes**:\r\n\r\n```typescript\r\nconst zipCodes = ZipMonster.find();\r\nzipCodes.length // more than 40k zip codes in the array\r\n```\r\n\r\n----\r\n\r\n## License\r\n\r\n**ZipMonster** is available under the MIT license. See the [LICENSE](./LICENSE) file for more info.\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplisticated%2Fzip-monster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimplisticated%2Fzip-monster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplisticated%2Fzip-monster/lists"}