Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
country-code-flag-phone-extension-json
Advanced tools
Readme
Purpose to provide SVG Flags, Unicode flag (emojis), Country code, Phone extension
npm i country-code-flag-phone-extension-json
const country = require("country-code-flag-phone-extension-json");
// Get all countries.
country.all();
const options = {
filter: "", // If pass as string then full text search on db (name, subregion, region, currency)
filter: [], // if pass as array filter by ISO2 codes
keys: [], // define object keys to minify records,
sortBy: [], // sort by priortiy of mentioned ISO2 code.
limit: 5 // limit the returned object
}
List all the countries with details object
const country = require("country-code-flag-phone-extension-json");
country.all();
// Return all the country with full detailed object
Filter country by country codes
const country = require("country-code-flag-phone-extension-json");
country.all({
filter: ["IN", "US"],
});
// Return only two records filter by India and United States
Quick search in database
const country = require("country-code-flag-phone-extension-json");
country.all({
filter: "india",
});
// Return only one records filter search by india
// It search on name, region, subregion, currency name
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"],
});
// Return all countried sort by US, IN and
// all remaining countries ..
Top 5 records
const country = require("country-code-flag-phone-extension-json");
country.all({
limit: 5
})
// Return top 5 countries from DB
country.all({
limit: 5,
sortBy: ["US", "IN"]
})
// Return top 5 followed by - US, IN
// and reminaing 3 countries from DB
country.all({
filter: ["IN", "US", "ZW", "YE", "AD"]
limit: 5,
sortBy: ["US", "IN"]
})
// Return 5 records followed by - US, IN
// and reminaing 3 filtered (AD, YE, ZW) countries from DB
const country = require("country-code-flag-phone-extension-json");
country.all({
keys: ["id", "name", "dail_code", "mask", "emoji", "translations.kr"],
limit: 5
})
// output
/*
{
"rows": [
{
"id": 1,
"name": "Afghanistan",
"dail_code": "+93",
"mask": "+93-##-###-####",
"emoji": "🇦🇫",
"translations": {
"kr": "아프가니스탄"
}
},
{
"id": 2,
"name": "Aland Islands",
"dail_code": "+358",
"emoji": "🇦🇽",
"translations": {
"kr": "올란드 제도"
}
},
{
"id": 3,
"name": "Albania",
"dail_code": "+355",
"mask": "+355(###)###-###",
"emoji": "🇦🇱",
"translations": {
"kr": "알바니아"
}
},
{
"id": 4,
"name": "Algeria",
"dail_code": "+213",
"mask": "+213-##-###-####",
"emoji": "🇩🇿",
"translations": {
"kr": "알제리"
}
},
{
"id": 5,
"name": "American Samoa",
"dail_code": "+1684",
"mask": "+1(684)###-####",
"emoji": "🇦🇸",
"translations": {
"kr": "아메리칸사모아"
}
}
],
"count": 5
}
*/
country.all({
limit: 5,
sortBy: ["US", "IN"]
})
// Return top 5 followed by - US, IN
// and reminaing 3 countries from DB
country.all({
filter: ["IN", "US", "ZW", "YE", "AD"]
limit: 5,
sortBy: ["US", "IN"]
})
// Return 5 records followed by - US, IN
// and reminaing 3 filtered (AD, YE, ZW) countries from DB
You can buy me coffee https://www.buymeacoffee.com/mayankjhawar
Support me at Patreon https://patreon.com/mayank120
MIT
FAQs
Javascript and JSON for Country code flag phone extension
The npm package country-code-flag-phone-extension-json receives a total of 28 weekly downloads. As such, country-code-flag-phone-extension-json popularity was classified as not popular.
We found that country-code-flag-phone-extension-json demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.