@pengzhanbo/utils - v3.4.1
    Preparing search index...

    Function ensureSuffix

    • Ensure suffix, if str does not end with suffix, it will be added

      确保后缀,如果字符串不以该后缀结尾,则将添加该后缀。

      Parameters

      • str: string

        The string to check. 要检查的字符串

      • suffix: string

        The suffix to ensure. 要确保的后缀

      Returns string

      The string with the suffix ensured. 确保后缀后的字符串

      ensureSuffix('example.com', '.com') // => example.com
      ensureSuffix('example', '.com') // => example.com