Mercurial > hg > nginx-site
view xml/en/docs/njs/compatibility.xml @ 2469:98fd810c13e0
Updated docs for the upcoming NGINX Plus release.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Mon, 02 Dec 2019 13:23:05 +0300 |
parents | d4be176c6345 |
children | b40a2e795fd9 |
line wrap: on
line source
<?xml version="1.0"?> <!-- Copyright (C) Nginx, Inc. --> <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> <article name="Compatibility" link="/en/docs/njs/compatibility.html" lang="en" rev="20" toc="no"> <section> <para> njs is created in compliance with <link url="http://www.ecma-international.org/ecma-262/5.1/">ECMAScript 5.1</link> (strict mode) with some <link url="http://www.ecma-international.org/ecma-262/6.0/">ECMAScript 6</link> and later extensions. The compliance is still evolving. </para> </section> <section id="supported" name="What is currently supported"> <para> <list type="bullet"> <listitem> Boolean values, numbers, strings, objects, arrays, functions, function constructors (<link doc="changes.xml" id="njs0.3.6">0.3.6</link>), and regular expressions </listitem> <listitem> ES5.1 operators, ES7 exponentiation operators </listitem> <listitem> ES5.1 statements: <literal>break</literal>, <literal>catch</literal>, <literal>continue</literal>, <literal>do while</literal>, <literal>else</literal>, <literal>finally</literal>, <literal>for</literal>, <literal>for in</literal>, <literal>if</literal>, <literal>return</literal>, <literal>switch</literal>, <literal>throw</literal>, <literal>try</literal>, <literal>var</literal>, <literal>while</literal>, labeled statements (<link doc="changes.xml" id="njs0.2.8">0.2.8</link>) </listitem> <listitem> <literal>Math</literal> properties: <list type="bullet"> <listitem> ES6: <literal>E</literal>, <literal>LN10</literal>, <literal>LN2</literal>, <literal>LOG10E</literal>, <literal>LOG2E</literal>, <literal>PI</literal>, <literal>SQRT1_2</literal>, <literal>SQRT2</literal> </listitem> </list> </listitem> <listitem> <literal>Math</literal> methods: <list type="bullet"> <listitem> ES6: <literal>abs</literal>, <literal>acos</literal>, <literal>acosh</literal>, <literal>asin</literal>, <literal>asinh</literal>, <literal>atan</literal>, <literal>atan2</literal>, <literal>atanh</literal>, <literal>cbrt</literal>, <literal>ceil</literal>, <literal>clz32</literal>, <literal>cos</literal>, <literal>cosh</literal>, <literal>exp</literal>, <literal>expm1</literal>, <literal>floor</literal>, <literal>fround</literal>, <literal>hypot</literal>, <literal>imul</literal>, <literal>log</literal>, <literal>log10</literal>, <literal>log1p</literal>, <literal>log2</literal>, <literal>max</literal>, <literal>min</literal>, <literal>pow</literal>, <literal>random</literal>, <literal>round</literal>, <literal>sign</literal>, <literal>sin</literal>, <literal>sinh</literal>, <literal>sqrt</literal>, <literal>tan</literal>, <literal>tanh</literal>, <literal>trunc</literal> </listitem> </list> </listitem> <listitem> <literal>Number</literal> properties: <list type="bullet"> <listitem> ES6: <literal>EPSILON</literal>, <literal>MAX_SAFE_INTEGER</literal>, <literal>MAX_VALUE</literal>, <literal>MIN_SAFE_INTEGER</literal>, <literal>MIN_VALUE</literal>, <literal>NEGATIVE_INFINITY</literal>, <literal>NaN</literal>, <literal>POSITIVE_INFINITY</literal> </listitem> </list> </listitem> <listitem> <literal>Number</literal> methods: <list type="bullet"> <listitem> ES6: <literal>isFinite</literal>, <literal>isInteger</literal>, <literal>isNaN</literal>, <literal>isSafeInteger</literal>, <literal>parseFloat</literal>, <literal>parseInt</literal> </listitem> </list> </listitem> <listitem> <literal>Number</literal> instance methods: <list type="bullet"> <listitem> ES6: <literal>toExponential</literal> (<link doc="changes.xml" id="njs0.3.6">0.3.6</link>), <literal>toFixed</literal> (<link doc="changes.xml" id="njs0.3.6">0.3.6</link>), <literal>toPrecision</literal> (<link doc="changes.xml" id="njs0.3.6">0.3.6</link>) </listitem> </list> </listitem> <listitem> <literal>String</literal> methods: <list type="bullet"> <listitem> ES5.1: <link doc="reference.xml" id="string_fromcharcode"><literal>fromCharCode</literal></link> </listitem> <listitem> ES6: <link doc="reference.xml" id="string_fromcodepoint"><literal>fromCodePoint</literal></link> </listitem> </list> </listitem> <listitem> <literal>String</literal> instance methods: <list type="bullet"> <listitem> ES5.1: <link doc="reference.xml" id="string_charat"><literal>charAt</literal></link>, <link doc="reference.xml" id="string_concat"><literal>concat</literal></link>, <link doc="reference.xml" id="string_indexof"><literal>indexOf</literal></link>, <link doc="reference.xml" id="string_lastindexof"><literal>lastIndexOf</literal></link>, <link doc="reference.xml" id="string_match"><literal>match</literal></link>, <link doc="reference.xml" id="string_replace"><literal>replace</literal></link> <link doc="reference.xml" id="string_search"><literal>search</literal></link>, <link doc="reference.xml" id="string_slice"><literal>slice</literal></link>, <link doc="reference.xml" id="string_split"><literal>split</literal></link>, <link doc="reference.xml" id="string_substr"><literal>substr</literal></link>, <link doc="reference.xml" id="string_substring"><literal>substring</literal></link>, <link doc="reference.xml" id="string_tolowercase"><literal>toLowerCase</literal></link>, <link doc="reference.xml" id="string_trim"><literal>trim</literal></link>, <link doc="reference.xml" id="string_touppercase"><literal>toUpperCase</literal></link> </listitem> <listitem> ES6: <link doc="reference.xml" id="string_codepointat"><literal>codePointAt</literal></link>, <link doc="reference.xml" id="string_endswith"><literal>endsWith</literal></link>, <link doc="reference.xml" id="string_includes"><literal>includes</literal></link>, <link doc="reference.xml" id="string_repeat"><literal>repeat</literal></link>, <link doc="reference.xml" id="string_startswith"><literal>startsWith</literal></link> </listitem> <listitem> ES8: <link doc="reference.xml" id="string_padend"><literal>padEnd</literal></link>, <link doc="reference.xml" id="string_padstart"><literal>padStart</literal></link> </listitem> <listitem> ES9: <link doc="reference.xml" id="string_trimend"><literal>trimEnd</literal></link> (<link doc="changes.xml" id="njs0.3.4">0.3.4</link>), <link doc="reference.xml" id="string_trimstart"><literal>trimStart</literal></link> (<link doc="changes.xml" id="njs0.3.4">0.3.4</link>) </listitem> <listitem> non-standard: <link doc="reference.xml" id="string_bytesfrom"><literal>bytesFrom</literal></link> (0.2.3), <link doc="reference.xml" id="string_frombytes"><literal>fromBytes</literal></link>, <link doc="reference.xml" id="string_fromutf8"><literal>fromUTF8</literal></link>, <link doc="reference.xml" id="string_tobytes"><literal>toBytes</literal></link>, <link doc="reference.xml" id="string_toutf8"><literal>toUTF8</literal></link> </listitem> </list> </listitem> <listitem> <literal>Object</literal> methods: <list type="bullet"> <listitem> ES5.1: <literal>create</literal> (support without properties list), <literal>defineProperties</literal> (accessor descriptors support since <link doc="changes.xml" id="njs0.3.3">0.3.3</link>), <literal>defineProperty</literal> (accessor descriptors support since <link doc="changes.xml" id="njs0.3.3">0.3.3</link>), <literal>freeze</literal>, <literal>getOwnPropertyDescriptor</literal>, <literal>getOwnPropertyDescriptors</literal> (<link doc="changes.xml" id="njs0.3.1">0.3.1</link>), <literal>getOwnPropertyNames</literal> (<link doc="changes.xml" id="njs0.3.1">0.3.1</link>), <literal>getPrototypeOf</literal>, <literal>isExtensible</literal>, <literal>isFrozen</literal>, <literal>isSealed</literal>, <literal>keys</literal>, <literal>preventExtensions</literal>, <literal>seal</literal> </listitem> <listitem> ES6: <literal>assign</literal> (<link doc="changes.xml" id="njs0.3.7">0.3.7</link>) </listitem> <listitem> ES8: <link doc="reference.xml" id="object_entries"><literal>entries</literal></link> (<link doc="changes.xml" id="njs0.2.7">0.2.7</link>), <link doc="reference.xml" id="object_values"><literal>values</literal></link> (<link doc="changes.xml" id="njs0.2.7">0.2.7</link>) </listitem> </list> </listitem> <listitem> <literal>Object</literal> instance methods: <list type="bullet"> <listitem> ES5.1: <literal>hasOwnProperty</literal>, <literal>isPrototypeOf</literal>, (<link doc="changes.xml" id="njs0.3.0">0.3.0</link>), <literal>propertyIsEnumerable</literal>, <literal>toString</literal>, <literal>valueOf</literal> </listitem> </list> </listitem> <listitem> <literal>Array</literal> methods: <list type="bullet"> <listitem> ES5.1: <literal>isArray</literal> </listitem> <listitem> ES6: <literal>of</literal> </listitem> </list> </listitem> <listitem> <literal>Array</literal> instance methods: <list type="bullet"> <listitem> ES5.1: <literal>concat</literal>, <literal>every</literal>, <literal>filter</literal>, <literal>forEach</literal>, <literal>indexOf</literal>, <literal>join</literal>, <literal>lastIndexOf</literal>, <literal>map</literal>, <literal>pop</literal>, <literal>push</literal>, <literal>reduce</literal>, <literal>reduceRight</literal>, <literal>reverse</literal>, <literal>shift</literal>, <literal>slice</literal>, <literal>some</literal>, <literal>sort</literal>, <literal>splice</literal>, <literal>unshift</literal> </listitem> <listitem> ES6: <literal>copyWithin</literal> (<link doc="changes.xml" id="njs0.3.7">0.3.7</link>), <literal>fill</literal>, <literal>find</literal>, <literal>findIndex</literal> </listitem> <listitem> ES7: <literal>includes</literal> </listitem> </list> </listitem> <listitem> <literal>Function</literal> instance methods: <list type="bullet"> <listitem> ES5.1: <literal>apply</literal>, <literal>bind</literal>, <literal>call</literal> </listitem> </list> </listitem> <listitem> <literal>RegExp</literal> instance methods: <list type="bullet"> <listitem> ES5.1: <literal>exec</literal>, <literal>test</literal>, <literal>toString</literal> </listitem> </list> </listitem> <listitem> <literal>RegExp</literal> ES9 named capture groups (<link doc="changes.xml" id="njs0.3.2">0.3.2</link>) </listitem> <listitem> <literal>Date</literal> methods: <list type="bullet"> <listitem> ES5.1: <literal>now</literal>, <literal>parse</literal>, <literal>UTC</literal> </listitem> </list> </listitem> <listitem> <literal>Date</literal> instance methods: <list type="bullet"> <listitem> ES5.1: <literal>getDate</literal>, <literal>getDay</literal>, <literal>getFullYear</literal>, <literal>getHours</literal>, <literal>getMilliseconds</literal>, <literal>getMinutes</literal>, <literal>getMonth</literal>, <literal>getSeconds</literal>, <literal>getTime</literal>, <literal>getTimezoneOffset</literal>, <literal>getUTCDate</literal>, <literal>getUTCDay</literal>, <literal>getUTCFullYear</literal>, <literal>getUTCHours</literal>, <literal>getUTCMilliseconds</literal>, <literal>getUTCMinutes</literal>, <literal>getUTCMonth</literal>, <literal>getUTCSeconds</literal>, <literal>toDateString</literal>, <literal>toISOString</literal>, <literal>toLocaleDateString</literal>, <literal>toLocaleString</literal>, <literal>toLocaleTimeString</literal>, <literal>toTimeString</literal>, <literal>toUTCString</literal>, <literal>setDate</literal>, <literal>setFullYear</literal>, <literal>setHours</literal>, <literal>setMinutes</literal>, <literal>setMilliseconds</literal>, <literal>setMonth</literal>, <literal>setSeconds</literal>, <literal>setTime</literal>, <literal>setUTCDate</literal>, <literal>setUTCFullYear</literal>, <literal>setUTCHours</literal>, <literal>setUTCMilliseconds</literal>, <literal>setUTCMinutes</literal>, <literal>setUTCMonth</literal>, <literal>setUTCSeconds</literal> </listitem> </list> </listitem> <listitem> <link doc="reference.xml" id="core_json"><literal>JSON</literal></link> methods: <list type="bullet"> <listitem> ES5.1: <link doc="reference.xml" id="core_json_parse"><literal>parse</literal></link>, <link doc="reference.xml" id="core_json_stringify"><literal>stringify</literal></link> </listitem> </list> </listitem> <listitem> ES5.1 <literal>arguments</literal> object (0.2.5) </listitem> <listitem> ES6 rest parameters syntax (without destructuring support) (<link doc="changes.xml" id="njs0.2.7">0.2.7</link>) </listitem> <listitem> ES5.1 global functions: <link doc="reference.xml" id="decodeuri"><literal>decodeURI</literal></link>, <link doc="reference.xml" id="decodeuricomponent"><literal>decodeURIComponent</literal></link>, <link doc="reference.xml" id="encodeuri"><literal>encodeURI</literal></link>, <link doc="reference.xml" id="encodeuricomponent"><literal>encodeURIComponent</literal></link>, <literal>isFinite</literal>, <literal>isNaN</literal>, <literal>parseFloat</literal>, <literal>parseInt</literal> </listitem> <listitem> <literal>Error</literal> objects: <literal>Error</literal>, <literal>EvalError</literal>, <literal>InternalError</literal>, <literal>RangeError</literal>, <literal>ReferenceError</literal>, <literal>SyntaxError</literal>, <literal>TypeError</literal>, <literal>URIError</literal> </listitem> <listitem> <link doc="reference.xml" id="cleartimeout"><literal>clearTimeout</literal></link> and <link doc="reference.xml" id="settimeout"><literal>setTimeout</literal></link> functions (0.2.0) </listitem> <listitem> <literal>File system</literal> methods: <link doc="reference.xml" id="appendfilesync"><literal>fs.appendFileSync</literal></link>, <link doc="reference.xml" id="readfilesync"><literal>fs.readFileSync</literal></link>, <link doc="reference.xml" id="writefilesync"><literal>fs.writeFileSync</literal></link>, <link doc="reference.xml" id="renamesync"><literal>fs.renameSync</literal></link> (<link doc="changes.xml" id="njs0.3.4">0.3.4</link>) </listitem> <listitem> <literal>Crypto</literal> methods (0.2.0): <link doc="reference.xml" id="crypto_createhash"><literal>crypto.createHash</literal></link>, <link doc="reference.xml" id="crypto_createhmac"><literal>crypto.createHmac</literal></link> </listitem> <listitem> ES6 modules support: default <literal>export</literal> and default <literal>import</literal> statements (<link doc="changes.xml" id="njs0.3.0">0.3.0</link>) </listitem> <listitem> ES6 arrow functions (<link doc="changes.xml" id="njs0.3.1">0.3.1</link>) </listitem> <listitem> Template literals: multiline strings, expression interpolation, nesting templates (<link doc="changes.xml" id="njs0.3.2">0.3.2</link>) </listitem> <listitem> Global objects (<link doc="changes.xml" id="njs0.3.3">0.3.3</link>): <list type="bullet"> <listitem> <link doc="reference.xml" id="process"><literal>process</literal></link> </listitem> </list> </listitem> </list> </para> </section> </article>