verifyitpro
v0.0.2
Published
A data verification library written in typescript
Readme
Certainly! Below is a sample documentation for your verifyit npm package, which includes sections on installation, usage, and detailed explanations of the available functions and data structures.
VerifyIt
verifyit is a utility library for validating country names and currency codes. It provides functions to check if a given string is a valid country or currency, along with structured data for countries and currencies.
Table of Contents
Installation
To install the verifyit package, use npm:
npm install verifyitIf you are using TypeScript, ensure that you have TypeScript installed in your project:
npm install typescript --save-devUsage
You can use the verifyit package in your project as follows:
import * as verifyit from 'verifyit';
// Validate a country
const isCountryValid = verifyit.isValidCountry('Canada'); // true
const isCountryInvalid = verifyit.isValidCountry('Atlantis'); // false
// Validate a currency
const isCurrencyValid = verifyit.isValidCurrency('USD'); // true
const isCurrencyInvalid = verifyit.isValidCurrency('XYZ'); // falseFunctions
isValidCountry
function isValidCountry(country: string): boolean;Parameters:
country: A string representing the name of the country to validate.
Returns:
- A boolean indicating whether the provided country name is valid (
true) or not (false).
Example:
console.log(verifyit.isValidCountry('India')); // true
console.log(verifyit.isValidCountry('Fake Country')); // falseisValidCurrency
function isValidCurrency(currency: string): boolean;Parameters:
currency: A string representing the currency code to validate.
Returns:
- A boolean indicating whether the provided currency code is valid (
true) or not (false).
Example:
console.log(verifyit.isValidCurrency('EUR')); // true
console.log(verifyit.isValidCurrency('ABC')); // falseData Structures
Countries
The library provides a structured object representing all valid countries:
const countries = {
afghanistan: { name: "Afghanistan" },
albania: { name: "Albania" },
// ... other countries
};- Key: Formatted country name in lowercase with no spaces.
- Value: An object containing the country name.
Currencies
The library provides a structured object representing currency codes:
const currencies = {
usd: { name: "United States Dollar", country: "United States" },
eur: { name: "Euro", country: "Eurozone" },
// ... other currencies
};- Key: Formatted currency code in lowercase.
- Value: An object containing the currency name and associated country.
License
This project is licensed under the MIT License. See the LICENSE file for details.
This documentation provides a comprehensive overview of the verifyit package, including installation instructions, usage examples, detailed function descriptions, and data structure formats. You can enhance it further based on additional features or changes to the library.
