react-select-country-list
Advanced tools
Comparing version 1.0.4 to 1.0.6
@@ -20,11 +20,11 @@ 'use strict' | ||
CountryList.prototype.getvalue = function getValue (label) { | ||
CountryList.prototype.getValue = function getValue (label) { | ||
return labelMap[label.toLowerCase()] | ||
} | ||
CountryList.prototype.getlabel = function getLabel (value) { | ||
CountryList.prototype.getLabel = function getLabel (value) { | ||
return valueMap[value.toLowerCase()] | ||
} | ||
CountryList.prototype.getlabels = function getLabels () { | ||
CountryList.prototype.getLabels = function getLabels () { | ||
return data.map(function (country) { | ||
@@ -35,3 +35,3 @@ return country.label | ||
CountryList.prototype.getvalues = function getValues () { | ||
CountryList.prototype.getValues = function getValues () { | ||
return data.map(function (country) { | ||
@@ -38,0 +38,0 @@ return country.value |
{ | ||
"name": "react-select-country-list", | ||
"version": "1.0.4", | ||
"version": "1.0.6", | ||
"description": "Maps ISO 3166-1-alpha-2 codes to English country names and match react-select options props", | ||
@@ -5,0 +5,0 @@ "main": "country-list.js", |
@@ -11,2 +11,10 @@ # react-select-country-list | ||
## Install | ||
``` cli | ||
npm install react-select-country-list | ||
``` | ||
## Example | ||
@@ -48,22 +56,16 @@ | ||
## Methods | ||
Usage: | ||
``` js | ||
import countryList from 'react-select-country-list'; | ||
``` | ||
All input is case-insensitive. | ||
### getValue(code) | ||
### getValue(label) | ||
Expects a two-digit country code. | ||
Returns the name for that country. | ||
Expects the English country name. | ||
Returns the code for that country. | ||
If not found, it returns `undefined`. | ||
### getLabel(name) | ||
### getLabel(code) | ||
Expects the English country name. | ||
Returns the code for that country. | ||
Expects a two-digit country code. | ||
Returns the name for that country. | ||
If not found, it returns `undefined`. | ||
@@ -73,15 +75,15 @@ | ||
Returns an array of all country names. | ||
Returns an array of all country codes. | ||
### getLabels() | ||
Returns an array of all country codes. | ||
Returns an array of all country names. | ||
### getValueList() | ||
Returns a key-value object of all countries using the name as key. | ||
Returns a key-value object of all countries using the code as key. | ||
### getLabelList() | ||
Returns a key-value object of all countries using the code as key. | ||
Returns a key-value object of all countries using the name as key. | ||
@@ -92,14 +94,4 @@ ### getData() | ||
### Use with | ||
## Install | ||
``` cli | ||
npm install react-select-country-list | ||
``` | ||
## License | ||
MIT |
18635
94