changeset 2271:34a1901e663d

Described charAt, codePointAt, fromCharCode in njs.
author Yaroslav Zhuravlev <yar@nginx.com>
date Wed, 31 Oct 2018 20:56:02 +0300
parents cd9934924920
children 3fa4584907b8
files xml/en/docs/njs/compatibility.xml xml/en/docs/njs/reference.xml xml/ru/docs/njs/compatibility.xml
diffstat 3 files changed, 41 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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="4">
+        rev="5">
 
 <section>
 
@@ -59,12 +59,12 @@ ES6 <literal>Number</literal> and
 
 <listitem>
 ES5.1:
-<literal>fromCharCode</literal>,
+<link doc="reference.xml" id="string_fromcharcode"><literal>fromCharCode</literal></link>,
 <link doc="reference.xml" id="string_concat"><literal>concat</literal></link>,
 <link doc="reference.xml" id="string_slice"><literal>slice</literal></link>,
 <link doc="reference.xml" id="string_substring"><literal>substring</literal></link>,
 <link doc="reference.xml" id="string_substr"><literal>substr</literal></link>,
-<literal>charAt</literal>,
+<link doc="reference.xml" id="string_charat"><literal>charAt</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_tolowercase"><literal>toLowerCase</literal></link>,
@@ -79,7 +79,7 @@ ES5.1:
 <listitem>
 ES6:
 <link doc="reference.xml" id="string_fromcodepoint"><literal>fromCodePoint</literal></link>,
-<literal>codePointAt</literal>,
+<link doc="reference.xml" id="string_codepointat"><literal>codePointAt</literal></link>,
 <link doc="reference.xml" id="string_includes"><literal>includes</literal></link>,
 <link doc="reference.xml" id="string_startswith"><literal>startsWith</literal></link>,
 <link doc="reference.xml" id="string_endswith"><literal>endsWith</literal></link>,
--- 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="14">
+        rev="15">
 
 <section id="summary">
 
@@ -524,6 +524,16 @@ 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>
@@ -534,6 +544,28 @@ Returns a string from one or more Unicod
 </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 <literal>index</literal> can be 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 index;
+<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>
--- 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="4">
+        rev="5">
 
 <section>
 
@@ -59,12 +59,12 @@ ES6 методы и свойства <literal>Number</literal> и
 
 <listitem>
 ES5.1:
-<literal>fromCharCode</literal>,
+<link doc="reference.xml" id="string_fromcharcode"><literal>fromCharCode</literal></link>,
 <link doc="reference.xml" id="string_concat"><literal>concat</literal></link>,
 <link doc="reference.xml" id="string_slice"><literal>slice</literal></link>,
 <link doc="reference.xml" id="string_substring"><literal>substring</literal></link>,
 <link doc="reference.xml" id="string_substr"><literal>substr</literal></link>,
-<literal>charAt</literal>,
+<link doc="reference.xml" id="string_charat"><literal>charAt</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_tolowercase"><literal>toLowerCase</literal></link>,
@@ -79,7 +79,7 @@ ES5.1:
 <listitem>
 ES6:
 <link doc="reference.xml" id="string_fromcodepoint"><literal>fromCodePoint</literal></link>,
-<literal>codePointAt</literal>,
+<link doc="reference.xml" id="string_codepointat"><literal>codePointAt</literal></link>,
 <link doc="reference.xml" id="string_includes"><literal>includes</literal></link>,
 <link doc="reference.xml" id="string_startswith"><literal>startsWith</literal></link>,
 <link doc="reference.xml" id="string_endswith"><literal>endsWith</literal></link>,