Helpful
    Preparing search index...

    Function castExtension

    • Puts a . in front of name if one is not already there.

      If there are multiple dots in front of name, then all dots but one is removed.

      Parameters

      • candidate: ZOptional<string>

        The candidate extension

      Returns string

      The candidate prepended by a single dot. If candidate is undefined, null, the empty string, white space, or nothing but dots, then the empty string is returned.

      // Outputs .zip
      castExtension('zip');

      // Outputs .zip
      castExtension('.zip');

      // Outputs .zip
      castExtension('...zip');