بسته جاوا اسکریپت جستجوی برنامه افزودنی تلفن کشور.
هدف از ارائه پرچمهای SVG، پرچم یونیکد (اموجی)، کد کشور، پسوند تلفن
با استفاده از npm نصب کنید
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
}
استفاده
همه کشورها را دریافت کنید
فهرست همه کشورها با جزئیات شی
const country = require("country-code-flag-phone-extension-json");
country.all();
// Return all the country with full detailed object
کشورها را با کد ISO2 فیلتر کنید
کشور را بر اساس کد کشور فیلتر کنید
const country = require("country-code-flag-phone-extension-json");
country.all({
filter: ["IN", "US"],
});
// Return only two records filter by India and United States
کشورها را با جستجوی متن ساده فیلتر کنید
جستجوی سریع در پایگاه داده
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
مرتب سازی بر اساس کشور
در برخی موارد، ما میخواهیم کشور خاصی در بالای فهرست کشویی قرار گیرد و سایر کشورها به دنبال آن باشند.
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 ..
رکورد را بر اساس کشور محدود کنید
5 رکورد برتر
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
شیء فیلتر شده یا همه کشورها را از DV کوچک کرد
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
اگر شما آن را دوست دارید
میتونی برام قهوه بخری
https://www.buymeacoffee.com/mayankjhawar
از من در Patreon حمایت کنید
https://patreon.com/mayank120
مجوز
با