# HG changeset patch # User Yaroslav Zhuravlev # Date 1594741486 -3600 # Node ID 2edc64c05b0e9384e49c28a2d74b811e35dc7b2c # Parent aa015272ea328655db04dd755ddbbc22cc17d0c7 Removed ECMAScript methods from njs Reference. diff -r aa015272ea32 -r 2edc64c05b0e xml/en/docs/njs/changes.xml --- a/xml/en/docs/njs/changes.xml Tue Jul 14 15:04:35 2020 +0300 +++ b/xml/en/docs/njs/changes.xml Tue Jul 14 16:44:46 2020 +0100 @@ -9,7 +9,7 @@
@@ -82,7 +82,7 @@ Bugfix: fixed -String.prototype.repeat() +String.prototype.repeat() according to the specification. @@ -91,7 +91,7 @@ Bugfix: fixed -String.prototype.replace() +String.prototype.replace() according to the specification. @@ -308,7 +308,7 @@ Bugfix: fixed -String.prototype.replace() +String.prototype.replace() when function returns non-string. @@ -429,9 +429,9 @@ Bugfix: fixed -encodeURI() +encodeURI() and -decodeURI() +decodeURI() according to the specification. @@ -447,7 +447,7 @@ Bugfix: fixed handling of space argument in -JSON.stringify(). +JSON.stringify(). @@ -455,7 +455,7 @@ Bugfix: fixed -JSON.stringify() +JSON.stringify() with Number() and String() @@ -467,7 +467,7 @@ Bugfix: fixed Unicode Escaping in -JSON.stringify() +JSON.stringify() according to specification. @@ -576,7 +576,7 @@ Feature: added externals support for -JSON.stringify(). +JSON.stringify(). @@ -625,7 +625,7 @@ Bugfix: fixed -JSON.stringify() +JSON.stringify() with unprintable values and replacer function. @@ -1012,7 +1012,7 @@ Bugfix: fixed -String.prototype.replace() +String.prototype.replace() when first argument is not a string. @@ -1070,21 +1070,26 @@ Bugfix: -fixed Date.UTC() according to the specification. +fixed +Date.UTC() +according to the specification. Bugfix: -fixed Date() constructor according to the specification. +fixed +Date() constructor +according to the specification. Bugfix: -fixed type of Date.prototype. +fixed type of +Date.prototype. Thanks to Artem S. Povalyukhin. @@ -1092,7 +1097,8 @@ Bugfix: -fixed Date.prototype.setTime(). +fixed +Date.prototype.setTime(). Thanks to Artem S. Povalyukhin. @@ -1107,7 +1113,9 @@ Bugfix: -fixed caller and arguments +fixed +caller and +arguments properties of a function instance. Thanks to Artem S. Povalyukhin. @@ -1141,7 +1149,8 @@ Bugfix: -fixed [[SetPrototypeOf]]. +fixed +[[SetPrototypeOf]]. @@ -1165,7 +1174,9 @@ Feature: -added Object shorthand methods and computed property names. +added +Object +shorthand methods and computed property names. Thanks to 洪志道 (Hong Zhi Dao) and Artem S. Povalyukhin. @@ -1190,9 +1201,9 @@ Feature: added -String.prototype.trimEnd() +String.prototype.trimEnd() and -String.prototype.trimStart(). +String.prototype.trimStart(). @@ -1229,7 +1240,7 @@ Bugfix: extended the list of space separators in -String.prototype.trim(). +String.prototype.trim(). @@ -1237,7 +1248,7 @@ Bugfix: fixed using of uninitialized value in -String.prototype.padStart(). +String.prototype.padStart(). @@ -1245,7 +1256,8 @@ Bugfix: fixed -String.prototype.replace() for $0 and $& replacement string. +String.prototype.replace() +for $0 and $& replacement string. @@ -1253,7 +1265,7 @@ Bugfix: fixed -String.prototype.replace() +String.prototype.replace() for byte strings with regex argument. @@ -1262,7 +1274,7 @@ Bugfix: fixed global match in -String.prototype.replace() +String.prototype.replace() with regexp argument. @@ -1294,9 +1306,9 @@ Bugfix: fixed -Object.values() +Object.values() and -Object.entries() +Object.entries() for shared objects. @@ -1305,7 +1317,7 @@ Bugfix: fixed uninitialized memory access in -String.prototype.match(). +String.prototype.match(). @@ -1313,7 +1325,7 @@ Bugfix: fixed -String.prototype.match() +String.prototype.match() for byte strings with regex argument. @@ -1331,7 +1343,7 @@ Bugfix: fixed -String.prototype.substring() +String.prototype.substring() with empty substring. @@ -1340,7 +1352,7 @@ Bugfix: fixed invalid memory access in -String.prototype.substring(). +String.prototype.substring(). @@ -1348,7 +1360,7 @@ Bugfix: fixed -String.fromCharCode() +String.fromCharCode() for code points more than 65535 and NaN. @@ -1357,23 +1369,27 @@ Bugfix: fixed -String.prototype.toLowerCase() +String.prototype.toLowerCase() and -String.prototype.toUpperCase(). +String.prototype.toUpperCase(). Bugfix: -fixed Error() constructor with no arguments. +fixed +Error() +constructor with no arguments. Bugfix: -fixed in operator for values with accessor descriptors. +fixed +in +operator for values with accessor descriptors. @@ -1495,7 +1511,7 @@ Bugfix: fixed integer-overflow in -String.prototype.concat(). +String.prototype.concat(). @@ -1547,9 +1563,9 @@ Bugfix: fixed heap-buffer-overflow in -toUpperCase() +toUpperCase() and -toLowerCase(). +toLowerCase(). @@ -1572,7 +1588,7 @@ Bugfix: fixed -String.prototype.toBytes() +String.prototype.toBytes() for ASCII strings. @@ -1581,7 +1597,7 @@ Bugfix: fixed truth value of JSON numbers in -JSON.parse(). +JSON.parse(). @@ -1674,14 +1690,18 @@ Bugfix: -fixed Regexp.prototype.exec() for Unicode-only regexps. +fixed +Regexp.prototype.exec() +for Unicode-only regexps. Bugfix: -fixed njs_vm_value_dump() for empty string values. +fixed +njs_vm_value_dump() +for empty string values. @@ -1702,7 +1722,8 @@ Bugfix: -fixed overflow in Array.prototype.concat(). +fixed overflow in +Array.prototype.concat(). @@ -1731,7 +1752,9 @@ Bugfix: -fixed Date() constructor with one argument. +fixed +Date() +constructor with one argument. @@ -1792,14 +1815,18 @@ Bugfix: -fixed Array.prototype.slice() for UTF8-invalid byte strings. +fixed +Array.prototype.slice() +for UTF8-invalid byte strings. Bugfix: -fixed String.prototype.split() for UTF8-invalid byte strings. +fixed +String.prototype.split() +for UTF8-invalid byte strings. @@ -1838,7 +1865,8 @@ Feature: -added Object.getOwnPropertyNames(). +added +Object.getOwnPropertyNames(). Thanks to Artem S. Povalyukhin. @@ -1846,7 +1874,8 @@ Feature: -added Object.getOwnPropertyDescriptors(). +added +Object.getOwnPropertyDescriptors(). Thanks to Artem S. Povalyukhin. @@ -1884,7 +1913,8 @@ Bugfix: -fixed Function.prototype.bind(). +fixed +Function.prototype.bind(). Thanks to 洪志道 (Hong Zhi Dao). @@ -2015,7 +2045,8 @@ Feature: -added Object.prototype.propertyIsEnumerable(). +added +Object.prototype.propertyIsEnumerable(). @@ -2052,7 +2083,8 @@ Bugfix: -fixed nxt_file_dirname() for paths with no dir component. +fixed +nxt_file_dirname() for paths with no dir component. @@ -2130,7 +2162,8 @@ Feature: -added setImmediate() method. +added +setImmediate() method. @@ -2144,7 +2177,8 @@ Bugfix: -fixed Function.prototype.bind(). +fixed +Function.prototype.bind(). @@ -2174,7 +2208,7 @@ Bugfix: fixed setting special response headers in -String.prototype.split() +String.prototype.split() for Unicode strings. @@ -2183,14 +2217,15 @@ Bugfix: fixed heap-buffer-overflow in -String.prototype.split(). +String.prototype.split(). Bugfix: -fixed Array.prototype.fill(). +fixed +Array.prototype.fill(). Thanks to Artem S. Povalyukhin. @@ -2254,7 +2289,7 @@ Feature: added -Object.entries() +Object.entries() method. @@ -2263,7 +2298,7 @@ Feature: added -Object.values() +Object.values() method. @@ -2415,14 +2450,16 @@ Bugfix: -fixed handling non-object values in Object.keys(). +fixed handling non-object values in +Object.keys(). Bugfix: -fixed parsing of throw statement inside if statement. +fixed parsing of throw statement inside +if statement. @@ -2490,22 +2527,26 @@ Bugfix: -fixed s.off() in stream module. +fixed +s.off() in stream module. Bugfix: -fixed processing of data chunks in js_filter in stream module. +fixed processing of data chunks in +js_filter in stream module. Bugfix: -fixed http status and -contentType getter in http module. +fixed http +status and +contentType +getter in http module. @@ -2540,28 +2581,32 @@ Improvement: -handling non-array values in Array.prototype.slice(). +handling non-array values in +Array.prototype.slice(). Bugfix: -fixed Array.prototype.length setter +fixed +Array.prototype.length setter Bugfix: -fixed njs_array_alloc() for length > 2**31. +fixed +njs_array_alloc() for length > 2**31. Bugfix: -handling int overflow in njs_array_alloc() on 32bit archs. +handling int overflow in +njs_array_alloc() on 32bit archs. @@ -2582,15 +2627,19 @@ Bugfix: -fixed Object.getOwnPropertyDescriptor() for complex object -(inherited from Array and string values). +fixed +Object.getOwnPropertyDescriptor() +for complex object (inherited from +Array and +string values). Bugfix: -fixed Object.prototype.hasOwnProperty() +fixed +Object.prototype.hasOwnProperty() for non-object properties @@ -2627,12 +2676,12 @@ New methods and properties: -s.on(), -s.off(), -s.allow(), -s.done(), -s.decline(), -s.deny(). +s.on(), +s.off(), +s.allow(), +s.done(), +s.decline(), +s.deny(). @@ -2644,16 +2693,16 @@ s.DECLINED, s.ERROR (replaced with -s.allow(), -s.done(), -s.deny()). +s.allow(), +s.done(), +s.deny()). s.buffer (for reading replaced with data argument of the corresponding callback, for writing use -s.send()). +s.send()). @@ -2664,7 +2713,7 @@ s.eof (replaced with -flags.last). +flags.last). @@ -2679,7 +2728,8 @@ Feature: -added Function.prototype.length. +added +Function.prototype.length. @@ -2715,7 +2765,8 @@ Bugfix: -fixed Object.defineProperty() for existing properties. +fixed +Object.defineProperty() for existing properties. @@ -2743,14 +2794,18 @@ Bugfix: -fixed Object.prototype.toString for different value types. +fixed +Object.prototype.toString +for different value types. Bugfix: -fixed Object() constructor for object types arguments. +fixed +Object() +constructor for object types arguments. @@ -2764,7 +2819,9 @@ Bugfix: -fixed String.slice() for undefined arguments. +fixed +String.slice() +for undefined arguments. @@ -2795,8 +2852,9 @@ Bugfix: -making a subrequest from a Reply object caused -a segmentation fault. +making a subrequest from a +Reply +object caused a segmentation fault. @@ -2840,7 +2898,7 @@ Feature: -String.bytesFrom() method +String.bytesFrom() method (decoding hex, base64, base64url into a byte string). @@ -2850,8 +2908,9 @@ Feature: -String.padStart() and -String.padEnd() methods. +String.padStart() and +String.padEnd() +methods. @@ -2900,14 +2959,16 @@ Bugfix: -fixed exception handling in njs_vm_value_to_ext_string(). +fixed exception handling in +njs_vm_value_to_ext_string(). Bugfix: -fixed Number() with boolean, null and undefined arguments. +fixed +Number() with boolean, null and undefined arguments. @@ -3085,7 +3146,8 @@ Bugfix: -fixed heap-buffer-overflow in crypto.createHmac(). +fixed heap-buffer-overflow in +crypto.createHmac(). @@ -3177,7 +3239,7 @@ Bugfix: -fixed crypto update() method after +fixed crypto update() method after digest() is called. diff -r aa015272ea32 -r 2edc64c05b0e xml/en/docs/njs/compatibility.xml --- a/xml/en/docs/njs/compatibility.xml Tue Jul 14 15:04:35 2020 +0300 +++ b/xml/en/docs/njs/compatibility.xml Tue Jul 14 16:44:46 2020 +0100 @@ -9,7 +9,7 @@
@@ -23,6 +23,20 @@ The compliance is still evolving. + +Definitions of njs specific properties and methods +not compliant with ECMAScript can be found in +Reference. +Definitions of njs properties and methods +compliant with ECMAScript can be found in +ECMAScript +specification. + + + + + +
@@ -184,12 +198,12 @@ ES5.1: -fromCharCode +fromCharCode ES6: -fromCodePoint +fromCodePoint @@ -201,48 +215,49 @@ ES5.1: -charAt, -concat, -indexOf, -lastIndexOf, -match, -replace -search, -slice, -split, -substr, -substring, -toLowerCase, -trim, -toUpperCase +charAt, +concat, +indexOf>, +lastIndexOf, +match, +replace, +search, +slice, +split, +substr, +substring, +toLowerCase, +trim, +toUpperCase ES6: -codePointAt, -endsWith, -includes, -repeat, -startsWith +codePointAt, +endsWith, +includes, +repeat, +startsWith ES8: -padEnd, -padStart +padEnd, +padStart ES9: -trimEnd +trimEnd (0.3.4), -trimStart +trimStart (0.3.4) non-standard: -bytesFrom (0.2.3), +bytesFrom +(0.2.3), fromBytes, fromUTF8, toBytes, @@ -285,9 +300,9 @@ ES8: -entries +entries (0.2.7), -values +values (0.2.7) @@ -565,20 +580,21 @@ -JSON methods: +JSON methods: ES5.1: -parse, -stringify +parse +stringify -ES5.1 arguments object (0.2.5) +ES5.1 arguments object +(0.2.5) @@ -588,10 +604,10 @@ ES5.1 global functions: -decodeURI, -decodeURIComponent, -encodeURI, -encodeURIComponent, +decodeURI, +decodeURIComponent, +encodeURI, +encodeURIComponent, isFinite, isNaN, parseFloat, @@ -614,7 +630,8 @@ clearTimeout and setTimeout -functions (0.2.0) +functions +(0.2.0) @@ -646,7 +663,8 @@ -Crypto methods (0.2.0): +Crypto methods +(0.2.0): crypto.createHash, crypto.createHmac diff -r aa015272ea32 -r 2edc64c05b0e xml/en/docs/njs/reference.xml --- a/xml/en/docs/njs/reference.xml Tue Jul 14 15:04:35 2020 +0300 +++ b/xml/en/docs/njs/reference.xml Tue Jul 14 16:44:46 2020 +0100 @@ -9,7 +9,7 @@
+ rev="46">
@@ -18,6 +18,17 @@ for extending nginx functionality. + +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 +ECMAScript +specification. +List of all njs properties and methods can be found in +Compatibility. + +
@@ -546,33 +557,6 @@
-
- - -The Object constructor corresponds to a standard JS object. - - -Object.entries(object) - -returns an array of all enumerable property -[key, value] pairs -of the given object -(0.2.7). - - -Object.values(object) - -returns an array of all enumerable property values -of the given object -(0.2.7). - - - - - -
- -
@@ -622,7 +606,7 @@ String.bytesFrom(array | string, encoding) -(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 (0.2.3). The encoding can be @@ -638,298 +622,29 @@ -String.fromCharCode(CharCode1[, ...[, -CharCodeN]]) - -Returns a string from one or more Unicode code points. - ->> String.fromCharCode(97, 98, 99, 100) -'abcd' - - - -String.fromCodePoint(codePoint1[, ...[, -codePoint2]]) - -Returns a string from one or more Unicode code points. - ->> String.fromCodePoint(97, 98, 99, 100) -'abcd' - - - -String.prototype.charAt(index) - -Returns a string representing one Unicode code unit -at the specified index; -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 0, -so the first character in the string is returned. - - -String.prototype.CodePointAt(position) - -Returns a number representing the code point value of the character -at the given position; -undefined if there is no element at position. - ->> 'ABCD'.codePointAt(3); -68 - - - -String.prototype.concat(string1[, ..., -stringN]) - -Returns a string that contains the concatenation of specified -strings. - ->> "a".concat("b", "c") -'abc' - - - -String.prototype.endsWith(searchString[, -length]) - -Returns true if a string ends with the characters -of a specified string, otherwise false. -The optional length parameter is the the length of string. -If omitted, the default value is the length of the string. - ->> 'abc'.endsWith('abc') -true ->> 'abca'.endsWith('abc') -false - - - String.prototype.fromBytes(start[, end]) -(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. String.prototype.fromUTF8(start[, end]) -(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 null is returned. -String.prototype.includes(searchString[, -position])) - -Returns true if a string is found within another string, -otherwise false. -The optional position parameter is the position -within the string at which to begin search for searchString. -Default value is 0. - ->> 'abc'.includes('bc') -true - - - -String.prototype.indexOf(searchString[, -fromIndex]) - -Returns the position of the first occurrence -of the searchString. -The search is started at fromIndex. -Returns -1 if the value is not found. -The fromIndex is an integer, -default value is 0. -If fromIndex is lower than 0 -or greater than -String.prototype.length, -the search starts at index 0 and -String.prototype.length. - ->> 'abcdef'.indexOf('de', 2) -3 - - - -String.prototype.lastIndexOf(searchString[, -fromIndex]) - -Returns the position of the last occurrence -of the searchString, -searching backwards from fromIndex. -Returns -1 if the value is not found. -If searchString is empty, -then fromIndex is returned. - ->> "nginx".lastIndexOf("gi") -1 - - - -String.prototype.length - -Returns the length of the string. - ->> 'αβγδ'.length -4 - - - -String.prototype.match([regexp]) - -Matches a string against a regexp. - ->> 'nginx'.match( /ng/i ) -'ng' - - - -String.prototype.padEnd(length -[, string]) - -Returns a string of a specified length -with the pad string applied to the end of the specified -string (0.2.3). - ->> '1234'.padEnd(8, 'abcd') -'1234abcd' - - - -String.prototype.padStart(length -[, string]) - -Returns a string of a specified length -with the pad string applied to the start of the specified -string (0.2.3). - ->> '1234'.padStart(8, 'abcd') -'abcd1234' - - - -String.prototype.repeat(number) - -Returns a string -with the specified number of copies of the string. - ->> 'abc'.repeat(3) -'abcabcabc' - - - -String.prototype.replace([regexp|string[, -string|function]]) - -Returns a new string with matches of a pattern -(string or a regexp) -replaced by a string or a function. - ->> 'abcdefgh'.replace('d', 1) -'abc1efgh' - - - -String.prototype.search([regexp]) - -Searches for a string using a regexp - ->> 'abcdefgh'.search('def') -3 - - - -String.prototype.slice(start[, -end]) - -Returns a new string containing a part of an -original string between start -and end or -from start to the end of the string. - ->> 'abcdefghijklmno'.slice(NaN, 5) -'abcde' - - - -String.prototype.split(([string|regexp[, -limit]])) - -Returns match of a string against a regexp. -The optional limit parameter is an integer that specifies -a limit on the number of splits to be found. - ->> 'abc'.split('') -[ - 'a', - 'b', - 'c' -] - - - -String.prototype.startsWith(searchString[, -position]) - -Returns true if a string begins with the characters -of a specified string, otherwise false. -The optional position parameter is the position -in this string at which to begin search for searchString. -Default value is 0. - ->> 'abc'.startsWith('abc') -true -> 'aabc'.startsWith('abc') -false - - - -String.prototype.substr(start[, -length]) - -Returns the part of the string of the specified length -from start -or from start to the end of the string. - ->> 'abcdefghijklmno'.substr(3, 5) -'defgh' - - - -String.prototype.substring(start[, -end]) - -Returns the part of the string between -start and end or -from start to the end of the string. - ->> 'abcdefghijklmno'.substring(3, 5) -'de' - - - String.prototype.toBytes(start[, end]) -(njs specific) Serializes a Unicode string to a byte string. +Serializes a Unicode string to a byte string. Returns null if a character larger than 255 is found in the string. -String.prototype.toLowerCase() - -Converts a string to lower case. -The method supports only simple Unicode folding. - ->> 'ΑΒΓΔ'.toLowerCase() -'αβγδ' - - - String.prototype.toString([encoding]) @@ -938,7 +653,7 @@ -(njs specific) If encoding is specified, +If encoding is specified, encodes a byte string to hex, base64, or @@ -950,20 +665,10 @@ -String.prototype.toUpperCase() - -Converts a string to upper case. -The method supports only simple Unicode folding. - ->> 'αβγδ'.toUpperCase() -'ΑΒΓΔ' - - - String.prototype.toUTF8(start[, end]) -(njs specific) Serializes a Unicode string +Serializes a Unicode string to a byte string using UTF8 encoding. >> 'αβγδ'.toUTF8().length @@ -973,166 +678,12 @@ -String.prototype.trim() - -Removes whitespaces from both ends of a string. - ->> ' abc '.trim() -'abc' - - - -String.prototype.trimEnd() - -Removes whitespaces from the end of a string -(0.3.4). - ->> ' abc '.trimEnd() -' abc' - - - -String.prototype.trimStart() - -Removes whitespaces from the beginning of a string -(0.3.4). - ->> ' abc '.trimStart() -'abc ' - - - -encodeURI(URI) - -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 - ->> encodeURI('012αβγδ') -'012%CE%B1%CE%B2%CE%B3%CE%B4' - - - -encodeURIComponent(encodedURIString) - -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. - ->> encodeURIComponent('[@?=') -'%5B%40%3F%3D' - - - -decodeURI(encodedURI) - -Decodes a previously encoded URI. - ->> decodeURI('012%CE%B1%CE%B2%CE%B3%CE%B4') -'012αβγδ' - - - -decodeURIComponent(decodedURIString) - -Decodes an encoded component of a previously encoded URI. - ->> decodeURIComponent('%5B%40%3F%3D') -'[@?=' - - -
-
- - -TypedArray is a number of different global properties -whose values are typed array constructors for specific element types. - - -TypedArray.prototype.sort() - -sorts the elements of a typed array numerically -and returns the updated typed array -(0.4.2). - - - - -
- - -
- - -The JSON object (ES 5.1) provides functions -to convert njs values to and from JSON format. - - -JSON.parse(string[, -reviver]) - -Converts a string that represents JSON data -into an njs object ({...}) or -array ([...]). -The optional reviver parameter is a function (key, value) -that will be called for each (key,value) pair and can transform the value. - - -JSON.stringify(value[, -replacer] [, space]) - -Converts an njs object back to JSON. -The obligatory value parameter is generally a JSON -object or array that will be converted. -If the value has a toJSON() method, -it defines how the object will be serialized. -The optional replacer parameter is -a function or array -that transforms results. -The optional space parameter is -a string or number. -If it is a number, -it indicates the number of white spaces placed before a result -(no more than 10). -If it is a string, -it is used as a white space (or first 10 characters of it). -If omitted or is null, no white space is used. - - - - - - ->> 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}' - - - -
- -
diff -r aa015272ea32 -r 2edc64c05b0e xml/ru/docs/njs/compatibility.xml --- a/xml/ru/docs/njs/compatibility.xml Tue Jul 14 15:04:35 2020 +0300 +++ b/xml/ru/docs/njs/compatibility.xml Tue Jul 14 16:44:46 2020 +0100 @@ -9,7 +9,7 @@
@@ -23,6 +23,16 @@ Совместимость находится в стадии развития. + +Описания методов и свойств, доступных только в njs +и не соответствующих стандарту ECMAScript, доступны в +справочнике. +Описания методов и свойств njs, +соответствующих стандарту, доступны в +спецификации +ECMAScript. + +
@@ -184,12 +194,12 @@ ES5.1: -fromCharCode +fromCharCode ES6: -fromCodePoint +fromCodePoint @@ -201,48 +211,49 @@ ES5.1: -charAt, -concat, -indexOf, -lastIndexOf, -match, -replace -search, -slice, -split, -substr, -substring, -toLowerCase, -trim, -toUpperCase +charAt, +concat, +indexOf>, +lastIndexOf, +match, +replace, +search, +slice, +split, +substr, +substring, +toLowerCase, +trim, +toUpperCase ES6: -codePointAt, -endsWith, -includes, -repeat, -startsWith +codePointAt, +endsWith, +includes, +repeat, +startsWith ES8: -padEnd, -padStart +padEnd, +padStart ES9: -trimEnd +trimEnd (0.3.4), -trimStart +trimStart (0.3.4) нестандартные: -bytesFrom (0.2.3), +bytesFrom +(0.2.3), fromBytes, fromUTF8, toBytes, @@ -285,9 +296,9 @@ ES8: -entries +entries (0.2.7), -values +values (0.2.7) @@ -570,15 +581,16 @@ ES5.1: -parse, -stringify +parse +stringify -ES5.1 объект arguments (0.2.5) +ES5.1 объект arguments +(0.2.5) @@ -587,11 +599,11 @@ -ES5.1 глобальные функции: -decodeURI, -decodeURIComponent, -encodeURI, -encodeURIComponent, +ES5.1 global functions: +decodeURI, +decodeURIComponent, +encodeURI, +encodeURIComponent, isFinite, isNaN, parseFloat, @@ -615,7 +627,7 @@ clearTimeout и setTimeout -(0.2.0) +(0.2.0) @@ -647,7 +659,8 @@ -Методы Crypto (0.2.0): +Методы Crypto +(0.2.0): crypto.createHash, crypto.createHmac diff -r aa015272ea32 -r 2edc64c05b0e xml/ru/docs/njs/reference.xml --- a/xml/ru/docs/njs/reference.xml Tue Jul 14 15:04:35 2020 +0300 +++ b/xml/ru/docs/njs/reference.xml Tue Jul 14 16:44:46 2020 +0100 @@ -18,6 +18,17 @@ для расширения функциональности nginx. + +Справочник содержит описания методов, свойств и модулей, +доступных только в njs и не соответствующих стандарту ECMAScript. +Описания методов и свойств njs, +соответствующих стандарту, доступны в +спецификации +ECMAScript. +Список всех методов и свойств njs доступен в разделе +Совместимость. + +
@@ -591,7 +602,7 @@ String.bytesFrom(массив | строка, кодировка) -(только в njs) Создаёт байтовую строку или из массива, содержащего октеты, +Создаёт байтовую строку или из массива, содержащего октеты, или из кодированной строки (0.2.3). Кодировкой может быть @@ -607,299 +618,28 @@ -String.fromCharCode(CharCode1[, ...[, -CharCodeN]]) - -Возвращает строку из одной или более Unicode codepoints. - ->> String.fromCharCode(97, 98, 99, 100) -'abcd' - - - -String.fromCodePoint(codePoint1[, ...[, -codePoint2]]) - -Возвращает строку из одной или более Unicode codepoints. - ->> String.fromCodePoint(97, 98, 99, 100) -'abcd' - - - -String.prototype.charAt(индекс) - -Возвращает строку, представляющую одну кодовую единицу Unicode -внутри указанного индекса; -пустая строка, если индекс вне диапазона значений. -Индекс может быть числом -между 0 и длиной строки минус 1. -Если индекс не указан, то значение по умолчанию равно 0, -т.е. возвращается первый символ в строке. - - -String.prototype.CodePointAt(позиция) - -Возвращает число, представляющее codepoint-значение символа -в пределах указанной позиции; -undefined, если элемент в позиции отсутствует. - ->> 'ABCD'.codePointAt(3); -68 - - - -String.prototype.concat(строка1[, ..., -строкаN]) - -Возвращает строку, содержающую результат объединения указанных -строк. - ->> "a".concat("b", "c") -'abc' - - - -String.prototype.endsWith(ПоисковаяСтрока[, -длина]) - -Возвращает true, если строка заканчивается символами -указанной строки, иначе false. -Необязательный параметр длина задаёт длину строки. -Если ПоисковаяСтрока не указана, -значением по умолчанию является длина строки. - ->> 'abc'.endsWith('abc') -true ->> 'abca'.endsWith('abc') -false - - - String.prototype.fromBytes(начало[, конец]) -(только в njs) Возвращает новую строку Unicode из байтовой строки, +Возвращает новую строку Unicode из байтовой строки, в которой каждый байт заменяется соответствующей Unicode codepoint. String.prototype.fromUTF8(начало[, конец]) -(только в njs) Преобразует байтовую строку, содержащую валидную строку UTF8, +Преобразует байтовую строку, содержащую валидную строку UTF8, в строку Unicode, иначе возвращается null. -String.prototype.includes(поисковаяСтрока[, -позиция])) - -Возвращает true, если строка ищется внутри другой строки, -иначе false. -Необязательный параметр позиция задаёт позицию -внутри строки, от которой начинается поиск для поисковойСтроки. -Значение по умолчанию равно 0. - ->> 'abc'.includes('bc') -true - - - -String.prototype.indexOf(поисковаяСтрока[, -fromIndex]) - -Возвращает позицию первого появления -поисковойСтроки. -Поиск начинается с fromIndex. -Возвращает -1, если значение не найдено. -fromIndex является числом, -значение по умолчанию равно 0. -Если fromIndex меньше, чем 0 -или больше, чем -String.prototype.length, -поиск начнётся на индексе 0 и -String.prototype.length. - ->> 'abcdef'.indexOf('de', 2) -3 - - - -String.prototype.lastIndexOf(поисковаяСтрока[, -fromIndex]) - -Возвращает позицию последнего появления -of the поисковойСтроки, -поиск осуществляется в обратном порядке от fromIndex. -Возвращает -1, если значение не найдено. -Если значение поисковойСтроки пустое, -то возвращается fromIndex. - ->> "nginx".lastIndexOf("gi") -1 - - - -String.prototype.length - -Возвращает длину строки. - ->> 'αβγδ'.length -4 - - - -String.prototype.match([регулярноеВыражение]) - -Возвращает совпадение при сопоставлении строки с -регулярным выражением. - ->> 'nginx'.match( /ng/i ) -'ng' - - - -String.prototype.padEnd(длина -[, строка]) - -Возвращает строку указанной длины, -добавляя строку в конец указанной -строки (0.2.3). - ->> '1234'.padEnd(8, 'abcd') -'1234abcd' - - - -String.prototype.padStart(длина -[, строка]) - -Возвращает строку указанной длины, -добавляя строку к началу указанной -строки (0.2.3). - ->> '1234'.padStart(8, 'abcd') -'abcd1234' - - - -String.prototype.repeat(число) - -Возвращает строку -с указанным числом копий строки. - ->> 'abc'.repeat(3) -'abcabcabc' - - - -String.prototype.replace([регулярноеВыражение|string[, -string|function]]) - -Возвращает новую строку, которая сопоставляется со -строкой или регулярным выражением, -и заменяется на строку или функцию. - ->> 'abcdefgh'.replace('d', 1) -'abc1efgh' - - - -String.prototype.search([регулярноеВыражение]) - -Осуществляет поиск строки при помощи регулярного выражения. - ->> 'abcdefgh'.search('def') -3 - - - -String.prototype.slice(начало[, -конец]) - -Возвращает новую строку, содержащую часть -исходной строки между началомконцом или -от начала до конца строки. - ->> 'abcdefghijklmno'.slice(NaN, 5) -'abcde' - - - -String.prototype.split(([строка|регулярноеВыражение[, -лимит]])) - -Возвращает совпадение строки регулярному выражению. -Необязательный параметр лимит является числом, задающим -ограничение на количество найденных подстрок. - ->> 'abc'.split('') -[ - 'a', - 'b', - 'c' -] - - - -String.prototype.startsWith(поисковаяСтрока[, -позиция]) - -Возвращает true, если строка начинается с символов -указанной строки, иначе false. -Необязательный параметр позиция является местом -в этой строке, с которого начинается поиск поисковойСтоки. -Значение по умолчанию равно 0. - ->> 'abc'.startsWith('abc') -true -> 'aabc'.startsWith('abc') -false - - - -String.prototype.substr(начало[, -длина]) - -Возвращает часть строки указанной длины -от начала -или от начала до конца строки. - ->> 'abcdefghijklmno'.substr(3, 5) -'defgh' - - - -String.prototype.substring(начало[, -конец]) - -Возвращает часть строки между -началом и концом или -от от начала до конца строки. - ->> 'abcdefghijklmno'.substring(3, 5) -'de' - - - String.prototype.toBytes(начало[, конец]) -(только в njs) Сериализует строку Unicode в байтовую строку. +Сериализует строку Unicode в байтовую строку. Возвращает null, если в строке найден символ больше, чем 255. -String.prototype.toLowerCase() - -Преобразует строку в нижний регистр. -Метод поддерживает только простое свёртывание Unicode. - ->> 'ΑΒΓΔ'.toLowerCase() -'αβγδ' - - - String.prototype.toString([кодировка]) @@ -908,7 +648,7 @@ -(только в njs) Если кодировка указана, +Если кодировка указана, кодирует байтовую строку в hex, base64 или @@ -920,20 +660,10 @@ -String.prototype.toUpperCase() - -Преобразует строку в верхний регистр. -Метод поддерживает только простое свёртывание Unicode. - ->> 'αβγδ'.toUpperCase() -'ΑΒΓΔ' - - - String.prototype.toUTF8(начало[, конец]) -(только в njs) Сериализует строку Unicode +Сериализует строку Unicode в байтовую строку при помощи кодирования UTF8. >> 'αβγδ'.toUTF8().length @@ -943,75 +673,6 @@ -String.prototype.trim() - -Удаляет пробелы в начале и конце строки. - ->> ' abc '.trim() -'abc' - - - -String.prototype.trimEnd() - -Удаляет пробелы в конце строки. -(0.3.4). - ->> ' abc '.trimEnd() -' abc' - - - -String.prototype.trimStart() - -Удаляет пробелы в начале строки. -(0.3.4). - ->> ' abc '.trimStart() -'abc ' - - - -encodeURI(URI) - -Кодирует URI путём замены определённых символов -на одну, две, три или четыре последовательности, -представляющие UTF-8 кодировку символа. - ->> encodeURI('012αβγδ') -'012%CE%B1%CE%B2%CE%B3%CE%B4' - - - -encodeURIComponent(encodedURIString) - -Кодирует URI путём замены определённых символов -на одну, две, три или четыре последовательности, -представляющие UTF-8 кодировку символа. - ->> encodeURIComponent('[@?=') -'%5B%40%3F%3D' - - - -decodeURI(encodedURI) - -Декодирует ранее кодированный URI. - ->> decodeURI('012%CE%B1%CE%B2%CE%B3%CE%B4') -'012αβγδ' - - - -decodeURIComponent(decodedURIString) - -Декодирует ранее кодированный URI. - ->> decodeURIComponent('%5B%40%3F%3D') -'[@?=' - - -