@slrmyapi/countryapi
Version:
Country API untuk kegunaan semua!
18 lines (16 loc) • 621 B
JavaScript
const axios = require("axios");
/**
* Ambil maklumat negara berdasarkan kod ISO 3166-1 alpha-2.
* @param {string} code - Kod negara (2 huruf, huruf besar).
* @returns {Promise<object>} Maklumat negara (name, emoji, phoneCode).
*/
async function getCountryInfo(code) {
try {
const url = `https://slrmyshop.us/country.php?code=${code.toUpperCase()}`;
const response = await axios.get(url);
return response.data;
} catch (error) {
return { error: "SlrmyApi • Tergendala! Sila Hubungi Developer! @slrmyshopofficial • +601136871190" };
}
}
module.exports = getCountryInfo;