{"_id":"hof-util-countries","_rev":"54-d1e57de2827247426b408dc6ccef37a7","name":"hof-util-countries","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"hof-util-countries","version":"1.0.0","author":"","license":"MIT","_id":"hof-util-countries@1.0.0","maintainers":[{"name":"lennym","email":"leonard.martin@gmail.com"}],"homepage":"https://github.com/UKHomeOfficeForms/hof-util-countries#readme","bugs":{"url":"https://github.com/UKHomeOfficeForms/hof-util-countries/issues"},"dist":{"shasum":"989d559e5934db62e9d32ebd0b038aa34a820ab3","tarball":"https://registry.npmjs.org/hof-util-countries/-/hof-util-countries-1.0.0.tgz","integrity":"sha512-uF5sAwugJ+rroGkuy2RWOulYZcAd96B84CpC0Sb5TPypT8azyiNuiR9MPLynG6Il5qbKQmr8vYgmimHJQcEbag==","signatures":[{"sig":"MEQCIE0dD1EoaW1hEuhbY8zpNSRG8LV+F1g6/2/W0WcZmboqAiBhojNpgLDHxXCYHGKdi9weflJnT2HKQCmNDr+PvOz9Iw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"989d559e5934db62e9d32ebd0b038aa34a820ab3","gitHead":"d7130c64208f459109fad0ee1aded787ecb98e86","scripts":{"test":"npm run test:lint && npm run test:unit","test:lint":"eslint .","test:unit":"mocha ./test"},"_npmUser":{"name":"lennym","email":"leonard.martin@gmail.com"},"repository":{"url":"git+https://github.com/UKHomeOfficeForms/hof-util-countries.git","type":"git"},"_npmVersion":"4.5.0","description":"A utility to parse homeoffice-countries into a usable format for hof select elements","directories":{},"_nodeVersion":"6.9.4","dependencies":{"homeoffice-countries":"^0.1.0"},"devDependencies":{"chai":"^3.5.0","mocha":"^3.4.1","eslint":"^3.19.0","eslint-config-homeoffice":"^2.1.2"},"_npmOperationalInternal":{"tmp":"tmp/hof-util-countries-1.0.0.tgz_1495631426043_0.9701799405738711","host":"s3://npm-registry-packages"}}},"time":{"created":"2017-05-24T13:10:26.987Z","modified":"2026-09-21T15:12:54.139Z","1.0.0":"2017-05-24T13:10:26.987Z"},"bugs":{"url":"https://github.com/UKHomeOfficeForms/hof-util-countries/issues"},"license":"MIT","homepage":"https://github.com/UKHomeOfficeForms/hof-util-countries#readme","repository":{"url":"git+https://github.com/UKHomeOfficeForms/hof-util-countries.git","type":"git"},"description":"A utility to parse homeoffice-countries into a usable format for hof select elements","maintainers":[{"email":"aaron.russell@digital.homeoffice.gov.uk","name":"aaronrussellho"},{"email":"sas-hof-test@digital.homeoffice.gov.uk","name":"hof-bot-user"},{"email":"dk4g.blob@gmail.com","name":"dk4g"},{"email":"gregory.wolverson@digital.homeoffice.gov.uk","name":"greg_wolverson_ho"},{"email":"vinodha.samiyappan@digital.homeoffice.gov.uk","name":"vinodha.s"},{"email":"megan.john@digital.homeoffice.gov.uk","name":"meganjohn"},{"email":"nese.zorba@digital.homeoffice.gov.uk","name":"nzorba"},{"email":"rayhannur.rohman@digital.homeoffice.gov.uk","name":"rayhannurrohmanho"},{"email":"vivek.kumar1@digital.homeoffice.gov.uk","name":"vivekkumar-ho"},{"email":"leonard.martin@gmail.com","name":"lennym"}],"readme":"# hof-util-countries\n\nA utility to parse `homeoffice-countries` into a usable format for hof select elements\n\nBy default hof select elements expect a list of options as an objet with `value` and `label` properties. If passed an array of strings as options it will attempt to translate the strings with some field-specific keys attached.\n\n## Usage\n\nIn field configuration:\n\n```js\n{\n  country: {\n    mixin: 'select',\n    validate: 'required',\n    options: require('hof-util-countries')()\n  }\n}\n```\n\n## Options\n\nIf needed, the following options can be passed into the countries function:\n\n* `filter` - `Function` - applies a filter to the list of country names before mapping them\n* `parse` - `Function` - applies a transform to the country name before setting the label\n\n## i18n\n\nIf you wish to translate the countries into outher languages, you may want the labels to be in the form of translation keys. In this case you can use a `parse` option to convert the country names into a translation key:\n\n```js\nconst countries = require('hof-util-countries');\nconst options = countries({\n  parse: country => `countries.${country.toLowerCase().split(' ').join('-')}`\n});\n```\n\nYou can then define a single translation for country names to be used for all country list instances.\n","readmeFilename":"README.md"}