{"_id":"@akylas/address-formatter","_rev":"2-04b6094faa2c13e637508febed15839f","name":"@akylas/address-formatter","description":"Universal international address formatting in Javascript","dist-tags":{"latest":"5.3.1"},"versions":{"5.2.1":{"name":"@akylas/address-formatter","version":"5.2.1","keywords":["address","geography","geodata"],"author":{"name":"Jirka Chadima","email":"chadima.jiri@gmail.com"},"license":"MIT","_id":"@akylas/address-formatter@5.2.1","maintainers":[{"name":"farfromrefuge","email":"martin.guillon@akylas.fr"}],"homepage":"https://github.com/Akylas/address-formatter#readme","bugs":{"url":"https://github.com/Akylas/address-formatter/issues"},"dist":{"shasum":"28629ec29169f88f80c316721b93db4e678791b0","tarball":"https://registry.npmjs.org/@akylas/address-formatter/-/address-formatter-5.2.1.tgz","fileCount":18,"integrity":"sha512-7WYXKhy7DIqLWeiIzScL+9DxDSjQVjMLlcjysPuWZGCCrHSF/1ipqmWsL1Lzr5Bi5iq25DtvuoIRk8KXIFr6Nw==","signatures":[{"sig":"MEYCIQCzoT0dd1APYg/p4lFc8wrNJd+XZqKKzbCDfEakVgUGbwIhAPBU947MUN16Q5ERjZwGALrXXOwlfyf3+tNLvcS5cFMQ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1125049},"jest":{"testRegex":"./test/.*.spec.js","coverageReporters":["text","lcov"],"collectCoverageFrom":["src/**/*.js"],"testPathIgnorePatterns":["/node_modules/"]},"main":"dist/cjs/address-formatter.js","types":"index.d.ts","module":"dist/es/address-formatter.js","browser":"dist/umd/address-formatter.js","engines":{"node":">=14.0.0"},"gitHead":"8f1cc329bc057b1d8da51d3d0816a3fa76847b0b","scripts":{"lint":"semistandard src test","test":"rimraf coverage && jest --coverage","build":"rollup -c rollup.config.js","clean":"rimraf dist && rimraf src/templates/*.json","test:ci":"rimraf coverage && jest --coverage --ci","lint:fix":"semistandard --fix src test","test:watch":"jest --watch --coverage","collect-aliases":"node management/collect-aliases.js","pull-submodules":"git submodule init && git submodule update","prepare-templates":"node management/prepare-templates.js"},"_npmUser":{"name":"farfromrefuge","email":"martin.guillon@akylas.fr"},"repository":{"url":"git+https://github.com/Akylas/address-formatter.git","type":"git"},"_npmVersion":"9.7.1","description":"Universal international address formatting in Javascript","directories":{},"_nodeVersion":"18.10.0","dependencies":{"mustache":"^4.0.0"},"semistandard":{"env":["jest"]},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.0.1","eslint":"^8.6.0","rimraf":"^5.0.0","rollup":"^2.0.0","js-yaml":"^4.0.0","babel-jest":"^29.0.1","@babel/core":"^7.8.6","babel-loader":"^9.0.0","semistandard":"^17.0.0","@babel/preset-env":"^7.8.6","@rollup/plugin-json":"^6.0.0","@rollup/plugin-alias":"^5.0.1","@rollup/plugin-babel":"^6.0.0","rollup-plugin-terser":"^7.0.0","@rollup/plugin-commonjs":"^25.0.0","@rollup/plugin-node-resolve":"^15.0.0","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-proposal-class-properties":"^7.8.3","@babel/plugin-proposal-object-rest-spread":"^7.8.3"},"_npmOperationalInternal":{"tmp":"tmp/address-formatter_5.2.1_1697744127797_0.0950085747226812","host":"s3://npm-registry-packages"}},"5.3.0":{"name":"@akylas/address-formatter","version":"5.3.0","keywords":["address","geography","geodata"],"author":{"name":"Jirka Chadima","email":"chadima.jiri@gmail.com"},"license":"MIT","_id":"@akylas/address-formatter@5.3.0","maintainers":[{"name":"farfromrefuge","email":"martin.guillon@akylas.fr"}],"homepage":"https://github.com/Akylas/address-formatter#readme","bugs":{"url":"https://github.com/Akylas/address-formatter/issues"},"dist":{"shasum":"6b505fcc5f8f92654c7753a144e84a7dbfe6bdc2","tarball":"https://registry.npmjs.org/@akylas/address-formatter/-/address-formatter-5.3.0.tgz","fileCount":18,"integrity":"sha512-+Vm/WjBEHBB4SeZV2HDsGJjvyvF2iXlyR9wunhHvTAIg6peAIt3+AMSrg5cghMCmO3/1MQxoyQG6IVmWHbCdxQ==","signatures":[{"sig":"MEUCIQDmdDY5KCWMfATuNWy5ZWh4VqP/ls8IReTybM7fd51TfAIgH9hlZn8W9/YpAp0t0Kf8eBQabqZVt8S7nmreXqr4JYI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1125049},"jest":{"testRegex":"./test/.*.spec.js","coverageReporters":["text","lcov"],"collectCoverageFrom":["src/**/*.js"],"testPathIgnorePatterns":["/node_modules/"]},"main":"dist/cjs/address-formatter.js","types":"index.d.ts","module":"dist/es/address-formatter.js","browser":"dist/umd/address-formatter.js","engines":{"node":">=14.0.0"},"gitHead":"c4043869d7089b33e2313c3deb8720ed5a68b302","scripts":{"lint":"semistandard src test","test":"rimraf coverage && jest --coverage","build":"rollup -c rollup.config.js","clean":"rimraf dist && rimraf src/templates/*.json","test:ci":"rimraf coverage && jest --coverage --ci","lint:fix":"semistandard --fix src test","test:watch":"jest --watch --coverage","collect-aliases":"node management/collect-aliases.js","pull-submodules":"git submodule init && git submodule update","prepare-templates":"node management/prepare-templates.js"},"_npmUser":{"name":"farfromrefuge","email":"martin.guillon@akylas.fr"},"repository":{"url":"git+https://github.com/Akylas/address-formatter.git","type":"git"},"_npmVersion":"9.7.1","description":"Universal international address formatting in Javascript","directories":{},"_nodeVersion":"18.10.0","dependencies":{"mustache":"^4.0.0"},"semistandard":{"env":["jest"]},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.0.1","eslint":"^8.6.0","rimraf":"^5.0.0","rollup":"^2.0.0","js-yaml":"^4.0.0","babel-jest":"^29.0.1","@babel/core":"^7.8.6","babel-loader":"^9.0.0","semistandard":"^17.0.0","@babel/preset-env":"^7.8.6","@rollup/plugin-json":"^6.0.0","@rollup/plugin-alias":"^5.0.1","@rollup/plugin-babel":"^6.0.0","rollup-plugin-terser":"^7.0.0","@rollup/plugin-commonjs":"^25.0.0","@rollup/plugin-node-resolve":"^15.0.0","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-proposal-class-properties":"^7.8.3","@babel/plugin-proposal-object-rest-spread":"^7.8.3"},"_npmOperationalInternal":{"tmp":"tmp/address-formatter_5.3.0_1697744223003_0.19997931505211897","host":"s3://npm-registry-packages"}},"5.3.1":{"name":"@akylas/address-formatter","version":"5.3.1","description":"Universal international address formatting in Javascript","main":"dist/cjs/address-formatter.js","types":"index.d.ts","browser":"dist/umd/address-formatter.js","module":"dist/es/address-formatter.js","scripts":{"lint":"semistandard src test","lint:fix":"semistandard --fix src test","test":"rimraf coverage && jest --coverage","test:ci":"rimraf coverage && jest --coverage --ci","test:watch":"jest --watch --coverage","clean":"rimraf dist && rimraf src/templates/*.json","pull-submodules":"git submodule init && git submodule update","prepare-templates":"node management/prepare-templates.js","collect-aliases":"node management/collect-aliases.js","build":"rollup -c rollup.config.js"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/Akylas/address-formatter.git"},"keywords":["address","geography","geodata"],"author":{"name":"Jirka Chadima","email":"chadima.jiri@gmail.com"},"license":"MIT","dependencies":{"mustache":"^4.0.0"},"devDependencies":{"@babel/core":"^7.8.6","@babel/plugin-proposal-class-properties":"^7.8.3","@babel/plugin-proposal-object-rest-spread":"^7.8.3","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/preset-env":"^7.8.6","@rollup/plugin-alias":"^5.0.1","@rollup/plugin-babel":"^6.0.0","@rollup/plugin-commonjs":"^25.0.0","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.0.0","babel-jest":"^29.0.1","babel-loader":"^9.0.0","eslint":"^8.6.0","jest":"^29.0.1","js-yaml":"^4.0.0","rimraf":"^5.0.0","rollup":"^2.0.0","rollup-plugin-terser":"^7.0.0","semistandard":"^17.0.0"},"engines":{"node":">=14.0.0"},"semistandard":{"env":["jest"]},"jest":{"testRegex":"./test/.*.spec.js","testPathIgnorePatterns":["/node_modules/"],"coverageReporters":["text","lcov"],"collectCoverageFrom":["src/**/*.js"]},"_id":"@akylas/address-formatter@5.3.1","gitHead":"2c4dcbefaf5a9aaced1f52c23a92441a1c4c0cb5","bugs":{"url":"https://github.com/Akylas/address-formatter/issues"},"homepage":"https://github.com/Akylas/address-formatter#readme","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-gZQ76LuDij7jwWrytch8nLfCC/6nSWkmKD/hxX9lww65fdwTyk2XIHl50hZFOQy9iYLVmknsH/GV52uAusMVGA==","shasum":"0ef5f941a2fea729c3579456f073e8955e5ddce3","tarball":"https://registry.npmjs.org/@akylas/address-formatter/-/address-formatter-5.3.1.tgz","fileCount":18,"unpackedSize":1129449,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHPtL6FQA1ualsu529Cvu8xCkamdygOMGrlhYeewnH5PAiEAlsfTMhUKR3CW9chfcs7dIN3Bkqb6b7Oq7yNhp61n66c="}]},"_npmUser":{"name":"farfromrefuge","email":"martin.guillon@akylas.fr"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/address-formatter_5.3.1_1719238875016_0.5444537296788226"},"_hasShrinkwrap":false}},"time":{"created":"2023-10-19T19:35:27.638Z","modified":"2024-06-24T14:21:15.400Z","5.2.1":"2023-10-19T19:35:28.122Z","5.3.0":"2023-10-19T19:37:03.282Z","5.3.1":"2024-06-24T14:21:15.205Z"},"maintainers":[{"name":"farfromrefuge","email":"martin.guillon@akylas.fr"}],"author":{"name":"Jirka Chadima","email":"chadima.jiri@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/Akylas/address-formatter.git"},"keywords":["address","geography","geodata"],"license":"MIT","homepage":"https://github.com/Akylas/address-formatter#readme","bugs":{"url":"https://github.com/Akylas/address-formatter/issues"},"readme":"# JS Address formatter\n\n[![Coverage Status](https://coveralls.io/repos/github/fragaria/address-formatter/badge.svg?branch=master)](https://coveralls.io/github/fragaria/address-formatter?branch=master)\n\nBased on an amazing work of [OpenCage Data](https://github.com/OpenCageData/address-formatting/)\nwho collected so many international formats of postal addresses, this is a Javascript implementation\nof that formatter.\n\nThis library can format almost anything that comes out of\nOpen Street Maps' [Nominatim API](https://wiki.openstreetmap.org/wiki/Nominatim)\nin the `address` field. Other compatible sources of data \nsuch as [Photon](https://photon.komoot.de/) might be used as well.\n\nIt can automatically detect the country's\nformatting customs, but allows you to *pick a specific country\nformat*. Furthermore, it allows you to abbreviate the common names,\nsuch as `Avenue` or `Road`.\n\nThe formatting specification for the whole world is part of\nthe distribution package, there is currently no plan to prepare\nsmaller builds with limited area coverage.\n\n## Installation & Usage\n\n### Node\n\n```sh\nnpm i @fragaria/address-formatter\n```\n\n```js\n// import addressFormatter from '@fragaria/address-formatter';\nconst addressFormatter = require('@fragaria/address-formatter');\n\n// Basic examples\nconst formatted = addressFormatter.format({\n  \"houseNumber\": 301,\n  \"road\": \"Hamilton Avenue\",\n  \"neighbourhood\": \"Crescent Park\",\n  \"city\": \"Palo Alto\",\n  \"postcode\": 94303,\n  \"county\": \"Santa Clara County\",\n  \"state\": \"California\",\n  \"country\": \"United States of America\",\n  \"countryCode\": \"US\",\n});\n/*\n301 Hamilton Avenue\nPalo Alto, CA 94303\nUnited States of America\n*/\nconst formattedWithAppendedCountry = addressFormatter.format({\n  \"houseNumber\": 301,\n  \"road\": \"Hamilton Avenue\",\n  \"neighbourhood\": \"Crescent Park\",\n  \"city\": \"Palo Alto\",\n  \"postcode\": 94303,\n  \"county\": \"Santa Clara County\",\n  \"state\": \"California\",\n  \"countryCode\": \"US\",\n}, {\n  appendCountry: true\n});\n/*\n301 Hamilton Avenue\nPalo Alto, CA 94303\nUnited States of America\n*/\n\n// You can overwrite the country code incoming from the map service\nconst abbreviatedUkFormat = addressFormatter.format({\n  \"houseNumber\": 301,\n  \"road\": \"Hamilton Avenue\",\n  \"neighbourhood\": \"Crescent Park\",\n  \"city\": \"Palo Alto\",\n  \"postcode\": 94303,\n  \"county\": \"Santa Clara County\",\n  \"state\": \"California\",\n  \"country\": \"United States of America\",\n  \"countryCode\": \"US\",\n}, {\n  abbreviate: true,\n  countryCode: 'UK'\n});\n/*\n301 Hamilton Ave\nPalo Alto 94303\nUSA\n*/\n\n// You can use a fallback to keep the library working when the country code is wrong\nconst fallbackCountryCode = addressFormatter.format({\n  \"houseNumber\": 301,\n  \"road\": \"Hamilton Avenue\",\n  \"neighbourhood\": \"Crescent Park\",\n  \"city\": \"Palo Alto\",\n  \"postcode\": 94303,\n  \"county\": \"Santa Clara County\",\n  \"state\": \"California\",\n  \"country\": \"United States of America\",\n  \"countryCode\": \"yu\",\n}, {\n  abbreviate: true,\n  fallbackCountryCode: 'UK'\n});\n/*\n301 Hamilton Ave\nPalo Alto 94303\nUSA\n*/\n\n// You can get the address as a list of lines to make your formatting easier\nconst formattedAsLines = addressFormatter.format({\n  \"houseNumber\": 301,\n  \"road\": \"Hamilton Avenue\",\n  \"neighbourhood\": \"Crescent Park\",\n  \"city\": \"Palo Alto\",\n  \"postcode\": 94303,\n  \"county\": \"Santa Clara County\",\n  \"state\": \"California\",\n  \"country\": \"United States of America\",\n  \"countryCode\": \"US\",\n}, {\n  output: 'array'\n});\n/*\n[\n  '301 Hamilton Avenue',\n  'Palo Alto, CA 94303',\n  'United States of America'\n]\n*/\n```\n\n### Direct use on webpage\n\n```html\n<script type=\"text/javascript\" src=\"https://unpkg.com/@fragaria/address-formatter@latest\"></script>\n<script type=\"text/javascript\">\n  const formatted = window.addressFormatter.format({\n    \"houseNumber\": 301,\n    \"road\": \"Hamilton Avenue\",\n    \"neighbourhood\": \"Crescent Park\",\n    \"city\": \"Palo Alto\",\n    \"postcode\": 94303,\n    \"county\": \"Santa Clara County\",\n    \"state\": \"California\",\n    \"country\": \"United States of America\",\n    \"countryCode\": \"US\",\n  });\n  /*\n  301 Hamilton Avenue\n  Palo Alto, CA 94303\n  United States of America\n  */\n</script>\n```\n\n## Development & Tests\n\n```sh\n$ git clone git@github.com:fragaria/address-formatter.git\n$ cd address-formatter\n# Install the proper NodeJS\n$ nvm install\n# Download the /OpenCageData/address-formatting/ spec\n$ npm run pull-submodules\n# Install dependencies\n$ npm install\n# Generate JS-friendly spec\n$ npm run prepare-templates\n# Run the tests\n$ npm test\n```\n\n### Making a release\n\n```sh\n$ npm version X.Y.Z\n$ git push origin master && git push origin vX.Y.Z\n```\n\nAnd the CI server takes care of the rest\n\n# Help needed\n\nAll pull requests are definitely welcome. If an address\nis badly formatted, submit PRs directly to the \n[original repository](https://github.com/OpenCageData/address-formatting/)\nwith a minimal localized test-case.\n\n# Acknowledgments\n\nGrat many thanks to these implementations:\n\n- [Perl](https://github.com/OpenCageData/perl-Geo-Address-Formatter)\n- [PHP](https://github.com/predicthq/address-formatter-php)\n","readmeFilename":"README.md"}