UNPKG

typedash

Version:

modern, type-safe collection of utility functions

17 lines 713 B
//#region src/functions/ensureSuffix/ensureSuffix.d.ts /** * Ensures that the string ends with the given suffix. * @param string The string to ensure the suffix of. * @param suffix The suffix to ensure. * @returns The string with the given suffix. * @example * ```ts * ensureSuffix('foo', 'bar'); // 'foobar' * ensureSuffix('foobar', 'bar'); // 'foobar' * ``` */ declare function ensureSuffix<S extends string, Suffix extends string>(string: S, suffix: Suffix): EnsureSuffix<S, Suffix>; type EnsureSuffix<S extends string, Suffix extends string> = S extends `${infer _Prefix}${Suffix}` ? S : `${S}${Suffix}`; //#endregion export { ensureSuffix as t }; //# sourceMappingURL=ensureSuffix-CBU_lUIK.d.ts.map