UNPKG

yaba-release-cli

Version:

Yaba is a simple CLI tool that helps you manage releases of your Github projects.

24 lines (21 loc) 737 B
/** * checks if the given string is blank or not. * * @param str the given string * @returns {boolean} true if the given string is blank, otherwise returns false */ export function isBlank(str) { return (str === "undefined" || !str || /^\s*$/.test(str)); } /** * replaces the placeholders which are in the {@code given} string with the given {@code dict}. * * @param given the given string that will be formatted with the given {@code dict} * @param dict the dictionary that will replace placeholders in {@code given} sting * @returns {*} */ export function format(given, dict) { return given.replace(/{(\w+)}/g, function (match, key) { return typeof dict[key] !== 'undefined' ? dict[key] : match; }); }