Class JSFilenameHelper


  • @Immutable
    public final class JSFilenameHelper
    extends Object
    Utility class for handling JavaScript file names.
    Author:
    Philip Helger
    • Method Detail

      • isJSFilename

        public static boolean isJSFilename​(@Nullable
                                           String sFilename)
        Check if the passed filename is a JS filename. Either it ends with ".js" or it contains ".js?" or ".js#" (both for URLs). Please note that every minified JS filename is also a "valid" filename in the sense of this method. That's why there is a isRegularJSFilename(String) method to check for non-minified JS filenames explicitly.
        Parameters:
        sFilename - Filename to check. May be null.
        Returns:
        true if it is a valid JS filename.
      • isMinifiedJSFilename

        public static boolean isMinifiedJSFilename​(@Nullable
                                                   String sFilename)
        Check if the passed filename is a minified JS filename. Either it ends with ".min.js" or it contains ".min.js?" or ".min.js#" (both for URLs). Please note that every minified JS filename is also a "valid" filename in the sense of isJSFilename(String) but not vice versa!.
        Parameters:
        sFilename - Filename to check. May be null.
        Returns:
        true if it is a valid minified JS filename.