UNPKG

jscrewit

Version:

Converts plain JavaScript into JSFuck code, which consists of only six different characters: ! ( ) + [ ]

560 lines (499 loc) 16.4 kB
import { ElementaryFeature, PredefinedFeature } from './feature'; export interface FeatureAll { /** * The property that the string representation of Array.prototype.entries\(\) evaluates to "\[object Array Iterator\]". * * @remarks * * Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js. */ ARRAY_ITERATOR: ElementaryFeature; /** * Support for arrow functions. * * @remarks * * Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js. */ ARROW: ElementaryFeature; /** * Existence of the native functions Array.prototype.at and String.prototype.at. * * @remarks * * Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js. */ AT: ElementaryFeature; /** Features available in the current environment. */ AUTO: PredefinedFeature; /** * Existence of the global object statusbar having the string representation "\[object BarProp\]". * * @remarks * * Available in Chrome, Edge, Firefox, Safari, and Opera. This feature is not available inside web workers. */ BARPROP: ElementaryFeature; /** * Features available in all browsers. * * No support for Node.js. */ BROWSER: PredefinedFeature; /** * The property that the various string methods returning HTML code such as String.prototype.big or String.prototype.link have both the tag name and attributes written in capital letters. * * @remarks * * Available in Internet Explorer. */ CAPITAL_HTML: ElementaryFeature; /** * Features available in the current stable versions of Chrome, Edge and Opera. * * An alias for `CHROME_122`. */ CHROME: PredefinedFeature; /** * Features available in Chrome 122, Edge 122 and Opera 108 or later. * * @remarks * * This feature may be replaced or removed in the near future when current browser versions become obsolete. Use `CHROME` or `CHROME_PREV` instead of `CHROME_122` for long term support. * * @see * * [Engine Support Policy](https://github.com/fasttime/JScrewIt#engine-support-policy) */ CHROME_122: PredefinedFeature; /** * Features available in the previous to current versions of Chrome and Edge. * * An alias for `CHROME_122`. */ CHROME_PREV: PredefinedFeature; /** * All new browsers' features. * * Not compatible with Node.js, Internet Explorer, and old versions of supported browsers. */ COMPACT: PredefinedFeature; /** * Existence of the global object console having the string representation "\[object Console\]". * * This feature may become unavailable when certain browser extensions are active. * * @remarks * * Available in Internet Explorer. */ CONSOLE: ElementaryFeature; /** Minimum feature level, compatible with all supported engines in all environments. */ DEFAULT: PredefinedFeature; /** * Existence of the global object document whose string representation starts with "\[object " and ends with "Document\]". * * @remarks * * Available in Chrome, Edge, Firefox, Internet Explorer, Safari, and Opera. This feature is not available inside web workers. */ DOCUMENT: ElementaryFeature; /** * The property that double quotation marks in the argument of String.prototype.fontcolor are escaped as "\"". * * @remarks * * Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js. */ ESC_HTML_QUOT: ElementaryFeature; /** * Features available in the current stable version of Firefox. * * An alias for `FF_134`. */ FF: PredefinedFeature; /** * Features available in Firefox 131 to 133. * * @remarks * * This feature may be replaced or removed in the near future when current browser versions become obsolete. * * @see * * [Engine Support Policy](https://github.com/fasttime/JScrewIt#engine-support-policy) */ FF_131: PredefinedFeature; /** * Features available in Firefox 134 or later. * * @remarks * * This feature may be replaced or removed in the near future when current browser versions become obsolete. Use `FF` or `FF_PREV` instead of `FF_134` for long term support. * * @see * * [Engine Support Policy](https://github.com/fasttime/JScrewIt#engine-support-policy) */ FF_134: PredefinedFeature; /** * Features available in Firefox 90 to 130. * * @remarks * * This feature may be replaced or removed in the near future when current browser versions become obsolete. Use `FF_ESR` instead of `FF_90` for long term support. * * @see * * [Engine Support Policy](https://github.com/fasttime/JScrewIt#engine-support-policy) */ FF_90: PredefinedFeature; /** * Features available in the current version of Firefox ESR. * * An alias for `FF_90`. */ FF_ESR: PredefinedFeature; /** * Features available in the previous to current version of Firefox. * * An alias for `FF_134`. */ FF_PREV: PredefinedFeature; /** * A string representation of native functions typical for Firefox and Safari. * * Remarkable traits are the lack of line feed characters at the beginning and at the end of the string and the presence of a line feed followed by four whitespaces \("\\n "\) before the "\[native code\]" sequence. * * @remarks * * Available in Firefox and Safari. */ FF_SRC: ElementaryFeature; /** * Existence of the native function Array.prototype.flat. * * @remarks * * Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js. */ FLAT: ElementaryFeature; /** * Existence of the function String.fromCodePoint. * * @remarks * * Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js. */ FROM_CODE_POINT: ElementaryFeature; /** * A string representation of dynamically generated functions where the character at index 19 is a line feed \("\\n"\). * * @remarks * * Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js. */ FUNCTION_19_LF: ElementaryFeature; /** * A string representation of dynamically generated functions where the character at index 22 is a line feed \("\\n"\). * * @remarks * * Available in Internet Explorer. */ FUNCTION_22_LF: ElementaryFeature; /** Features available in Internet Explorer 11. */ IE_11: PredefinedFeature; /** Features available in Internet Explorer 11 on Windows 10. */ IE_11_WIN_10: PredefinedFeature; /** Features available in Internet Explorer 11 on Windows 8. */ IE_11_WIN_8: PredefinedFeature; /** * A string representation of native functions typical for Internet Explorer. * * Remarkable traits are the presence of a line feed character \("\\n"\) at the beginning and at the end of the string and a line feed followed by four whitespaces \("\\n "\) before the "\[native code\]" sequence. * * @remarks * * Available in Internet Explorer. */ IE_SRC: ElementaryFeature; /** * The ability to use unary increment operators with string characters, like in \( ++"some string"\[0\] \): this will result in a TypeError in strict mode in ECMAScript compliant engines. * * @remarks * * Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Node.js. This feature is not available when strict mode is enforced in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Node.js. */ INCR_CHAR: ElementaryFeature; /** * Availability of iterator helpers. * * @remarks * * Available in Chrome, Edge, Firefox 131+, Safari 18.4+, Opera, and Node.js 22.0+. */ ITERATOR_HELPER: ElementaryFeature; /** * Language sensitive string representation of Infinity as "∞". * * @remarks * * Available in Chrome, Edge, Firefox, Internet Explorer 11 on Windows 10, Safari, Opera, and Node.js. */ LOCALE_INFINITY: ElementaryFeature; /** * Localized number formatting for Bengali. * * @remarks * * Available in Chrome, Edge, Firefox, Internet Explorer 11 on Windows 10, Safari before 18.4, Opera, and Node.js. */ LOCALE_NUMERALS_BN: ElementaryFeature; /** * Extended localized number formatting. * * Localized number formatting including the output of the first three letters in the second word of the Arabic string representation of NaN \("رقم"\), the letters in the Russian string representation of NaN \("не число"\) and the letters in the Persian string representation of NaN \("ناعدد"\). * * @remarks * * Available in Chrome, Edge, Firefox, Internet Explorer 11 on Windows 10, Safari, Opera, and Node.js. */ LOCALE_NUMERALS_EXT: ElementaryFeature; /** * Existence of the name property for functions. * * @remarks * * Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js. */ NAME: ElementaryFeature; /** Features available in Node.js 20 to 21. */ NODE_20: PredefinedFeature; /** Features available in Node.js 22.0 to 22.11 and Node.js 23.0 to 23.2. */ NODE_22: PredefinedFeature; /** Features available in Node.js 22.12 to 22.14 and Node.js 23.3 or later. */ NODE_22_12: PredefinedFeature; /** * A string representation of native functions typical for V8 or for Internet Explorer but not for Firefox and Safari. * * @remarks * * Available in Chrome, Edge, Internet Explorer, Opera, and Node.js. */ NO_FF_SRC: ElementaryFeature; /** * A string representation of native functions typical for most engines with the notable exception of Internet Explorer. * * A remarkable trait of this feature is the lack of line feed characters at the beginning and at the end of the string. * * @remarks * * Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js. */ NO_IE_SRC: ElementaryFeature; /** * A string representation of native functions typical for Firefox, Internet Explorer and Safari. * * A most remarkable trait of this feature is the presence of a line feed followed by four whitespaces \("\\n "\) before the "\[native code\]" sequence. * * @remarks * * Available in Firefox, Internet Explorer, and Safari. */ NO_V8_SRC: ElementaryFeature; /** * The property that the Array.prototype.entries\(\).constructor is the Object constructor. * * @remarks * * Available in Firefox before 131, Safari before 18.4, and Node.js before 22.0. */ OBJECT_ARRAY_ENTRIES_CTOR: ElementaryFeature; /** * The property that the string representation of the global object self starts with "\[object W". * * @remarks * * Available in Chrome, Edge, Firefox, Internet Explorer, Safari, and Opera. This feature is not available inside web workers in Chrome, Edge, Firefox, Safari, and Opera. */ OBJECT_W_SELF: ElementaryFeature; /** * Existence of the global object Intl having the string representation "\[object Object\]". * * @remarks * * Available in Internet Explorer. */ PLAIN_INTL: ElementaryFeature; /** * The property that the string representation of String.prototype.matchAll\(\) evaluates to "\[object RegExp String Iterator\]". * * @remarks * * Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js. */ REGEXP_STRING_ITERATOR: ElementaryFeature; /** * Russian string representation of Infinity as "∞". * * @remarks * * Available in Chrome, Edge, Firefox, Internet Explorer 11 on Windows 8 and on Windows 10, Safari, Opera, and Node.js. */ RUSSIAN_INFINITY: ElementaryFeature; /** * Features available in the current stable version of Safari. * * An alias for `SAFARI_18_4`. */ SAFARI: PredefinedFeature; /** * Features available in Safari 17.4 to 17.6. * * @remarks * * This feature may be replaced or removed in the near future when current browser versions become obsolete. Use `SAFARI_PRE_PREV` instead of `SAFARI_17_4` for long term support. * * @see * * [Engine Support Policy](https://github.com/fasttime/JScrewIt#engine-support-policy) */ SAFARI_17_4: PredefinedFeature; /** * Features available in Safari 18.0 to 18.3. * * @remarks * * This feature may be replaced or removed in the near future when current browser versions become obsolete. * * @see * * [Engine Support Policy](https://github.com/fasttime/JScrewIt#engine-support-policy) */ SAFARI_18_0: PredefinedFeature; /** * Features available in Safari 18.4 or later. * * @remarks * * This feature may be replaced or removed in the near future when current browser versions become obsolete. Use `SAFARI` or `SAFARI_PREV` instead of `SAFARI_18_4` for long term support. * * @see * * [Engine Support Policy](https://github.com/fasttime/JScrewIt#engine-support-policy) */ SAFARI_18_4: PredefinedFeature; /** * Features available in the previous to current version of Safari. * * An alias for `SAFARI_18_4`. */ SAFARI_PREV: PredefinedFeature; /** * Features available in the previous to previous version of Safari. * * An alias for `SAFARI_17_4`. */ SAFARI_PRE_PREV: PredefinedFeature; /** * Existence of the global object self whose string representation starts with "\[object ". * * @remarks * * Available in Chrome, Edge, Firefox, Internet Explorer, Safari, and Opera. */ SELF: ElementaryFeature; /** * Support for the two-letter locale name "ar" to format decimal numbers as Arabic numerals. * * @remarks * * Available in Firefox before 134, Internet Explorer, Safari before 18.0, and Node.js before 22.12–22.14 and 23.3. */ SHORT_LOCALES: ElementaryFeature; /** * Existence of the global string status. * * @remarks * * Available in Chrome, Edge, Firefox, Internet Explorer, Safari, and Opera. This feature is not available inside web workers. */ STATUS: ElementaryFeature; /** * A string representation of native functions typical for the V8 engine. * * Remarkable traits are the lack of line feed characters at the beginning and at the end of the string and the presence of a single whitespace before the "\[native code\]" sequence. * * @remarks * * Available in Chrome, Edge, Opera, and Node.js. */ V8_SRC: ElementaryFeature; /** * Existence of the global object self having the string representation "\[object Window\]". * * @remarks * * Available in Chrome, Edge, Firefox, Internet Explorer, Safari, and Opera. This feature is not available inside web workers. */ WINDOW: ElementaryFeature; } /** Name of an elementary feature. */ type ElementaryFeatureName = | 'ARRAY_ITERATOR' | 'ARROW' | 'AT' | 'BARPROP' | 'CAPITAL_HTML' | 'CONSOLE' | 'DOCUMENT' | 'ESC_HTML_QUOT' | 'FF_SRC' | 'FLAT' | 'FROM_CODE_POINT' | 'FUNCTION_19_LF' | 'FUNCTION_22_LF' | 'IE_SRC' | 'INCR_CHAR' | 'ITERATOR_HELPER' | 'LOCALE_INFINITY' | 'LOCALE_NUMERALS_BN' | 'LOCALE_NUMERALS_EXT' | 'NAME' | 'NO_FF_SRC' | 'NO_IE_SRC' | 'NO_V8_SRC' | 'OBJECT_ARRAY_ENTRIES_CTOR' | 'OBJECT_W_SELF' | 'PLAIN_INTL' | 'REGEXP_STRING_ITERATOR' | 'RUSSIAN_INFINITY' | 'SELF' | 'SHORT_LOCALES' | 'STATUS' | 'V8_SRC' | 'WINDOW' ; /** Name of a predefined feature. */ type PredefinedFeatureName = ElementaryFeatureName | 'AUTO' | 'BROWSER' | 'CHROME_122' | 'COMPACT' | 'DEFAULT' | 'FF_131' | 'FF_134' | 'FF_90' | 'IE_11' | 'IE_11_WIN_10' | 'IE_11_WIN_8' | 'NODE_20' | 'NODE_22' | 'NODE_22_12' | 'SAFARI_17_4' | 'SAFARI_18_0' | 'SAFARI_18_4' ;