Mercurial > hg > nginx-site
changeset 2569:2edc64c05b0e
Removed ECMAScript methods from njs Reference.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Tue, 14 Jul 2020 16:44:46 +0100 |
parents | aa015272ea32 |
children | 44792f1ee284 |
files | xml/en/docs/njs/changes.xml xml/en/docs/njs/compatibility.xml xml/en/docs/njs/reference.xml xml/ru/docs/njs/compatibility.xml xml/ru/docs/njs/reference.xml |
diffstat | 5 files changed, 304 insertions(+), 999 deletions(-) [+] |
line wrap: on
line diff
--- a/xml/en/docs/njs/changes.xml +++ b/xml/en/docs/njs/changes.xml @@ -9,7 +9,7 @@ <article name="Changes" link="/en/docs/njs/changes.html" lang="en" - rev="33" + rev="34" toc="no"> <section id="njs0.4.2" name="Changes with njs 0.4.2"> @@ -82,7 +82,7 @@ fixed TypedScript API description for <l <para> Bugfix: fixed -<link doc="reference.xml" id="string_repeat"><literal>String.prototype.repeat()</literal></link> +<literal>String.prototype.repeat()</literal> according to the specification. </para> </listitem> @@ -91,7 +91,7 @@ according to the specification. <para> Bugfix: fixed -<link doc="reference.xml" id="string_replace"><literal>String.prototype.replace()</literal></link> +<literal>String.prototype.replace()</literal> according to the specification. </para> </listitem> @@ -308,7 +308,7 @@ with empty pattern and non-empty flags. <para> Bugfix: fixed -<link doc="reference.xml" id="string_replace"><literal>String.prototype.replace()</literal></link> +<literal>String.prototype.replace()</literal> when function returns non-string. </para> </listitem> @@ -429,9 +429,9 @@ fixed heap-buffer-overflow in <para> Bugfix: fixed -<link doc="reference.xml" id="encodeuri"><literal>encodeURI()</literal></link> +<literal>encodeURI()</literal> and -<link doc="reference.xml" id="decodeuri"><literal>decodeURI()</literal></link> +<literal>decodeURI()</literal> according to the specification. </para> </listitem> @@ -447,7 +447,7 @@ fixed <literal>Number.prototype.toPrecis <para> Bugfix: fixed handling of space argument in -<link doc="reference.xml" id="core_json_stringify"><literal>JSON.stringify()</literal></link>. +<literal>JSON.stringify()</literal>. </para> </listitem> @@ -455,7 +455,7 @@ fixed handling of space argument in <para> Bugfix: fixed -<link doc="reference.xml" id="core_json_stringify"><literal>JSON.stringify()</literal></link> +<literal>JSON.stringify()</literal> with <literal>Number()</literal> and <literal>String()</literal> @@ -467,7 +467,7 @@ objects. <para> Bugfix: fixed Unicode Escaping in -<link doc="reference.xml" id="core_json_stringify"><literal>JSON.stringify()</literal></link> +<literal>JSON.stringify()</literal> according to specification. </para> </listitem> @@ -576,7 +576,7 @@ Thanks to Artem S. Povalyukhin. <para> Feature: added externals support for -<link doc="reference.xml" id="core_json_stringify"><literal>JSON.stringify()</literal></link>. +<literal>JSON.stringify()</literal>. </para> </listitem> @@ -625,7 +625,7 @@ according to the specification. <para> Bugfix: fixed -<link doc="reference.xml" id="core_json_stringify"><literal>JSON.stringify()</literal></link> +<literal>JSON.stringify()</literal> with unprintable values and replacer function. </para> </listitem> @@ -1012,7 +1012,7 @@ fixed handing of accessor descriptors in <para> Bugfix: fixed -<link doc="reference.xml" id="string_replace"><literal>String.prototype.replace()</literal></link> +<literal>String.prototype.replace()</literal> when first argument is not a string. </para> </listitem> @@ -1070,21 +1070,26 @@ fixed <listitem> <para> Bugfix: -fixed <literal>Date.UTC()</literal> according to the specification. +fixed +<literal>Date.UTC()</literal> +according to the specification. </para> </listitem> <listitem> <para> Bugfix: -fixed <literal>Date()</literal> constructor according to the specification. +fixed +<literal>Date()</literal> constructor +according to the specification. </para> </listitem> <listitem> <para> Bugfix: -fixed type of <literal>Date.prototype</literal>. +fixed type of +<literal>Date.prototype</literal>. Thanks to Artem S. Povalyukhin. </para> </listitem> @@ -1092,7 +1097,8 @@ Thanks to Artem S. Povalyukhin. <listitem> <para> Bugfix: -fixed <literal>Date.prototype.setTime()</literal>. +fixed +<literal>Date.prototype.setTime()</literal>. Thanks to Artem S. Povalyukhin. </para> </listitem> @@ -1107,7 +1113,9 @@ fixed default number of arguments expect <listitem> <para> Bugfix: -fixed <literal>caller</literal> and <literal>arguments</literal> +fixed +<literal>caller</literal> and +<literal>arguments</literal> properties of a function instance. Thanks to Artem S. Povalyukhin. </para> @@ -1141,7 +1149,8 @@ The bug was introduced in <link id="0.3. <listitem> <para> Bugfix: -fixed <literal>[[SetPrototypeOf]]</literal>. +fixed +<literal>[[SetPrototypeOf]]</literal>. </para> </listitem> @@ -1165,7 +1174,9 @@ Core: <listitem> <para> Feature: -added <literal>Object</literal> shorthand methods and computed property names. +added +<literal>Object</literal> +shorthand methods and computed property names. Thanks to 洪志道 (Hong Zhi Dao) and Artem S. Povalyukhin. </para> </listitem> @@ -1190,9 +1201,9 @@ added <para> Feature: added -<link doc="reference.xml" id="string_trimend"><literal>String.prototype.trimEnd()</literal></link> +<literal>String.prototype.trimEnd()</literal> and -<link doc="reference.xml" id="string_trimstart"><literal>String.prototype.trimStart()</literal></link>. +<literal>String.prototype.trimStart()</literal>. </para> </listitem> @@ -1229,7 +1240,7 @@ fixed reading files with zero size in <para> Bugfix: extended the list of space separators in -<link doc="reference.xml" id="string_trim"><literal>String.prototype.trim()</literal></link>. +<literal>String.prototype.trim()</literal>. </para> </listitem> @@ -1237,7 +1248,7 @@ extended the list of space separators in <para> Bugfix: fixed using of uninitialized value in -<link doc="reference.xml" id="string_padstart"><literal>String.prototype.padStart()</literal></link>. +<literal>String.prototype.padStart()</literal>. </para> </listitem> @@ -1245,7 +1256,8 @@ fixed using of uninitialized value in <para> Bugfix: fixed -<link doc="reference.xml" id="string_replace"><literal>String.prototype.replace()</literal></link> for <literal>$0</literal> and <literal>$&</literal> replacement string. +<literal>String.prototype.replace()</literal> +for <literal>$0</literal> and <literal>$&</literal> replacement string. </para> </listitem> @@ -1253,7 +1265,7 @@ fixed <para> Bugfix: fixed -<link doc="reference.xml" id="string_replace"><literal>String.prototype.replace()</literal></link> +<literal>String.prototype.replace()</literal> for byte strings with regex argument. </para> </listitem> @@ -1262,7 +1274,7 @@ for byte strings with regex argument. <para> Bugfix: fixed global match in -<link doc="reference.xml" id="string_replace"><literal>String.prototype.replace()</literal></link> +<literal>String.prototype.replace()</literal> with regexp argument. </para> </listitem> @@ -1294,9 +1306,9 @@ fixed UTF-8 character escaping. <para> Bugfix: fixed -<link doc="reference.xml" id="object_values"><literal>Object.values()</literal></link> +<literal>Object.values()</literal> and -<link doc="reference.xml" id="object_entries"><literal>Object.entries()</literal></link> +<literal>Object.entries()</literal> for shared objects. </para> </listitem> @@ -1305,7 +1317,7 @@ for shared objects. <para> Bugfix: fixed uninitialized memory access in -<link doc="reference.xml" id="string_match"><literal>String.prototype.match()</literal></link>. +<literal>String.prototype.match()</literal>. </para> </listitem> @@ -1313,7 +1325,7 @@ fixed uninitialized memory access in <para> Bugfix: fixed -<link doc="reference.xml" id="string_match"><literal>String.prototype.match()</literal></link> +<literal>String.prototype.match()</literal> for byte strings with regex argument. </para> </listitem> @@ -1331,7 +1343,7 @@ with undefined arguments. <para> Bugfix: fixed -<link doc="reference.xml" id="string_substring"><literal>String.prototype.substring()</literal></link> +<literal>String.prototype.substring()</literal> with empty substring. </para> </listitem> @@ -1340,7 +1352,7 @@ with empty substring. <para> Bugfix: fixed invalid memory access in -<link doc="reference.xml" id="string_substring"><literal>String.prototype.substring()</literal></link>. +<literal>String.prototype.substring()</literal>. </para> </listitem> @@ -1348,7 +1360,7 @@ fixed invalid memory access in <para> Bugfix: fixed -<link doc="reference.xml" id="string_fromcharcode"><literal>String.fromCharCode()</literal></link> +<literal>String.fromCharCode()</literal> for code points more than <literal>65535</literal> and <literal>NaN</literal>. </para> </listitem> @@ -1357,23 +1369,27 @@ for code points more than <literal>65535 <para> Bugfix: fixed -<link doc="reference.xml" id="string_tolowercase"><literal>String.prototype.toLowerCase()</literal></link> +<literal>String.prototype.toLowerCase()</literal> and -<link doc="reference.xml" id="string_touppercase"><literal>String.prototype.toUpperCase()</literal></link>. +<literal>String.prototype.toUpperCase()</literal>. </para> </listitem> <listitem> <para> Bugfix: -fixed <literal>Error()</literal> constructor with no arguments. +fixed +<literal>Error()</literal> +constructor with no arguments. </para> </listitem> <listitem> <para> Bugfix: -fixed <literal>in</literal> operator for values with accessor descriptors. +fixed +<literal>in</literal> +operator for values with accessor descriptors. </para> </listitem> @@ -1495,7 +1511,7 @@ added generic implementation of <para> Bugfix: fixed integer-overflow in -<link doc="reference.xml" id="string_concat"><literal>String.prototype.concat()</literal></link>. +<literal>String.prototype.concat()</literal>. </para> </listitem> @@ -1547,9 +1563,9 @@ fixed processing of invalid surrogate pa <para> Bugfix: fixed heap-buffer-overflow in -<link doc="reference.xml" id="string_touppercase"><literal>toUpperCase()</literal></link> +<literal>toUpperCase()</literal> and -<link doc="reference.xml" id="string_touppercase"><literal>toLowerCase()</literal></link>. +<literal>toLowerCase()</literal>. </para> </listitem> @@ -1572,7 +1588,7 @@ fixed handling zero byte characters insi <para> Bugfix: fixed -<link doc="reference.xml" id="string_tobytes"><literal>String.prototype.toBytes()</literal></link> +<literal>String.prototype.toBytes()</literal> for ASCII strings. </para> </listitem> @@ -1581,7 +1597,7 @@ for ASCII strings. <para> Bugfix: fixed truth value of JSON numbers in -<link doc="reference.xml" id="core_json_parse"><literal>JSON.parse()</literal></link>. +<literal>JSON.parse()</literal>. </para> </listitem> @@ -1674,14 +1690,18 @@ made all constructor properties configur <listitem> <para> Bugfix: -fixed <literal>Regexp.prototype.exec()</literal> for Unicode-only regexps. +fixed +<literal>Regexp.prototype.exec()</literal> +for Unicode-only regexps. </para> </listitem> <listitem> <para> Bugfix: -fixed <literal>njs_vm_value_dump()</literal> for empty string values. +fixed +<literal>njs_vm_value_dump()</literal> +for empty string values. </para> </listitem> @@ -1702,7 +1722,8 @@ fixed walking over prototypes chain duri <listitem> <para> Bugfix: -fixed overflow in <literal>Array.prototype.concat()</literal>. +fixed overflow in +<literal>Array.prototype.concat()</literal>. </para> </listitem> @@ -1731,7 +1752,9 @@ fixed processing the “*” quantifier for <listitem> <para> Bugfix: -fixed <literal>Date()</literal> constructor with one argument. +fixed +<literal>Date()</literal> +constructor with one argument. </para> </listitem> @@ -1792,14 +1815,18 @@ fixed processing the “*” quantifier for <listitem> <para> Bugfix: -fixed <literal>Array.prototype.slice()</literal> for UTF8-invalid byte strings. +fixed +<literal>Array.prototype.slice()</literal> +for UTF8-invalid byte strings. </para> </listitem> <listitem> <para> Bugfix: -fixed <literal>String.prototype.split()</literal> for UTF8-invalid byte strings. +fixed +<literal>String.prototype.split()</literal> +for UTF8-invalid byte strings. </para> </listitem> @@ -1838,7 +1865,8 @@ Thanks to 洪志道 (Hong Zhi Dao) and Artem S. Povalyukhin. <listitem> <para> Feature: -added <literal>Object.getOwnPropertyNames()</literal>. +added +<literal>Object.getOwnPropertyNames()</literal>. Thanks to Artem S. Povalyukhin. </para> </listitem> @@ -1846,7 +1874,8 @@ Thanks to Artem S. Povalyukhin. <listitem> <para> Feature: -added <literal>Object.getOwnPropertyDescriptors()</literal>. +added +<literal>Object.getOwnPropertyDescriptors()</literal>. Thanks to Artem S. Povalyukhin. </para> </listitem> @@ -1884,7 +1913,8 @@ fixed editline detection. <listitem> <para> Bugfix: -fixed <literal>Function.prototype.bind()</literal>. +fixed +<literal>Function.prototype.bind()</literal>. Thanks to 洪志道 (Hong Zhi Dao). </para> </listitem> @@ -2015,7 +2045,8 @@ Thanks to 洪志道 (Hong Zhi Dao). <listitem> <para> Feature: -added <literal>Object.prototype.propertyIsEnumerable()</literal>. +added +<literal>Object.prototype.propertyIsEnumerable()</literal>. </para> </listitem> @@ -2052,7 +2083,8 @@ fixed setting length of UTF8 string in <listitem> <para> Bugfix: -fixed <literal>nxt_file_dirname()</literal> for paths with no dir component. +fixed +<literal>nxt_file_dirname()</literal> for paths with no dir component. </para> </listitem> @@ -2130,7 +2162,8 @@ added labels support. <listitem> <para> Feature: -added <literal>setImmediate()</literal> method. +added +<literal>setImmediate()</literal> method. </para> </listitem> @@ -2144,7 +2177,8 @@ added support for shorthand property nam <listitem> <para> Bugfix: -fixed <literal>Function.prototype.bind()</literal>. +fixed +<literal>Function.prototype.bind()</literal>. </para> </listitem> @@ -2174,7 +2208,7 @@ fixed creation of long UTF8 strings. Bugfix: fixed setting special response headers in -<link doc="reference.xml" id="string_split"><literal>String.prototype.split()</literal></link> +<literal>String.prototype.split()</literal> for Unicode strings. </para> </listitem> @@ -2183,14 +2217,15 @@ for Unicode strings. <para> Bugfix: fixed heap-buffer-overflow in -<link doc="reference.xml" id="string_split"><literal>String.prototype.split()</literal></link>. +<literal>String.prototype.split()</literal>. </para> </listitem> <listitem> <para> Bugfix: -fixed <literal>Array.prototype.fill()</literal>. +fixed +<literal>Array.prototype.fill()</literal>. Thanks to Artem S. Povalyukhin. </para> </listitem> @@ -2254,7 +2289,7 @@ Thanks to Alexander Pyshchev. <para> Feature: added -<link doc="reference.xml" id="object_entries"><literal>Object.entries()</literal></link> +<literal>Object.entries()</literal> method. </para> </listitem> @@ -2263,7 +2298,7 @@ method. <para> Feature: added -<link doc="reference.xml" id="object_values"><literal>Object.values()</literal></link> +<literal>Object.values()</literal> method. </para> </listitem> @@ -2415,14 +2450,16 @@ fixed handling of “this” keyword in various scopes. <listitem> <para> Bugfix: -fixed handling non-object values in <literal>Object.keys()</literal>. +fixed handling non-object values in +<literal>Object.keys()</literal>. </para> </listitem> <listitem> <para> Bugfix: -fixed parsing of throw statement inside <literal>if</literal> statement. +fixed parsing of throw statement inside +<literal>if</literal> statement. </para> </listitem> @@ -2490,22 +2527,26 @@ fixed counting pending events in stream <listitem> <para> Bugfix: -fixed <literal>s.off()</literal> in stream module. +fixed +<literal>s.off()</literal> in stream module. </para> </listitem> <listitem> <para> Bugfix: -fixed processing of data chunks in <literal>js_filter</literal> in stream module. +fixed processing of data chunks in +<literal>js_filter</literal> in stream module. </para> </listitem> <listitem> <para> Bugfix: -fixed http <literal>status</literal> and -<literal>contentType</literal> getter in http module. +fixed http +<literal>status</literal> and +<literal>contentType</literal> +getter in http module. </para> </listitem> @@ -2540,28 +2581,32 @@ non-integer fractions support. <listitem> <para> Improvement: -handling non-array values in <literal>Array.prototype.slice()</literal>. +handling non-array values in +<literal>Array.prototype.slice()</literal>. </para> </listitem> <listitem> <para> Bugfix: -fixed <literal>Array.prototype.length</literal> setter +fixed +<literal>Array.prototype.length</literal> setter </para> </listitem> <listitem> <para> Bugfix: -fixed <literal>njs_array_alloc()</literal> for length > 2**31. +fixed +<literal>njs_array_alloc()</literal> for length > 2**31. </para> </listitem> <listitem> <para> Bugfix: -handling int overflow in <literal>njs_array_alloc()</literal> on 32bit archs. +handling int overflow in +<literal>njs_array_alloc()</literal> on 32bit archs. </para> </listitem> @@ -2582,15 +2627,19 @@ fixed delete operator in a loop. <listitem> <para> Bugfix: -fixed <literal>Object.getOwnPropertyDescriptor()</literal> for complex object -(inherited from <literal>Array</literal> and <literal>string</literal> values). +fixed +<literal>Object.getOwnPropertyDescriptor()</literal> +for complex object (inherited from +<literal>Array</literal> and +<literal>string</literal> values). </para> </listitem> <listitem> <para> Bugfix: -fixed <literal>Object.prototype.hasOwnProperty()</literal> +fixed +<literal>Object.prototype.hasOwnProperty()</literal> for non-object properties </para> </listitem> @@ -2627,12 +2676,12 @@ stream module handlers refactored. <para> New methods and properties: -<link doc="reference.xml" id="s_on">s.on()</link>, -<link doc="reference.xml" id="s_off">s.off()</link>, -<link doc="reference.xml" id="s_allow">s.allow()</link>, -<link doc="reference.xml" id="s_done">s.done()</link>, -<link doc="reference.xml" id="s_decline">s.decline()</link>, -<link doc="reference.xml" id="s_deny">s.deny()</link>. +<link doc="reference.xml" id="s_on"><literal>s.on()</literal></link>, +<link doc="reference.xml" id="s_off"><literal>s.off()</literal></link>, +<link doc="reference.xml" id="s_allow"><literal>s.allow()</literal></link>, +<link doc="reference.xml" id="s_done"><literal>s.done()</literal></link>, +<link doc="reference.xml" id="s_decline"><literal>s.decline()</literal></link>, +<link doc="reference.xml" id="s_deny"><literal>s.deny()</literal></link>. </para> <para> @@ -2644,16 +2693,16 @@ Removed properties of the <literal>s.DECLINED</literal>, <literal>s.ERROR</literal> (replaced with -<link doc="reference.xml" id="s_allow">s.allow()</link>, -<link doc="reference.xml" id="s_done">s.done()</link>, -<link doc="reference.xml" id="s_deny">s.deny()</link>). +<link doc="reference.xml" id="s_allow"><literal>s.allow()</literal></link>, +<link doc="reference.xml" id="s_done"><literal>s.done()</literal></link>, +<link doc="reference.xml" id="s_deny"><literal>s.deny()</literal></link>). </para> <para> <literal>s.buffer</literal> (for reading replaced with data argument of the corresponding callback, for writing use -<link doc="reference.xml" id="s_send">s.send()</link>). +<link doc="reference.xml" id="s_send"><literal>s.send()</literal></link>). </para> <para> @@ -2664,7 +2713,7 @@ the corresponding callback, for writing <para> <literal>s.eof</literal> (replaced with <literal></literal> -<link doc="reference.xml" id="s_on_callback_last">flags.last</link>). +<link doc="reference.xml" id="s_on_callback_last"><literal>flags.last</literal></link>). </para> </listitem> @@ -2679,7 +2728,8 @@ Core: <listitem> <para> Feature: -added <literal>Function.prototype.length</literal>. +added +<literal>Function.prototype.length</literal>. </para> </listitem> @@ -2715,7 +2765,8 @@ for attempts to change frozen properties <listitem> <para> Bugfix: -fixed <literal>Object.defineProperty()</literal> for existing properties. +fixed +<literal>Object.defineProperty()</literal> for existing properties. </para> </listitem> @@ -2743,14 +2794,18 @@ fixed exception handling in arguments of <listitem> <para> Bugfix: -fixed <literal>Object.prototype.toString</literal> for different value types. +fixed +<literal>Object.prototype.toString</literal> +for different value types. </para> </listitem> <listitem> <para> Bugfix: -fixed <literal>Object()</literal> constructor for object types arguments. +fixed +<literal>Object()</literal> +constructor for object types arguments. </para> </listitem> @@ -2764,7 +2819,9 @@ fixed comparison of objects and strings. <listitem> <para> Bugfix: -fixed <literal>String.slice()</literal> for undefined arguments. +fixed +<literal>String.slice()</literal> +for undefined arguments. </para> </listitem> @@ -2795,8 +2852,9 @@ nginx modules: <listitem> <para> Bugfix: -making a subrequest from a <literal>Reply</literal> object caused -a segmentation fault. +making a subrequest from a +<literal>Reply</literal> +object caused a segmentation fault. </para> </listitem> @@ -2840,7 +2898,7 @@ correctly parsing floating point numbers <listitem> <para> Feature: -<link doc="reference.xml" id="string_bytesfrom">String.bytesFrom()</link> method +<link doc="reference.xml" id="string_bytesfrom"><literal>String.bytesFrom()</literal></link> method (decoding <literal>hex</literal>, <literal>base64</literal>, <literal>base64url</literal> into a byte string). @@ -2850,8 +2908,9 @@ Feature: <listitem> <para> Feature: -<link doc="reference.xml" id="string_padstart">String.padStart()</link> and -<link doc="reference.xml" id="string_padend">String.padEnd()</link> methods. +<literal>String.padStart()</literal> and +<literal>String.padEnd()</literal> +methods. </para> </listitem> @@ -2900,14 +2959,16 @@ fixed addition operator applied to an ob <listitem> <para> Bugfix: -fixed exception handling in <literal>njs_vm_value_to_ext_string()</literal>. +fixed exception handling in +<literal>njs_vm_value_to_ext_string()</literal>. </para> </listitem> <listitem> <para> Bugfix: -fixed <literal>Number()</literal> with boolean, null and undefined arguments. +fixed +<literal>Number()</literal> with boolean, null and undefined arguments. </para> </listitem> @@ -3085,7 +3146,8 @@ Core: <listitem> <para> Bugfix: -fixed heap-buffer-overflow in <literal>crypto.createHmac()</literal>. +fixed heap-buffer-overflow in +<literal>crypto.createHmac()</literal>. </para> </listitem> @@ -3177,7 +3239,7 @@ public header <literal>cleanup. njscript <listitem> <para> Bugfix: -fixed crypto <literal>update()</literal> method after +fixed crypto <literal>update()</literal> method after <literal>digest()</literal> is called. </para> </listitem>
--- a/xml/en/docs/njs/compatibility.xml +++ b/xml/en/docs/njs/compatibility.xml @@ -9,7 +9,7 @@ <article name="Compatibility" link="/en/docs/njs/compatibility.html" lang="en" - rev="24" + rev="25" toc="no"> <section> @@ -23,6 +23,20 @@ and later extensions. The compliance is still evolving. </para> +<para> +Definitions of njs specific properties and methods +not compliant with ECMAScript can be found in +<link doc="reference.xml">Reference</link>. +Definitions of njs properties and methods +compliant with ECMAScript can be found in +<link url="http://www.ecma-international.org/ecma-262/">ECMAScript +specification</link>. +</para> + +<para> + +</para> + </section> @@ -184,12 +198,12 @@ ES6: <listitem> ES5.1: -<link doc="reference.xml" id="string_fromcharcode"><literal>fromCharCode</literal></link> +<literal>fromCharCode</literal> </listitem> <listitem> ES6: -<link doc="reference.xml" id="string_fromcodepoint"><literal>fromCodePoint</literal></link> +<literal>fromCodePoint</literal> </listitem> </list> @@ -201,48 +215,49 @@ ES6: <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> +<literal>charAt</literal>, +<literal>concat</literal>, +<literal>indexOf</literal>>, +<literal>lastIndexOf</literal>, +<literal>match</literal>, +<literal>replace</literal>, +<literal>search</literal>, +<literal>slice</literal>, +<literal>split</literal>, +<literal>substr</literal>, +<literal>substring</literal>, +<literal>toLowerCase</literal>, +<literal>trim</literal>, +<literal>toUpperCase</literal> </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> +<literal>codePointAt</literal>, +<literal>endsWith</literal>, +<literal>includes</literal>, +<literal>repeat</literal>, +<literal>startsWith</literal> </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> +<literal>padEnd</literal>, +<literal>padStart</literal> </listitem> <listitem> ES9: -<link doc="reference.xml" id="string_trimend"><literal>trimEnd</literal></link> +<literal>trimEnd</literal> (<link doc="changes.xml" id="njs0.3.4">0.3.4</link>), -<link doc="reference.xml" id="string_trimstart"><literal>trimStart</literal></link> +<literal>trimStart</literal> (<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_bytesfrom"><literal>bytesFrom</literal></link> +(<link doc="changes.xml" id="njs0.2.3">0.2.3</link>), <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>, @@ -285,9 +300,9 @@ ES6: <listitem> ES8: -<link doc="reference.xml" id="object_entries"><literal>entries</literal></link> +<literal>entries</literal> (<link doc="changes.xml" id="njs0.2.7">0.2.7</link>), -<link doc="reference.xml" id="object_values"><literal>values</literal></link> +<literal>values</literal> (<link doc="changes.xml" id="njs0.2.7">0.2.7</link>) </listitem> </list> @@ -565,20 +580,21 @@ ES5.1: </listitem> <listitem> -<link doc="reference.xml" id="core_json"><literal>JSON</literal></link> methods: +<literal>JSON</literal> 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> +<literal>parse</literal> +<literal>stringify</literal> </listitem> </list> </listitem> <listitem> -ES5.1 <literal>arguments</literal> object (0.2.5) +ES5.1 <literal>arguments</literal> object +(<link doc="changes.xml" id="njs0.2.5">0.2.5</link>) </listitem> <listitem> @@ -588,10 +604,10 @@ ES6 rest parameters syntax (without dest <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>decodeURI</literal>, +<literal>decodeURIComponent</literal>, +<literal>encodeURI</literal>, +<literal>encodeURIComponent</literal>, <literal>isFinite</literal>, <literal>isNaN</literal>, <literal>parseFloat</literal>, @@ -614,7 +630,8 @@ ES5.1 global functions: <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) +functions +(<link doc="changes.xml" id="njs0.2.0">0.2.0</link>) </listitem> <listitem> @@ -646,7 +663,8 @@ asynchronous version of file system meth </listitem> <listitem> -<literal>Crypto</literal> methods (0.2.0): +<literal>Crypto</literal> methods +(<link doc="changes.xml" id="njs0.2.0">0.2.0</link>): <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>
--- a/xml/en/docs/njs/reference.xml +++ b/xml/en/docs/njs/reference.xml @@ -9,7 +9,7 @@ <article name="Reference" link="/en/docs/njs/reference.html" lang="en" - rev="45"> + rev="46"> <section id="summary"> @@ -18,6 +18,17 @@ for extending nginx functionality. </para> +<para> +This reference contains only njs specific properties, methods and modules +not compliant with ECMAScript. +Definitions of njs properties and methods compliant with ECMAScript +can be found in +<link url="http://www.ecma-international.org/ecma-262/">ECMAScript +specification</link>. +List of all njs properties and methods can be found in +<link doc="compatibility.xml">Compatibility</link>. +</para> + </section> @@ -546,33 +557,6 @@ Returns the PID of the current parent pr </section> -<section id="core_object" name="Object"> - -<para> -The <literal>Object</literal> constructor corresponds to a standard JS object. -<list type="tag"> - -<tag-name id="object_entries"><literal>Object.entries(<value>object</value>)</literal></tag-name> -<tag-desc> -returns an array of all enumerable property -<literal>[key, value]</literal> pairs -of the given <literal>object</literal> -(<link doc="changes.xml" id="njs0.2.7">0.2.7</link>). -</tag-desc> - -<tag-name id="object_values"><literal>Object.values(<value>object</value>)</literal></tag-name> -<tag-desc> -returns an array of all enumerable property values -of the given <literal>object</literal> -(<link doc="changes.xml" id="njs0.2.7">0.2.7</link>). -</tag-desc> - -</list> -</para> - -</section> - - <section id="string" name="String"> <para> @@ -622,7 +606,7 @@ first, it should be converted to a byte <tag-name id="string_bytesfrom"><literal>String.bytesFrom(<value>array</value> | <value>string</value>, <value>encoding</value>)</literal></tag-name> <tag-desc> -(njs specific) Creates a byte string either from an array that contains octets, +Creates a byte string either from an array that contains octets, or from an encoded string (<link doc="changes.xml" id="njs0.2.3">0.2.3</link>). The encoding can be @@ -638,298 +622,29 @@ The encoding can be </example> </tag-desc> -<tag-name id="string_fromcharcode"><literal>String.fromCharCode(<value>CharCode1</value>[, ...[, -<value>CharCodeN</value>]])</literal></tag-name> -<tag-desc> -Returns a string from one or more Unicode code points. -<example> ->> String.fromCharCode(97, 98, 99, 100) -'abcd' -</example> -</tag-desc> - -<tag-name id="string_fromcodepoint"><literal>String.fromCodePoint(<value>codePoint1</value>[, ...[, -<value>codePoint2</value>]])</literal></tag-name> -<tag-desc> -Returns a string from one or more Unicode code points. -<example> ->> String.fromCodePoint(97, 98, 99, 100) -'abcd' -</example> -</tag-desc> - -<tag-name id="string_charat"><literal>String.prototype.charAt(<value>index</value>)</literal></tag-name> -<tag-desc> -Returns a string representing one Unicode code unit -at the specified <literal>index</literal>; -empty string if index is out of range. -The index can be an integer -between 0 and 1-less-than the length of the string. -If no index is provided, the default is <literal>0</literal>, -so the first character in the string is returned. -</tag-desc> - -<tag-name id="string_codepointat"><literal>String.prototype.CodePointAt(<value>position</value>)</literal></tag-name> -<tag-desc> -Returns a number representing the code point value of the character -at the given <literal>position</literal>; -<literal>undefined</literal> if there is no element at position. -<example> ->> 'ABCD'.codePointAt(3); -68 -</example> -</tag-desc> - -<tag-name id="string_concat"><literal>String.prototype.concat(<value>string1</value>[, ..., -<value>stringN</value>])</literal></tag-name> -<tag-desc> -Returns a string that contains the concatenation of specified -<literal>strings</literal>. -<example> ->> "a".concat("b", "c") -'abc' -</example> -</tag-desc> - -<tag-name id="string_endswith"><literal>String.prototype.endsWith(<value>searchString</value>[, -<value>length</value>])</literal></tag-name> -<tag-desc> -Returns <literal>true</literal> if a string ends with the characters -of a specified string, otherwise <literal>false</literal>. -The optional <literal>length</literal> parameter is the the length of string. -If omitted, the default value is the length of the string. -<example> ->> 'abc'.endsWith('abc') -true ->> 'abca'.endsWith('abc') -false -</example> -</tag-desc> - <tag-name id="string_frombytes"><literal>String.prototype.fromBytes(<value>start</value>[, <value>end</value>])</literal></tag-name> <tag-desc> -(njs specific) Returns a new Unicode string from a byte string +Returns a new Unicode string from a byte string where each byte is replaced with a corresponding Unicode code point. </tag-desc> <tag-name id="string_fromutf8"><literal>String.prototype.fromUTF8(<value>start</value>[, <value>end</value>])</literal></tag-name> <tag-desc> -(njs specific) Converts a byte string containing a valid UTF8 string +Converts a byte string containing a valid UTF8 string into a Unicode string, otherwise <literal>null</literal> is returned. </tag-desc> -<tag-name id="string_includes"><literal>String.prototype.includes(<value>searchString</value>[, -<value>position</value>]))</literal></tag-name> -<tag-desc> -Returns <literal>true</literal> if a string is found within another string, -otherwise <literal>false</literal>. -The optional <literal>position</literal> parameter is the position -within the string at which to begin search for <literal>searchString</literal>. -Default value is 0. -<example> ->> 'abc'.includes('bc') -true -</example> -</tag-desc> - -<tag-name id="string_indexof"><literal>String.prototype.indexOf(<value>searchString</value>[, -<value>fromIndex</value>])</literal></tag-name> -<tag-desc> -Returns the position of the first occurrence -of the <literal>searchString</literal>. -The search is started at <literal>fromIndex</literal>. -Returns <value>-1</value> if the value is not found. -The <literal>fromIndex</literal> is an integer, -default value is 0. -If <literal>fromIndex</literal> is lower than 0 -or greater than -<link id="string_length">String.prototype.length</link><value></value>, -the search starts at index <value>0</value> and -<value>String.prototype.length</value>. -<example> ->> 'abcdef'.indexOf('de', 2) -3 -</example> -</tag-desc> - -<tag-name id="string_lastindexof"><literal>String.prototype.lastIndexOf(<value>searchString</value>[, -<value>fromIndex</value>])</literal></tag-name> -<tag-desc> -Returns the position of the last occurrence -of the <literal>searchString</literal>, -searching backwards from <literal>fromIndex</literal>. -Returns <value>-1</value> if the value is not found. -If <literal>searchString</literal> is empty, -then <literal>fromIndex</literal> is returned. -<example> ->> "nginx".lastIndexOf("gi") -1 -</example> -</tag-desc> - -<tag-name id="string_length"><literal>String.prototype.length</literal></tag-name> -<tag-desc> -Returns the length of the string. -<example> ->> 'αβγδ'.length -4 -</example> -</tag-desc> - -<tag-name id="string_match"><literal>String.prototype.match([<value>regexp</value>])</literal></tag-name> -<tag-desc> -Matches a string against a <literal>regexp</literal>. -<example> ->> 'nginx'.match( /ng/i ) -'ng' -</example> -</tag-desc> - -<tag-name id="string_padend"><literal>String.prototype.padEnd(<value>length</value> -[, <value>string</value>])</literal></tag-name> -<tag-desc> -Returns a string of a specified <literal>length</literal> -with the pad <literal>string</literal> applied to the end of the specified -string (<link doc="changes.xml" id="njs0.2.3">0.2.3</link>). -<example> ->> '1234'.padEnd(8, 'abcd') -'1234abcd' -</example> -</tag-desc> - -<tag-name id="string_padstart"><literal>String.prototype.padStart(<value>length</value> -[, <value>string</value>])</literal></tag-name> -<tag-desc> -Returns a string of a specified <literal>length</literal> -with the pad <literal>string</literal> applied to the start of the specified -string (<link doc="changes.xml" id="njs0.2.3">0.2.3</link>). -<example> ->> '1234'.padStart(8, 'abcd') -'abcd1234' -</example> -</tag-desc> - -<tag-name id="string_repeat"><literal>String.prototype.repeat(<value>number</value>)</literal></tag-name> -<tag-desc> -Returns a string -with the specified <literal>number</literal> of copies of the string. -<example> ->> 'abc'.repeat(3) -'abcabcabc' -</example> -</tag-desc> - -<tag-name id="string_replace"><literal>String.prototype.replace([<value>regexp</value>|<value>string</value>[, -<value>string</value>|<value>function</value>]])</literal></tag-name> -<tag-desc> -Returns a new string with matches of a pattern -(<literal>string</literal> or a <literal>regexp</literal>) -replaced by a <literal>string</literal> or a <literal>function</literal>. -<example> ->> 'abcdefgh'.replace('d', 1) -'abc1efgh' -</example> -</tag-desc> - -<tag-name id="string_search"><literal>String.prototype.search([<value>regexp</value>])</literal></tag-name> -<tag-desc> -Searches for a string using a <literal>regexp</literal> -<example> ->> 'abcdefgh'.search('def') -3 -</example> -</tag-desc> - -<tag-name id="string_slice"><literal>String.prototype.slice(<value>start</value>[, -<value>end</value>])</literal></tag-name> -<tag-desc> -Returns a new string containing a part of an -original string between <literal>start</literal> -and <literal>end</literal> or -from <literal>start</literal> to the end of the string. -<example> ->> 'abcdefghijklmno'.slice(NaN, 5) -'abcde' -</example> -</tag-desc> - -<tag-name id="string_split"><literal>String.prototype.split(([<value>string</value>|<value>regexp</value>[, -<value>limit</value>]]))</literal></tag-name> -<tag-desc> -Returns match of a string against a <literal>regexp</literal>. -The optional <literal>limit</literal> parameter is an integer that specifies -a limit on the number of splits to be found. -<example> ->> 'abc'.split('') -[ - 'a', - 'b', - 'c' -] -</example> -</tag-desc> - -<tag-name id="string_startswith"><literal>String.prototype.startsWith(<value>searchString</value>[, -<value>position</value>])</literal></tag-name> -<tag-desc> -Returns <literal>true</literal> if a string begins with the characters -of a specified string, otherwise <literal>false</literal>. -The optional <literal>position</literal> parameter is the position -in this string at which to begin search for <literal>searchString</literal>. -Default value is 0. -<example> ->> 'abc'.startsWith('abc') -true -> 'aabc'.startsWith('abc') -false -</example> -</tag-desc> - -<tag-name id="string_substr"><literal>String.prototype.substr(<value>start</value>[, -<value>length</value>])</literal></tag-name> -<tag-desc> -Returns the part of the string of the specified <literal>length</literal> -from <literal>start</literal> -or from <literal>start</literal> to the end of the string. -<example> ->> 'abcdefghijklmno'.substr(3, 5) -'defgh' -</example> -</tag-desc> - -<tag-name id="string_substring"><literal>String.prototype.substring(<value>start</value>[, -<value>end</value>])</literal></tag-name> -<tag-desc> -Returns the part of the string between -<literal>start</literal> and <literal>end</literal> or -from <literal>start</literal> to the end of the string. -<example> ->> 'abcdefghijklmno'.substring(3, 5) -'de' -</example> -</tag-desc> - <tag-name id="string_tobytes"><literal>String.prototype.toBytes(start[, end])</literal></tag-name> <tag-desc> -(njs specific) Serializes a Unicode string to a byte string. +Serializes a Unicode string to a byte string. Returns <literal>null</literal> if a character larger than 255 is found in the string. </tag-desc> -<tag-name id="string_tolowercase"><literal>String.prototype.toLowerCase()</literal></tag-name> -<tag-desc> -Converts a string to lower case. -The method supports only simple Unicode folding. -<example> ->> 'ΑΒΓΔ'.toLowerCase() -'αβγδ' -</example> -</tag-desc> - <tag-name><literal>String.prototype.toString([<value>encoding</value>])</literal></tag-name> <tag-desc> <para> @@ -938,7 +653,7 @@ returns a specified Unicode string or by </para> <para> -(njs specific) If <literal>encoding</literal> is specified, +If <literal>encoding</literal> is specified, encodes a <link id="string_tobytes">byte string</link> to <literal>hex</literal>, <literal>base64</literal>, or @@ -950,20 +665,10 @@ encodes a <link id="string_tobytes">byte </example> </tag-desc> -<tag-name id="string_touppercase"><literal>String.prototype.toUpperCase()</literal></tag-name> -<tag-desc> -Converts a string to upper case. -The method supports only simple Unicode folding. -<example> ->> 'αβγδ'.toUpperCase() -'ΑΒΓΔ' -</example> -</tag-desc> - <tag-name id="string_toutf8"><literal>String.prototype.toUTF8(<value>start</value>[, <value>end</value>])</literal></tag-name> <tag-desc> -(njs specific) Serializes a Unicode string +Serializes a Unicode string to a byte string using UTF8 encoding. <example> >> 'αβγδ'.toUTF8().length @@ -973,166 +678,12 @@ 4 </example> </tag-desc> -<tag-name id="string_trim"><literal>String.prototype.trim()</literal></tag-name> -<tag-desc> -Removes whitespaces from both ends of a string. -<example> ->> ' abc '.trim() -'abc' -</example> -</tag-desc> - -<tag-name id="string_trimend"><literal>String.prototype.trimEnd()</literal></tag-name> -<tag-desc> -Removes whitespaces from the end of a string -(<link doc="changes.xml" id="njs0.3.4">0.3.4</link>). -<example> ->> ' abc '.trimEnd() -' abc' -</example> -</tag-desc> - -<tag-name id="string_trimstart"><literal>String.prototype.trimStart()</literal></tag-name> -<tag-desc> -Removes whitespaces from the beginning of a string -(<link doc="changes.xml" id="njs0.3.4">0.3.4</link>). -<example> ->> ' abc '.trimStart() -'abc ' -</example> -</tag-desc> - -<tag-name id="encodeuri"><literal>encodeURI(<value>URI</value>)</literal></tag-name> -<tag-desc> -Encodes a URI by replacing each instance of certain characters -by one, two, three, or four escape sequences -representing the UTF-8 encoding of the character -<example> ->> encodeURI('012αβγδ') -'012%CE%B1%CE%B2%CE%B3%CE%B4' -</example> -</tag-desc> - -<tag-name id="encodeuricomponent"><literal>encodeURIComponent(<value>encodedURIString</value>)</literal></tag-name> -<tag-desc> -Encodes a URI by replacing each instance of certain characters -by one, two, three, or four escape sequences -representing the UTF-8 encoding of the character. -<example> ->> encodeURIComponent('[@?=') -'%5B%40%3F%3D' -</example> -</tag-desc> - -<tag-name id="decodeuri"><literal>decodeURI(<value>encodedURI</value>)</literal></tag-name> -<tag-desc> -Decodes a previously <link id="encodeuri">encoded</link> URI. -<example> ->> decodeURI('012%CE%B1%CE%B2%CE%B3%CE%B4') -'012αβγδ' -</example> -</tag-desc> - -<tag-name id="decodeuricomponent"><literal>decodeURIComponent(<value>decodedURIString</value>)</literal></tag-name> -<tag-desc> -Decodes an encoded component of a previously encoded URI. -<example> ->> decodeURIComponent('%5B%40%3F%3D') -'[@?=' -</example> -</tag-desc> - </list> </para> </section> -<section id="core_typedarray" name="TypedArray"> - -<para> -<literal>TypedArray</literal> is a number of different global properties -whose values are typed array constructors for specific element types. -<list type="tag"> - -<tag-name id="array_sort"><literal>TypedArray.prototype.sort()</literal></tag-name> -<tag-desc> -sorts the elements of a typed array numerically -and returns the updated typed array -(<link doc="changes.xml" id="njs0.4.2">0.4.2</link>). -</tag-desc> -</list> -</para> - -</section> - - -<section id="core_json" name="JSON"> - -<para> -The <literal>JSON</literal> object (ES 5.1) provides functions -to convert njs values to and from JSON format. -<list type="tag"> - -<tag-name id="core_json_parse"><literal>JSON.parse(<value>string</value>[, -<value>reviver</value>])</literal></tag-name> -<tag-desc> -Converts a <literal>string</literal> that represents JSON data -into an njs object (<literal>{...}</literal>) or -array (<literal>[...]</literal>). -The optional <literal>reviver</literal> parameter is a function (key, value) -that will be called for each (key,value) pair and can transform the value. -</tag-desc> - -<tag-name id="core_json_stringify"><literal>JSON.stringify(<value>value</value>[, -<value>replacer</value>] [, <value>space</value>])</literal></tag-name> -<tag-desc> -Converts an njs object back to JSON. -The obligatory <literal>value</literal> parameter is generally a JSON -<literal>object</literal> or <literal>array</literal> that will be converted. -If the value has a <literal>toJSON()</literal> method, -it defines how the object will be serialized. -The optional <literal>replacer</literal> parameter is -a <literal>function</literal> or <literal>array</literal> -that transforms results. -The optional <literal>space</literal> parameter is -a <literal>string</literal> or <literal>number</literal>. -If it is a <literal>number</literal>, -it indicates the number of white spaces placed before a result -(no more than 10). -If it is a <literal>string</literal>, -it is used as a white space (or first 10 characters of it). -If omitted or is <literal>null</literal>, no white space is used. -</tag-desc> -</list> -</para> - -<para> -<example> ->> var json = JSON.parse('{"a":1, "b":true}') ->> json.a -1 - ->> JSON.stringify(json) -'{"a":1,"b":true}' - ->> JSON.stringify({ x: [10, undefined, function(){}] }) -'{"x":[10,null,null]}' - ->> JSON.stringify({"a":1, "toJSON": function() {return "xxx"}}) -'"xxx"' - -# Example with function replacer - ->> function replacer(key, value) {return (typeof value === 'string') ? undefined : value} ->>JSON.stringify({a:1, b:"b", c:true}, replacer) -'{"a":1,"c":true}' -</example> -</para> - -</section> - - <section id="crypto" name="Crypto"> <para>
--- a/xml/ru/docs/njs/compatibility.xml +++ b/xml/ru/docs/njs/compatibility.xml @@ -9,7 +9,7 @@ <article name="Совместимость" link="/ru/docs/njs/compatibility.html" lang="ru" - rev="24" + rev="25" toc="no"> <section> @@ -23,6 +23,16 @@ njs совместим с Совместимость находится в стадии развития. </para> +<para> +Описания методов и свойств, доступных только в njs +и не соответствующих стандарту ECMAScript, доступны в +<link doc="reference.xml">справочнике</link>. +Описания методов и свойств njs, +соответствующих стандарту, доступны в +<link url="http://www.ecma-international.org/ecma-262/">спецификации +ECMAScript</link>. +</para> + </section> @@ -184,12 +194,12 @@ ES6: <listitem> ES5.1: -<link doc="reference.xml" id="string_fromcharcode"><literal>fromCharCode</literal></link> +<literal>fromCharCode</literal> </listitem> <listitem> ES6: -<link doc="reference.xml" id="string_fromcodepoint"><literal>fromCodePoint</literal></link> +<literal>fromCodePoint</literal> </listitem> </list> @@ -201,48 +211,49 @@ ES6: <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> +<literal>charAt</literal>, +<literal>concat</literal>, +<literal>indexOf</literal>>, +<literal>lastIndexOf</literal>, +<literal>match</literal>, +<literal>replace</literal>, +<literal>search</literal>, +<literal>slice</literal>, +<literal>split</literal>, +<literal>substr</literal>, +<literal>substring</literal>, +<literal>toLowerCase</literal>, +<literal>trim</literal>, +<literal>toUpperCase</literal> </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> +<literal>codePointAt</literal>, +<literal>endsWith</literal>, +<literal>includes</literal>, +<literal>repeat</literal>, +<literal>startsWith</literal> </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> +<literal>padEnd</literal>, +<literal>padStart</literal> </listitem> <listitem> ES9: -<link doc="reference.xml" id="string_trimend"><literal>trimEnd</literal></link> +<literal>trimEnd</literal> (<link doc="changes.xml" id="njs0.3.4">0.3.4</link>), -<link doc="reference.xml" id="string_trimstart"><literal>trimStart</literal></link> +<literal>trimStart</literal> (<link doc="changes.xml" id="njs0.3.4">0.3.4</link>) </listitem> <listitem> нестандартные: -<link doc="reference.xml" id="string_bytesfrom"><literal>bytesFrom</literal></link> (0.2.3), +<link doc="reference.xml" id="string_bytesfrom"><literal>bytesFrom</literal></link> +(<link doc="changes.xml" id="njs0.2.3">0.2.3</link>), <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>, @@ -285,9 +296,9 @@ ES6: <listitem> ES8: -<link doc="reference.xml" id="object_entries"><literal>entries</literal></link> +<literal>entries</literal> (<link doc="changes.xml" id="njs0.2.7">0.2.7</link>), -<link doc="reference.xml" id="object_values"><literal>values</literal></link> +<literal>values</literal> (<link doc="changes.xml" id="njs0.2.7">0.2.7</link>) </listitem> </list> @@ -570,15 +581,16 @@ ES5.1: <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> +<literal>parse</literal> +<literal>stringify</literal> </listitem> </list> </listitem> <listitem> -ES5.1 объект <literal>arguments</literal> (0.2.5) +ES5.1 объект <literal>arguments</literal> +(<link doc="changes.xml" id="njs0.2.5">0.2.5</link>) </listitem> <listitem> @@ -587,11 +599,11 @@ ES6 синтаксис rest параметров (без поддержки деструктуризации) </listitem> <listitem> -ES5.1 глобальные функции: -<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>, +ES5.1 global functions: +<literal>decodeURI</literal>, +<literal>decodeURIComponent</literal>, +<literal>encodeURI</literal>, +<literal>encodeURIComponent</literal>, <literal>isFinite</literal>, <literal>isNaN</literal>, <literal>parseFloat</literal>, @@ -615,7 +627,7 @@ ES5.1 глобальные функции: <link doc="reference.xml" id="cleartimeout"><literal>clearTimeout</literal></link> и <link doc="reference.xml" id="settimeout"><literal>setTimeout</literal></link> -(0.2.0) +(<link doc="changes.xml" id="njs0.2.0">0.2.0</link>) </listitem> <listitem> @@ -647,7 +659,8 @@ ES5.1 глобальные функции: </listitem> <listitem> -Методы <literal>Crypto</literal> (0.2.0): +Методы <literal>Crypto</literal> +(<link doc="changes.xml" id="njs0.2.0">0.2.0</link>): <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>
--- a/xml/ru/docs/njs/reference.xml +++ b/xml/ru/docs/njs/reference.xml @@ -18,6 +18,17 @@ для расширения функциональности nginx. </para> +<para> +Справочник содержит описания методов, свойств и модулей, +доступных только в njs и не соответствующих стандарту ECMAScript. +Описания методов и свойств njs, +соответствующих стандарту, доступны в +<link url="http://www.ecma-international.org/ecma-262/">спецификации +ECMAScript</link>. +Список всех методов и свойств njs доступен в разделе +<link doc="compatibility.xml">Совместимость</link>. +</para> + </section> @@ -591,7 +602,7 @@ TypeError: argument must be a byte strin <tag-name id="string_bytesfrom"><literal>String.bytesFrom(<value>массив</value> | <value>строка</value>, <value>кодировка</value>)</literal></tag-name> <tag-desc> -(только в njs) Создаёт байтовую строку или из массива, содержащего октеты, +Создаёт байтовую строку или из массива, содержащего октеты, или из кодированной строки (<link doc="changes.xml" id="njs0.2.3">0.2.3</link>). Кодировкой может быть @@ -607,299 +618,28 @@ TypeError: argument must be a byte strin </example> </tag-desc> -<tag-name id="string_fromcharcode"><literal>String.fromCharCode(<value>CharCode1</value>[, ...[, -<value>CharCodeN</value>]])</literal></tag-name> -<tag-desc> -Возвращает строку из одной или более Unicode codepoints. -<example> ->> String.fromCharCode(97, 98, 99, 100) -'abcd' -</example> -</tag-desc> - -<tag-name id="string_fromcodepoint"><literal>String.fromCodePoint(<value>codePoint1</value>[, ...[, -<value>codePoint2</value>]])</literal></tag-name> -<tag-desc> -Возвращает строку из одной или более Unicode codepoints. -<example> ->> String.fromCodePoint(97, 98, 99, 100) -'abcd' -</example> -</tag-desc> - -<tag-name id="string_charat"><literal>String.prototype.charAt(<value>индекс</value>)</literal></tag-name> -<tag-desc> -Возвращает строку, представляющую одну кодовую единицу Unicode -внутри указанного <literal>индекса</literal>; -пустая строка, если индекс вне диапазона значений. -Индекс может быть числом -между 0 и длиной строки минус 1. -Если индекс не указан, то значение по умолчанию равно <literal>0</literal>, -т.е. возвращается первый символ в строке. -</tag-desc> - -<tag-name id="string_codepointat"><literal>String.prototype.CodePointAt(<value>позиция</value>)</literal></tag-name> -<tag-desc> -Возвращает число, представляющее codepoint-значение символа -в пределах указанной <literal>позиции</literal>; -<literal>undefined</literal>, если элемент в позиции отсутствует. -<example> ->> 'ABCD'.codePointAt(3); -68 -</example> -</tag-desc> - -<tag-name id="string_concat"><literal>String.prototype.concat(<value>строка1</value>[, ..., -<value>строкаN</value>])</literal></tag-name> -<tag-desc> -Возвращает строку, содержающую результат объединения указанных -<literal>строк</literal>. -<example> ->> "a".concat("b", "c") -'abc' -</example> -</tag-desc> - -<tag-name id="string_endswith"><literal>String.prototype.endsWith(<value>ПоисковаяСтрока</value>[, -<value>длина</value>])</literal></tag-name> -<tag-desc> -Возвращает <literal>true</literal>, если строка заканчивается символами -указанной строки, иначе <literal>false</literal>. -Необязательный параметр <literal>длина</literal> задаёт длину строки. -Если <value>ПоисковаяСтрока</value> не указана, -значением по умолчанию является длина строки. -<example> ->> 'abc'.endsWith('abc') -true ->> 'abca'.endsWith('abc') -false -</example> -</tag-desc> - <tag-name id="string_frombytes"><literal>String.prototype.fromBytes(<value>начало</value>[, <value>конец</value>])</literal></tag-name> <tag-desc> -(только в njs) Возвращает новую строку Unicode из байтовой строки, +Возвращает новую строку Unicode из байтовой строки, в которой каждый байт заменяется соответствующей Unicode codepoint. </tag-desc> <tag-name id="string_fromutf8"><literal>String.prototype.fromUTF8(<value>начало</value>[, <value>конец</value>])</literal></tag-name> <tag-desc> -(только в njs) Преобразует байтовую строку, содержащую валидную строку UTF8, +Преобразует байтовую строку, содержащую валидную строку UTF8, в строку Unicode, иначе возвращается <literal>null</literal>. </tag-desc> -<tag-name id="string_includes"><literal>String.prototype.includes(<value>поисковаяСтрока</value>[, -<value>позиция</value>]))</literal></tag-name> -<tag-desc> -Возвращает <literal>true</literal>, если строка ищется внутри другой строки, -иначе <literal>false</literal>. -Необязательный параметр <literal>позиция</literal> задаёт позицию -внутри строки, от которой начинается поиск для <literal>поисковойСтроки</literal>. -Значение по умолчанию равно 0. -<example> ->> 'abc'.includes('bc') -true -</example> -</tag-desc> - -<tag-name id="string_indexof"><literal>String.prototype.indexOf(<value>поисковаяСтрока</value>[, -<value>fromIndex</value>])</literal></tag-name> -<tag-desc> -Возвращает позицию первого появления -<literal>поисковойСтроки</literal>. -Поиск начинается с <literal>fromIndex</literal>. -Возвращает <value>-1</value>, если значение не найдено. -<literal>fromIndex</literal> является числом, -значение по умолчанию равно 0. -Если <literal>fromIndex</literal> меньше, чем 0 -или больше, чем -<link id="string_length">String.prototype.length</link><value></value>, -поиск начнётся на индексе <value>0</value> и -<value>String.prototype.length</value>. -<example> ->> 'abcdef'.indexOf('de', 2) -3 -</example> -</tag-desc> - -<tag-name id="string_lastindexof"><literal>String.prototype.lastIndexOf(<value>поисковаяСтрока</value>[, -<value>fromIndex</value>])</literal></tag-name> -<tag-desc> -Возвращает позицию последнего появления -of the <literal>поисковойСтроки</literal>, -поиск осуществляется в обратном порядке от <literal>fromIndex</literal>. -Возвращает <value>-1</value>, если значение не найдено. -Если значение <literal>поисковойСтроки</literal> пустое, -то возвращается <literal>fromIndex</literal>. -<example> ->> "nginx".lastIndexOf("gi") -1 -</example> -</tag-desc> - -<tag-name id="string_length"><literal>String.prototype.length</literal></tag-name> -<tag-desc> -Возвращает длину строки. -<example> ->> 'αβγδ'.length -4 -</example> -</tag-desc> - -<tag-name id="string_match"><literal>String.prototype.match([<value>регулярноеВыражение</value>])</literal></tag-name> -<tag-desc> -Возвращает совпадение при сопоставлении строки с -регулярным выражением. -<example> ->> 'nginx'.match( /ng/i ) -'ng' -</example> -</tag-desc> - -<tag-name id="string_padend"><literal>String.prototype.padEnd(<value>длина</value> -[, <value>строка</value>])</literal></tag-name> -<tag-desc> -Возвращает строку указанной длины, -добавляя строку в конец указанной -строки (<link doc="changes.xml" id="njs0.2.3">0.2.3</link>). -<example> ->> '1234'.padEnd(8, 'abcd') -'1234abcd' -</example> -</tag-desc> - -<tag-name id="string_padstart"><literal>String.prototype.padStart(<value>длина</value> -[, <value>строка</value>])</literal></tag-name> -<tag-desc> -Возвращает строку указанной длины, -добавляя строку к началу указанной -строки (<link doc="changes.xml" id="njs0.2.3">0.2.3</link>). -<example> ->> '1234'.padStart(8, 'abcd') -'abcd1234' -</example> -</tag-desc> - -<tag-name id="string_repeat"><literal>String.prototype.repeat(<value>число</value>)</literal></tag-name> -<tag-desc> -Возвращает строку -с указанным числом копий строки. -<example> ->> 'abc'.repeat(3) -'abcabcabc' -</example> -</tag-desc> - -<tag-name id="string_replace"><literal>String.prototype.replace([<value>регулярноеВыражение</value>|<value>string</value>[, -<value>string</value>|<value>function</value>]])</literal></tag-name> -<tag-desc> -Возвращает новую строку, которая сопоставляется со -строкой или регулярным выражением, -и заменяется на <literal>строку</literal> или <literal>функцию</literal>. -<example> ->> 'abcdefgh'.replace('d', 1) -'abc1efgh' -</example> -</tag-desc> - -<tag-name id="string_search"><literal>String.prototype.search([<value>регулярноеВыражение</value>])</literal></tag-name> -<tag-desc> -Осуществляет поиск строки при помощи регулярного выражения. -<example> ->> 'abcdefgh'.search('def') -3 -</example> -</tag-desc> - -<tag-name id="string_slice"><literal>String.prototype.slice(<value>начало</value>[, -<value>конец</value>])</literal></tag-name> -<tag-desc> -Возвращает новую строку, содержащую часть -исходной строки между <literal>началом</literal> -и <literal>концом</literal> или -от <literal>начала</literal> до конца строки. -<example> ->> 'abcdefghijklmno'.slice(NaN, 5) -'abcde' -</example> -</tag-desc> - -<tag-name id="string_split"><literal>String.prototype.split(([<value>строка</value>|<value>регулярноеВыражение</value>[, -<value>лимит</value>]]))</literal></tag-name> -<tag-desc> -Возвращает совпадение строки регулярному выражению. -Необязательный параметр <literal>лимит</literal> является числом, задающим -ограничение на количество найденных подстрок. -<example> ->> 'abc'.split('') -[ - 'a', - 'b', - 'c' -] -</example> -</tag-desc> - -<tag-name id="string_startswith"><literal>String.prototype.startsWith(<value>поисковаяСтрока</value>[, -<value>позиция</value>])</literal></tag-name> -<tag-desc> -Возвращает <literal>true</literal>, если строка начинается с символов -указанной строки, иначе <literal>false</literal>. -Необязательный параметр <literal>позиция</literal> является местом -в этой строке, с которого начинается поиск <literal>поисковойСтоки</literal>. -Значение по умолчанию равно 0. -<example> ->> 'abc'.startsWith('abc') -true -> 'aabc'.startsWith('abc') -false -</example> -</tag-desc> - -<tag-name id="string_substr"><literal>String.prototype.substr(<value>начало</value>[, -<value>длина</value>])</literal></tag-name> -<tag-desc> -Возвращает часть строки указанной <literal>длины</literal> -от <literal>начала</literal> -или от <literal>начала</literal> до конца строки. -<example> ->> 'abcdefghijklmno'.substr(3, 5) -'defgh' -</example> -</tag-desc> - -<tag-name id="string_substring"><literal>String.prototype.substring(<value>начало</value>[, -<value>конец</value>])</literal></tag-name> -<tag-desc> -Возвращает часть строки между -<literal>началом</literal> и <literal>концом</literal> или -от от <literal>начала</literal> до конца строки. -<example> ->> 'abcdefghijklmno'.substring(3, 5) -'de' -</example> -</tag-desc> - <tag-name id="string_tobytes"><literal>String.prototype.toBytes(начало[, конец])</literal></tag-name> <tag-desc> -(только в njs) Сериализует строку Unicode в байтовую строку. +Сериализует строку Unicode в байтовую строку. Возвращает <literal>null</literal>, если в строке найден символ больше, чем 255. </tag-desc> -<tag-name id="string_tolowercase"><literal>String.prototype.toLowerCase()</literal></tag-name> -<tag-desc> -Преобразует строку в нижний регистр. -Метод поддерживает только простое свёртывание Unicode. -<example> ->> 'ΑΒΓΔ'.toLowerCase() -'αβγδ' -</example> -</tag-desc> - <tag-name><literal>String.prototype.toString([<value>кодировка</value>])</literal></tag-name> <tag-desc> <para> @@ -908,7 +648,7 @@ false </para> <para> -(только в njs) Если кодировка указана, +Если кодировка указана, кодирует <link id="string_tobytes">байтовую строку</link> в <literal>hex</literal>, <literal>base64</literal> или @@ -920,20 +660,10 @@ false </example> </tag-desc> -<tag-name id="string_touppercase"><literal>String.prototype.toUpperCase()</literal></tag-name> -<tag-desc> -Преобразует строку в верхний регистр. -Метод поддерживает только простое свёртывание Unicode. -<example> ->> 'αβγδ'.toUpperCase() -'ΑΒΓΔ' -</example> -</tag-desc> - <tag-name id="string_toutf8"><literal>String.prototype.toUTF8(<value>начало</value>[, <value>конец</value>])</literal></tag-name> <tag-desc> -(только в njs) Сериализует строку Unicode +Сериализует строку Unicode в байтовую строку при помощи кодирования UTF8. <example> >> 'αβγδ'.toUTF8().length @@ -943,75 +673,6 @@ 4 </example> </tag-desc> -<tag-name id="string_trim"><literal>String.prototype.trim()</literal></tag-name> -<tag-desc> -Удаляет пробелы в начале и конце строки. -<example> ->> ' abc '.trim() -'abc' -</example> -</tag-desc> - -<tag-name id="string_trimend"><literal>String.prototype.trimEnd()</literal></tag-name> -<tag-desc> -Удаляет пробелы в конце строки. -(<link doc="changes.xml" id="njs0.3.4">0.3.4</link>). -<example> ->> ' abc '.trimEnd() -' abc' -</example> -</tag-desc> - -<tag-name id="string_trimstart"><literal>String.prototype.trimStart()</literal></tag-name> -<tag-desc> -Удаляет пробелы в начале строки. -(<link doc="changes.xml" id="njs0.3.4">0.3.4</link>). -<example> ->> ' abc '.trimStart() -'abc ' -</example> -</tag-desc> - -<tag-name id="encodeuri"><literal>encodeURI(<value>URI</value>)</literal></tag-name> -<tag-desc> -Кодирует URI путём замены определённых символов -на одну, две, три или четыре последовательности, -представляющие UTF-8 кодировку символа. -<example> ->> encodeURI('012αβγδ') -'012%CE%B1%CE%B2%CE%B3%CE%B4' -</example> -</tag-desc> - -<tag-name id="encodeuricomponent"><literal>encodeURIComponent(<value>encodedURIString</value>)</literal></tag-name> -<tag-desc> -Кодирует URI путём замены определённых символов -на одну, две, три или четыре последовательности, -представляющие UTF-8 кодировку символа. -<example> ->> encodeURIComponent('[@?=') -'%5B%40%3F%3D' -</example> -</tag-desc> - -<tag-name id="decodeuri"><literal>decodeURI(<value>encodedURI</value>)</literal></tag-name> -<tag-desc> -Декодирует ранее <link id="encodeuri">кодированный</link> URI. -<example> ->> decodeURI('012%CE%B1%CE%B2%CE%B3%CE%B4') -'012αβγδ' -</example> -</tag-desc> - -<tag-name id="decodeuricomponent"><literal>decodeURIComponent(<value>decodedURIString</value>)</literal></tag-name> -<tag-desc> -Декодирует ранее <link id="encodeuri">кодированный</link> URI. -<example> ->> decodeURIComponent('%5B%40%3F%3D') -'[@?=' -</example> -</tag-desc> - </list> </para>