@resk/core
Version:
An innovative TypeScript framework that empowers developers to build applications with a fully decorator-based architecture for efficient resource management. By combining the power of decorators with a resource-oriented design, DecorRes enhances code cla
26 lines (25 loc) • 1.01 kB
TypeScript
import { ICurrency } from "./types";
/**
* @group Currency
* Checks if the provided object is a valid currency object.
* A valid currency object must be a non-null object with the following properties:
* - `name`: A string representing the name of the currency.
* - `symbol`: A string representing the symbol of the currency.
*
* @param {any} obj - The object to be validated as a currency.
* @returns {boolean} Returns `true` if the object is a valid currency, otherwise `false`.
*
* @example
* const usd = { name: "US Dollar", symbol: "$" };
* console.log(isValidCurrency(usd)); // Output: true
*
* const invalidCurrency = { name: "Invalid Currency" };
* console.log(isValidCurrency(invalidCurrency)); // Output: false
*
* const notAnObject = "Not an object";
* console.log(isValidCurrency(notAnObject)); // Output: false
*
* const arrayInput = ["$"];
* console.log(isValidCurrency(arrayInput)); // Output: false
*/
export declare const isValidCurrency: (obj: any) => obj is ICurrency;