Skip to content

Latest commit

 

History

History
94 lines (65 loc) · 2.59 KB

EncodeOptions.md

File metadata and controls

94 lines (65 loc) · 2.59 KB

JScrewItDocs


Interface: EncodeOptions

Properties

features?

optional features: FeatureElementOrCompatibleArray

Specifies the features available in the engines that evaluate the encoded output.

If this parameter is unspecified, JScrewIt.Feature.DEFAULT is assumed: this ensures maximum compatibility but also generates the largest code. To generate shorter code, specify all features available in all target engines explicitly.


runAs?

optional runAs: RunAs

This option controls the type of code generated from the given input. Allowed values are listed below.

"call"
Produces code evaluating to a call to a function whose body contains the specified input string.
"eval"
Produces code evaluating to the result of invoking eval with the specified input string as parameter.
"express"
Attempts to interpret the specified string as JavaScript code and produce functionally equivalent JSFuck code. Fails if the specified string cannot be expressed as JavaScript, or if no functionally equivalent JSFuck code can be generated.
"express-call"
Applies the code generation process of both "express" and "call" and returns the shortest output.
"express-eval" (default)
Applies the code generation process of both "express" and "eval" and returns the shortest output.
"none"
Produces JSFuck code that translates to the specified input string (except for trimmed parts when used in conjunction with the option trimCode). Unlike other methods, "none" does not generate executable code, but rather a plain string.

trimCode?

optional trimCode: boolean

If this parameter is truthy, lines in the beginning and in the end of the file containing nothing but space characters and JavaScript comments are removed from the generated output. A newline terminator in the last preserved line is also removed.

This option is especially useful to strip banner comments and trailing newline characters which are sometimes found in minified scripts.

Using this option may produce unexpected results if the input is not well-formed JavaScript code.


wrapWith?

optional wrapWith: RunAs

An alias for runAs.