Country Detail
Purpose to provide SVG Flags, Unicode flag (emojis), Country code, Phone extension
Install using npm
npm i country-code-flag-phone-extension-json
Methods & Options
const country = require("country-code-flag-phone-extension-json");
country.all();
const options = {
filter: "",
filter: [],
keys: [],
sortBy: [],
limit: 5
}
Usage
Get all Countries
List all the countries with details object
const country = require("country-code-flag-phone-extension-json");
country.all();
Filter Countries by ISO2 Code
Filter country by country codes
const country = require("country-code-flag-phone-extension-json");
country.all({
filter: ["IN", "US"],
});
Filter Countries by plain text search
Quick search in database
const country = require("country-code-flag-phone-extension-json");
country.all({
filter: "india",
});
Sort by Country
In some case, we want specific country to be on top of the dropdown and followed by all others.
const country = require("country-code-flag-phone-extension-json");
country.all({
sortBy: ["US", "IN"],
});
Limit the record by Country
Top 5 records
const country = require("country-code-flag-phone-extension-json");
country.all({
limit: 5
})
country.all({
limit: 5,
sortBy: ["US", "IN"]
})
country.all({
filter: ["IN", "US", "ZW", "YE", "AD"]
limit: 5,
sortBy: ["US", "IN"]
})
Minified the filted object or all countried from DV
const country = require("country-code-flag-phone-extension-json");
country.all({
keys: ["id", "name", "dail_code", "mask", "emoji", "translations.kr"],
limit: 5
})
country.all({
limit: 5,
sortBy: ["US", "IN"]
})
country.all({
filter: ["IN", "US", "ZW", "YE", "AD"]
limit: 5,
sortBy: ["US", "IN"]
})
If you like it
You can buy me coffee
https://www.buymeacoffee.com/mayankjhawar
Support me at Patreon
https://patreon.com/mayank120
License
MIT