Bunoon: SHRINK | Manual | Types

Below is a list of functions that can be used to minimize JavaScript code. Currently, only Run() is supported, but gives you enough options to make full use of the SHRINK library.

Returns the code that has been shrunk using the settings specified.

The main arguments for this function are as follows:

  • oProperties [Object] - The properties that determine the settings that should be used on the current code.
    • "Code" [String] - The code that is to be minimized.
    • "StripComments" [Boolean] - States if comments are to be stripped from the code.
    • "StripDocumentation" [Boolean] - States if documentation are to be stripped from the code.
    • "StripBlockComments" [Boolean] - States if block comments are to be stripped from the code.
    • "StripEmptyLines" [Boolean] - States if empty lines are to be stripped from the code.
    • "StripLeftRightEmptySpace" [Boolean] - States if left/right white space is to be stripped from the code.
    • "ShrinkVariables" [Boolean] - States if variables are to be shrunk in the code.
    • "ShrinkInternalFunctions" [Boolean] - States if internal functions (not public) are to be shrunk in the code.
    • "StripNewLines" [Boolean] - States if new lines are to be stripped from the code.
    • "MaximumLineLength" [Number] - States the maximum length a minimized line can be (used when "StripNewLines" is used).

The return value for this function is as follows:

  • [Boolean] - A boolean of true/false to indicate if the code has been shrunk.

Below is an example of how to use this function:

var bResult = $S.Run( {

"Code": document.TestForm.Code.value,

"StripComments": true,

"StripDocumentation": true,

"StripBlockComments": true,

"StripEmptyLines": true,

"StripLeftRightEmptySpace": true,

"ShrinkVariables": true,

"ShrinkInternalFunctions": true,

"StripNewLines": true,

"MaximumLineLength": 80

} );