### Module Import Examples Source: https://github.com/synergy-shock/country-codes-list/blob/master/README.md Demonstrates how to import the package in both CommonJS and ES Modules environments. Both methods are supported. ```javascript // CommonJS (still works) const countryCodes = require("country-codes-list"); // ES Modules (new) import * as countryCodes from "country-codes-list"; ``` -------------------------------- ### Install country-codes-list via npm Source: https://github.com/synergy-shock/country-codes-list/blob/master/README.md Install the package using npm. This command adds the package as a dependency to your project. ```bash npm install --save country-codes-list ``` -------------------------------- ### TypeScript Usage Example Source: https://github.com/synergy-shock/country-codes-list/blob/master/README.md Example of using the `customList` method in a TypeScript environment to generate a custom object of country codes. ```typescript import * as countryCodes from "country-codes-list"; const myCountryCodesObject = countryCodes.customList( "countryCode", "[{countryCode}] {countryNameEn}: +{countryCallingCode}" ); console.log(myCountryCodesObject); ``` -------------------------------- ### customList Method Example Source: https://github.com/synergy-shock/country-codes-list/blob/master/README.md Demonstrates the usage of the `customList` method, which creates a custom object by mapping country properties to a specified string format. ```javascript const countryCodes = require("country-codes-list"); const myCountryCodesObject = countryCodes.customList( "countryCode", "[{countryCode}] {countryNameEn}: +{countryCallingCode}" ); ``` -------------------------------- ### customList Method Output Example Source: https://github.com/synergy-shock/country-codes-list/blob/master/README.md An example of the output generated by the `customList` method, showing a JavaScript object where keys are country codes and values are formatted strings. ```javascript { 'AD': '[AD] Andorra: +376', 'AE': '[AE] United Arab Emirates: +971', 'AF': '[AF] Afghanistan: +93', 'AG': '[AG] Antigua and Barbuda: +1', 'AI': '[AI] Anguilla: +1', 'AL': '[AL] Albania: +355', 'AM': '[AM] Armenia: +374', 'AO': '[AO] Angola: +244', 'AQ': '[AQ] Antarctica: +', 'AR': '[AR] Argentina: +54', 'AS': '[AS] American Samoa: +1', 'AT': '[AT] Austria: +43', 'AU': '[AU] Australia: +61', 'AW': '[AW] Aruba: +297', ... } ``` -------------------------------- ### CommonJS Usage Example Source: https://github.com/synergy-shock/country-codes-list/blob/master/README.md Example of using the `customList` method in a CommonJS environment to generate a custom object of country codes. ```javascript const countryCodes = require("country-codes-list"); const myCountryCodesObject = countryCodes.customList( "countryCode", "[{countryCode}] {countryNameEn}: +{countryCallingCode}" ); console.log(myCountryCodesObject); ``` -------------------------------- ### Stricter Type Checking Example Source: https://github.com/synergy-shock/country-codes-list/blob/master/README.md Shows how function calls now require valid country property keys. Passing an invalid key will result in a TypeScript error. ```typescript // This now requires valid country property keys countryCodes.filter("invalidKey", "value"); // TypeScript error ``` -------------------------------- ### TypeScript Type Migration Example Source: https://github.com/synergy-shock/country-codes-list/blob/master/README.md Illustrates the change in importing TypeScript types from v1.x to v2.0. In v2.0, types are imported directly, and properties are accessed as string literals. ```typescript // Old (v1.x) import { CountryProperty } from "country-codes-list"; const prop: CountryProperty = CountryProperty.countryCode; // New (v2.0) import type { CountryProperty } from "country-codes-list"; const prop: CountryProperty = "countryCode"; ``` -------------------------------- ### Build the package Source: https://github.com/synergy-shock/country-codes-list/blob/master/README.md Compile the package source code. The output will be placed in the 'dist/' folder. ```bash npm run build ``` -------------------------------- ### Run tests for the package Source: https://github.com/synergy-shock/country-codes-list/blob/master/README.md Execute the test suite to ensure the package is functioning correctly. ```bash npm test ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.