UNPKG

abbott-methods

Version:

abbott,methods,method,functions,function

12 lines (11 loc) 459 B
/** * @desc 保证字符串尾部含有指定字符 * @param {number|string} ensureString * @param {number|string} ensureAssign * @returns {number|string} */ export const ensureFootHave = (ensureString: number | string, ensureAssign: number | string): string => { const theString = String(ensureString) const theAssign = String(ensureAssign) return theString.substr(-theString.length) === theAssign ? theString : theString + theAssign }