UNPKG

@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

18 lines (17 loc) 877 B
/** * Returns the first non-null string value among the provided arguments. * * This function takes a variable number of arguments and returns the first one that is a non-null string. * It iterates through the arguments and checks each one using the `isNonNullString` function. * If a non-null string is found, it is returned immediately. If no non-null string is found, an empty string is returned. * * @param {...any[]} args The values to check for a non-null string. * @returns {string} The first non-null string value found, or an empty string if none is found. * @example * ```typescript * console.log(defaultStr(1,2,"hello", null, "world")); // Output: "hello" * console.log(defaultStr(null, null, "world")); // Output: "world" * console.log(defaultStr(null, null, null)); // Output: "" * ``` */ export default function defaultStr(...args: any[]): string;