diff --git a/en/application-dev/reference/apis/js-apis-url.md b/en/application-dev/reference/apis/js-apis-url.md index 9f105f845950f1f206c326dcd94c4adf8b83c12c..d97e984d438c8b18febfae5e578cf73dbff244d3 100755 --- a/en/application-dev/reference/apis/js-apis-url.md +++ b/en/application-dev/reference/apis/js-apis-url.md @@ -1,6 +1,7 @@ # URL String Parsing -> **NOTE**
+> **NOTE** +> > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -25,16 +26,16 @@ Creates a **URLSearchParams** instance. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| init | string[][] \| Record<string, string> \| string \| URLSearchParams | No| Input parameter objects, which include the following:
- **string[][]**: two-dimensional string array
- **Record<string, string>**: list of objects
- **string**: string
- **URLSearchParams**: object | +| init | string[][] \| Record<string, string> \| string \| URLSearchParams | No| Input parameter objects, which include the following:
- **string[][]**: two-dimensional string array
- **Record<string, string>**: list of objects
- **string**: string
- **URLSearchParams**: object | **Example** ```js -var objectParams = new URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]); -var objectParams1 = new URLSearchParams({"fod" : 1 , "bard" : 2}); -var objectParams2 = new URLSearchParams('?fod=1&bard=2'); -var urlObject = new URL('https://developer.mozilla.org/?fod=1&bard=2'); -var params = new URLSearchParams(urlObject.search); +var objectParams = new Url.URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]); +var objectParams1 = new Url.URLSearchParams({"fod" : 1 , "bard" : 2}); +var objectParams2 = new Url.URLSearchParams('?fod=1&bard=2'); +var urlObject = new Url.URL('https://developer.mozilla.org/?fod=1&bard=2'); +var params = new Url.URLSearchParams(urlObject.search); ``` @@ -48,16 +49,16 @@ Appends a key-value pair into the query string. **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | name | string | Yes | Key of the key-value pair to append. | - | value | string | Yes | Value of the key-value pair to append. | +| Name | Type | Mandatory | Description | +| -------- | -------- | -------- | -------- | +| name | string | Yes | Key of the key-value pair to append. | +| value | string | Yes | Value of the key-value pair to append. | **Example** ```js -let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); -let paramsObject = new URLSearchParams(urlObject.search.slice(1)); +let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1)); paramsObject.append('fod', 3); ``` @@ -72,15 +73,15 @@ Deletes key-value pairs of the specified key. **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | name | string | Yes | Key of the key-value pairs to delete. | +| Name | Type | Mandatory | Description | +| -------- | -------- | -------- | -------- | +| name | string | Yes | Key of the key-value pairs to delete. | **Example** ```js -let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); -let paramsobject = new URLSearchParams(urlObject.search.slice(1)); +let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +let paramsobject = new Url.URLSearchParams(urlObject.search.slice(1)); paramsobject.delete('fod'); ``` @@ -95,21 +96,21 @@ Obtains all the key-value pairs based on the specified key. **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | name | string | Yes | Key specified to obtain all key-value pairs. | +| Name | Type | Mandatory | Description | +| -------- | -------- | -------- | -------- | +| name | string | Yes | Key specified to obtain all key-value pairs. | **Return value** - | Type | Description | - | -------- | -------- | - | string[] | All key-value pairs matching the specified key. | +| Type | Description | +| -------- | -------- | +| string[] | All key-value pairs matching the specified key. | **Example** ```js -let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); -let paramsObject = new URLSearchParams(urlObject.search.slice(1)); +let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1)); paramsObject.append('fod', 3); // Add a second value for the fod parameter. console.log(params.getAll('fod')) // Output ["1","3"]. ``` @@ -125,14 +126,14 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th **Return value** - | Type | Description | - | -------- | -------- | - | IterableIterator<[string, string]> | ES6 iterator. | +| Type | Description | +| -------- | -------- | +| IterableIterator<[string, string]> | ES6 iterator. | **Example** ```js -var searchParamsObject = new URLSearchParams("keyName1=valueName1&keyName2=valueName2"); +var searchParamsObject = new Url.URLSearchParams("keyName1=valueName1&keyName2=valueName2"); for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pairs console.log(pair[0]+ ', '+ pair[1]); } @@ -149,23 +150,23 @@ Traverses the key-value pairs in the **URLSearchParams** instance by using a cal **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | callbackfn | function | Yes | Callback invoked to traverse the key-value pairs in the **URLSearchParams** instance. | - | thisArg | Object | No | Value to use when the callback is invoked. | +| Name | Type | Mandatory | Description | +| -------- | -------- | -------- | -------- | +| callbackfn | function | Yes | Callback invoked to traverse the key-value pairs in the **URLSearchParams** instance. | +| thisArg | Object | No | Value to use when the callback is invoked. | **Table 1** callbackfn parameter description - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | string | Yes | Value that is currently traversed. | - | key | string | Yes | Key that is currently traversed. | - | searchParams | Object | Yes | Instance that invokes the **forEach** method. | +| Name | Type | Mandatory | Description | +| -------- | -------- | -------- | -------- | +| value | string | Yes | Value that is currently traversed. | +| key | string | Yes | Key that is currently traversed. | +| searchParams | Object | Yes | Instance that invokes the **forEach** method. | **Example** ```js -const myURLObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); +const myURLObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); myURLObject.searchParams.forEach((value, name, searchParams) => { console.log(name, value, myURLObject.searchParams === searchParams); }); @@ -182,21 +183,21 @@ Obtains the value of the first key-value pair based on the specified key. **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | name | string | Yes | Key specified to obtain the value. | +| Name | Type | Mandatory | Description | +| -------- | -------- | -------- | -------- | +| name | string | Yes | Key specified to obtain the value. | **Return value** - | Type | Description | - | -------- | -------- | - | string | Returns the value of the first key-value pair if obtained. | - | null | Returns null if no value is obtained. | +| Type | Description | +| -------- | -------- | +| string | Returns the value of the first key-value pair if obtained. | +| null | Returns null if no value is obtained. | **Example** ```js -var paramsOject = new URLSearchParams(document.location.search.substring(1)); +var paramsOject = new Url.URLSearchParams(document.location.search.substring(1)); var name = paramsOject.get("name"); // is the string "Jonathan" var age = parseInt(paramsOject.get("age"), 10); // is the number 18 var address = paramsOject.get("address"); // null @@ -213,21 +214,21 @@ Checks whether a key has a value. **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | name | string | Yes | Key specified to search for its value. | +| Name | Type | Mandatory | Description | +| -------- | -------- | -------- | -------- | +| name | string | Yes | Key specified to search for its value. | **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the value exists; returns **false** otherwise. | +| Type | Description | +| -------- | -------- | +| boolean | Returns **true** if the value exists; returns **false** otherwise. | **Example** ```js -let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); -let paramsObject = new URLSearchParams(urlObject.search.slice(1)); +let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1)); paramsObject.has('bard') === true; ``` @@ -242,16 +243,16 @@ Sets the value for a key. If key-value pairs matching the specified key exist, t **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | name | string | Yes | Key of the value to set. | - | value | string | Yes | Value to set. | +| Name | Type | Mandatory | Description | +| -------- | -------- | -------- | -------- | +| name | string | Yes | Key of the value to set. | +| value | string | Yes | Value to set. | **Example** ```js -let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); -let paramsObject = new URLSearchParams(urlObject.search.slice(1)); +let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1)); paramsObject.set('baz', 3); // Add a third parameter. ``` @@ -267,7 +268,7 @@ Sorts all key-value pairs contained in this object based on the Unicode code poi **Example** ```js -var searchParamsObject = new URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object +var searchParamsObject = new Url.URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object searchParamsObject.sort(); // Sort the key/value pairs console.log(searchParamsObject.toString()); // Display the sorted query string // Output a=9&b=2&c=3&d=4 ``` @@ -283,14 +284,14 @@ Obtains an ES6 iterator that contains the keys of all the key-value pairs. **Return value** - | Type | Description | - | -------- | -------- | - | IterableIterator<string> | ES6 iterator that contains the keys of all the key-value pairs. | +| Type | Description | +| -------- | -------- | +| IterableIterator<string> | ES6 iterator that contains the keys of all the key-value pairs. | **Example** ```js -var searchParamsObject = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing +var searchParamsObject = new Url.URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing for (var key of searchParamsObject .keys()) { // Output key-value pairs console.log(key); } @@ -307,14 +308,14 @@ Obtains an ES6 iterator that contains the values of all the key-value pairs. **Return value** - | Type | Description | - | -------- | -------- | - | IterableIterator<string> | ES6 iterator that contains the values of all the key-value pairs. | +| Type | Description | +| -------- | -------- | +| IterableIterator<string> | ES6 iterator that contains the values of all the key-value pairs. | **Example** ```js -var searchParams = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing +var searchParams = new Url.URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing for (var value of searchParams.values()) { console.log(value); } @@ -331,14 +332,14 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th **Return value** - | Type | Description | - | -------- | -------- | - | IterableIterator<[string, string]> | ES6 iterator. | +| Type | Description | +| -------- | -------- | +| IterableIterator<[string, string]> | ES6 iterator. | **Example** ```js -const paramsObject = new URLSearchParams('fod=bay&edg=bap'); +const paramsObject = new Url.URLSearchParams('fod=bay&edg=bap'); for (const [name, value] of paramsObject) { console.log(name, value); } @@ -355,15 +356,15 @@ Obtains search parameters that are serialized as a string and, if necessary, per **Return value** - | Type | Description | - | -------- | -------- | - | string | String of serialized search parameters, which is percent-encoded if necessary. | +| Type | Description | +| -------- | -------- | +| string | String of serialized search parameters, which is percent-encoded if necessary. | **Example** ```js -let url = new URL('https://developer.exampleUrl/?fod=1&bard=2'); -let params = new URLSearchParams(url.search.slice(1)); +let url = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); +let params = new Url.URLSearchParams(url.search.slice(1)); params.append('fod', 3); console.log(params.toString()); ``` @@ -401,26 +402,26 @@ Creates a URL. **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | url | string | Yes | Input object. | - | base | string \ | URL | No | Input parameter, which can be any of the following:
- **string**: string
- **URL**: string or object | +| Name | Type | Mandatory | Description | +| -------- | -------- | -------- | -------- | +| url | string | Yes | Input object. | +| base | string \ |& URL | No | Input parameter, which can be any of the following:
- **string**: string
- **URL**: string or object | **Example** ```js var mm = 'http://username:password@host:8080'; -var a = new URL("/", mm); // Output 'http://username:password@host:8080/'; -var b = new URL(mm); // Output 'http://username:password@host:8080/'; -new URL('path/path1', b); // Output 'http://username:password@host:8080/path/path1'; -var c = new URL('/path/path1', b); // Output 'http://username:password@host:8080/path/path1'; -new URL('/path/path1', c); // Output 'http://username:password@host:8080/path/path1'; -new URL('/path/path1', a); // Output 'http://username:password@host:8080/path/path1'; -new URL('/path/path1', "https://www.exampleUrl/fr-FR/toto"); // Output https://www.exampleUrl/path/path1 -new URL('/path/path1', ''); // Raises a TypeError exception as '' is not a valid URL -new URL('/path/path1'); // Raises a TypeError exception as '/path/path1' is not a valid URL -new URL('http://www.shanxi.com', ); // Output http://www.shanxi.com/ -new URL('http://www.shanxi.com', b); // Output http://www.shanxi.com/ +var a = new Url.URL("/", mm); // Output 'http://username:password@host:8080/'; +var b = new Url.URL(mm); // Output 'http://username:password@host:8080/'; +new Url.URL('path/path1', b); // Output 'http://username:password@host:8080/path/path1'; +var c = new Url.URL('/path/path1', b); // Output 'http://username:password@host:8080/path/path1'; +new Url.URL('/path/path1', c); // Output 'http://username:password@host:8080/path/path1'; +new Url.URL('/path/path1', a); // Output 'http://username:password@host:8080/path/path1'; +new Url.URL('/path/path1', "https://www.exampleUrl/fr-FR/toto"); // Output https://www.exampleUrl/path/path1 +new Url.URL('/path/path1', ''); // Raises a TypeError exception as '' is not a valid URL +new Url.URL('/path/path1'); // Raises a TypeError exception as '/path/path1' is not a valid URL +new Url.URL('http://www.shanxi.com', ); // Output http://www.shanxi.com/ +new Url.URL('http://www.shanxi.com', b); // Output http://www.shanxi.com/ ``` @@ -434,14 +435,14 @@ Converts the parsed URL into a string. **Return value** - | Type | Description | - | -------- | -------- | - | string | Website address in a serialized string. | +| Type | Description | +| -------- | -------- | +| string | Website address in a serialized string. | **Example** ```js -const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); +const url = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); url.toString() ``` @@ -456,12 +457,12 @@ Converts the parsed URL into a JSON string. **Return value** - | Type | Description | - | -------- | -------- | - | string | Website address in a serialized string. | +| Type | Description | +| -------- | -------- | +| string | Website address in a serialized string. | **Example** ```js -const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); +const url = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); url.toJSON() ``` \ No newline at end of file diff --git a/en/application-dev/reference/apis/js-apis-util.md b/en/application-dev/reference/apis/js-apis-util.md index 0ee9fb84705d1c23d9c453e75dd47689bc66d1d3..2ac8daeb3799908d57a5b7a2c5fd456dcfee8f59 100755 --- a/en/application-dev/reference/apis/js-apis-util.md +++ b/en/application-dev/reference/apis/js-apis-util.md @@ -1,11 +1,12 @@ # util -> **NOTE**
+> **NOTE** +> > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. -This module provides common utility functions, such as **TextEncoder** and **TextDecoder** for string encoding and decoding, **RationalNumber** for rational number operations, **LruBuffer** for buffer management, **Scope** for range determination, **Base64** for Base64 encoding and decoding, and **types** for checks of built-in object types. +This module provides common utility functions, such as **TextEncoder** and **TextDecoder** for string encoding and decoding, **RationalNumber** for rational number operations, **LruBuffer** for buffer management, **Scope** for range determination, **Base64** for Base64 encoding and decoding, and **Types** for checks of built-in object types. ## Modules to Import @@ -23,15 +24,15 @@ Prints the input content in a formatted string. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | format | string | Yes | Format of the string to print. | - | ...args | Object[] | No | Data to format. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| format | string | Yes| Format of the string to print.| +| ...args | Object[] | No| Data to format.| **Return value** - | Type | Description | - | -------- | -------- | - | string | String in the specified format. | +| Type| Description| +| -------- | -------- | +| string | String in the specified format.| **Example** ```js @@ -49,14 +50,14 @@ Obtains detailed information about a system error code. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | errno | number | Yes | Error code generated. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| errno | number | Yes| Error code generated.| **Return value** - | Type | Description | - | -------- | -------- | - | string | Detailed information about the error code. | +| Type| Description| +| -------- | -------- | +| string | Detailed information about the error code.| **Example** ```js @@ -76,14 +77,14 @@ Calls back an asynchronous function. In the callback, the first parameter indica **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | original | Function | Yes | Asynchronous function. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| original | Function | Yes| Asynchronous function.| **Return value** - | Type | Description | - | -------- | -------- | - | Function | Callback, in which the first parameter indicates the cause of the rejection (the value is **null** if the promise has been resolved) and the second parameter indicates the resolved value. | +| Type| Description| +| -------- | -------- | +| Function | Callback, in which the first parameter indicates the cause of the rejection (the value is **null** if the promise has been resolved) and the second parameter indicates the resolved value.| **Example** ```js @@ -107,14 +108,14 @@ Processes an asynchronous function and returns a promise version. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | original | Function | Yes | Asynchronous function. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| original | Function | Yes| Asynchronous function.| **Return value** - | Type | Description | - | -------- | -------- | - | Function | Function in the error-first style (that is, **(err, value) =>...** is called as the last parameter) and the promise version. | +| Type| Description| +| -------- | -------- | +| Function | Function in the error-first style (that is, **(err, value) =>...** is called as the last parameter) and the promise version.| **Example** ```js @@ -138,11 +139,11 @@ Processes an asynchronous function and returns a promise version. **System capability**: SystemCapability.Utils.Lang - | Name | Type | Readable | Writable | Description | - | -------- | -------- | -------- | -------- | -------- | - | encoding | string | Yes | No | Encoding format.
- Supported formats: utf-8, ibm866, iso-8859-2, iso-8859-3, iso-8859-4, iso-8859-5, iso-8859-6, iso-8859-7, iso-8859-8, iso-8859-8-i, iso-8859-10, iso-8859-13, iso-8859-14, iso-8859-15, koi8-r, koi8-u, macintosh, windows-874, windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258, x-mac-cyrilli, gbk, gb18030, big5, euc-jp, iso-2022-jp, shift_jis, euc-kr, utf-16be, utf-16le | - | fatal | boolean | Yes | No | Whether to display fatal errors. | - | ignoreBOM | boolean | Yes | No | Whether to ignore the byte order marker (BOM). The default value is **false**, which indicates that the result contains the BOM. | +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| encoding | string | Yes| No| Encoding format.
- Supported formats: utf-8, ibm866, iso-8859-2, iso-8859-3, iso-8859-4, iso-8859-5, iso-8859-6, iso-8859-7, iso-8859-8, iso-8859-8-i, iso-8859-10, iso-8859-13, iso-8859-14, iso-8859-15, koi8-r, koi8-u, macintosh, windows-874, windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258, x-mac-cyrilli, gbk, gb18030, big5, euc-jp, iso-2022-jp, shift_jis, euc-kr, utf-16be, utf-16le| +| fatal | boolean | Yes| No| Whether to display fatal errors.| +| ignoreBOM | boolean | Yes| No| Whether to ignore the byte order marker (BOM). The default value is **false**, which indicates that the result contains the BOM.| ### constructor @@ -154,17 +155,17 @@ A constructor used to create a **TextDecoder** object. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | encoding | string | No | Encoding format. | - | options | Object | No | Encoding-related options, which include **fatal** and **ignoreBOM**. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| encoding | string | No| Encoding format.| +| options | Object | No| Encoding-related options, which include **fatal** and **ignoreBOM**.| **Table 1** options - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | fatal | boolean | No | Whether to display fatal errors. | - | ignoreBOM | boolean | No | Whether to ignore the BOM. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| fatal | boolean | No| Whether to display fatal errors.| +| ignoreBOM | boolean | No| Whether to ignore the BOM.| **Example** ```js @@ -181,21 +182,21 @@ Decodes the input content. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | input | Unit8Array | Yes | Uint8Array to decode. | - | options | Object | No | Options related to decoding. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| input | Unit8Array | Yes| Uint8Array to decode.| +| options | Object | No| Options related to decoding.| **Table 2** options - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | stream | boolean | No | Whether to allow data blocks in subsequent **decode()**. If data is processed in blocks, set this parameter to **true**. If this is the last data block to process or data is not divided into blocks, set this parameter to **false**. The default value is **false**. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| stream | boolean | No| Whether to allow data blocks in subsequent **decode()**. If data is processed in blocks, set this parameter to **true**. If this is the last data block to process or data is not divided into blocks, set this parameter to **false**. The default value is **false**.| **Return value** - | Type | Description | - | -------- | -------- | - | string | Data decoded. | +| Type| Description| +| -------- | -------- | +| string | Data decoded.| **Example** ```js @@ -208,9 +209,6 @@ Decodes the input content. result[4] = 0x62; result[5] = 0x63; console.log("input num:"); - for(var j= 0; j < 6; j++) { - console.log(result[j]); - } var retStr = textDecoder.decode( result , {stream: false}); console.log("retStr = " + retStr); ``` @@ -222,9 +220,9 @@ Decodes the input content. **System capability**: SystemCapability.Utils.Lang - | Name | Type | Readable | Writable | Description | - | -------- | -------- | -------- | -------- | -------- | - | encoding | string | Yes | No | Encoding format. The default format is **utf-8**. | +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| encoding | string | Yes| No| Encoding format. The default format is **utf-8**.| ### constructor @@ -250,18 +248,19 @@ Encodes the input content. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | input | string | Yes | String to encode. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| input | string | Yes| String to encode.| **Return value** - | Type | Description | - | -------- | -------- | - | Uint8Array | Encoded text. | +| Type| Description| +| -------- | -------- | +| Uint8Array | Encoded text.| **Example** ```js var textEncoder = new util.TextEncoder(); + var buffer = new ArrayBuffer(20); var result = new Uint8Array(buffer); result = textEncoder.encode("\uD800¥¥"); ``` @@ -276,15 +275,15 @@ Stores the UTF-8 encoded text. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | input | string | Yes | String to encode. | - | dest | Uint8Array | Yes | **Uint8Array** instance used to store the UTF-8 encoded text. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| input | string | Yes| String to encode.| +| dest | Uint8Array | Yes| **Uint8Array** instance used to store the UTF-8 encoded text.| **Return value** - | Type | Description | - | -------- | -------- | - | Uint8Array | Encoded text. | +| Type| Description| +| -------- | -------- | +| Uint8Array | Encoded text.| **Example** ```js @@ -306,10 +305,10 @@ A constructor used to create a **RationalNumber** object. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | numerator | number | Yes | Numerator, which is an integer. | - | denominator | number | Yes | Denominator, which is an integer. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| numerator | number | Yes| Numerator, which is an integer.| +| denominator | number | Yes| Denominator, which is an integer.| **Example** ```js @@ -326,14 +325,14 @@ Creates a **RationalNumber** object based on the given string. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | rationalString | string | Yes | String used to create the **RationalNumber** object. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| rationalString | string | Yes| String used to create the **RationalNumber** object.| **Return value** - | Type | Description | - | -------- | -------- | - | object | **RationalNumber** object created. | +| Type| Description| +| -------- | -------- | +| object | **RationalNumber** object created.| **Example** ```js @@ -351,17 +350,16 @@ Compares this **RationalNumber** object with a given object. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | another | RationalNumber | Yes | Object used to compare with this **RationalNumber** object. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| another | RationalNumber | Yes| Object used to compare with this **RationalNumber** object.| **Return value** - | Type | Description | - | -------- | -------- | - | number | Returns **0** if the two objects are equal; returns **1** if the given object is less than this object; return **-1** if the given object is greater than this object. | +| Type| Description| +| -------- | -------- | +| number | Returns **0** if the two objects are equal; returns **1** if the given object is less than this object; return **-1** if the given object is greater than this object.| **Example** - ```js var rationalNumber = new util.RationalNumber(1,2); var rational = rationalNumer.creatRationalFromString("3/4"); @@ -378,9 +376,9 @@ Obtains the value of this **RationalNumber** object as an integer or a floating- **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | number | An integer or a floating-point number. | +| Type| Description| +| -------- | -------- | +| number | An integer or a floating-point number.| **Example** ```js @@ -398,14 +396,14 @@ Checks whether this **RationalNumber** object equals the given object. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | object | Object | Yes | Object used to compare with this **RationalNumber** object. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| object | Object | Yes| Object used to compare with this **RationalNumber** object.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the two objects are equal; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the two objects are equal; returns **false** otherwise.| **Example** ```js @@ -424,15 +422,15 @@ Obtains the greatest common divisor of two specified integers. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | number1 | number | Yes | The first integer used to get the greatest common divisor. | - | number2 | number | Yes | The second integer used to get the greatest common divisor. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| number1 | number | Yes| The first integer used to get the greatest common divisor.| +| number2 | number | Yes| The second integer used to get the greatest common divisor.| **Return value** - | Type | Description | - | -------- | -------- | - | number | Greatest common divisor obtained. | +| Type| Description| +| -------- | -------- | +| number | Greatest common divisor obtained.| **Example** ```js @@ -451,9 +449,9 @@ Obtains the numerator of this **RationalNumber** object. **Return value** - | Type | Description | - | -------- | -------- | - | number | Numerator of this **RationalNumber** object. | +| Type| Description| +| -------- | -------- | +| number | Numerator of this **RationalNumber** object.| **Example** ```js @@ -471,9 +469,9 @@ Obtains the denominator of this **RationalNumber** object. **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | number | Denominator of this **RationalNumber** object. | +| Type| Description| +| -------- | -------- | +| number | Denominator of this **RationalNumber** object.| **Example** ```js @@ -484,16 +482,16 @@ Obtains the denominator of this **RationalNumber** object. ### isZero8+ -isZero​(): boolean +isZero​():boolean Checks whether this **RationalNumber** object is **0**. **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the value of this **RationalNumber** object is **0**; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the value of this **RationalNumber** object is **0**; returns **false** otherwise.| **Example** ```js @@ -511,9 +509,9 @@ Checks whether this **RationalNumber** object is a Not a Number (NaN). **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if this **RationalNumber** object is a NaN (the denominator and numerator are both **0**); returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if this **RationalNumber** object is a NaN (the denominator and numerator are both **0**); returns **false** otherwise.| **Example** ```js @@ -524,16 +522,16 @@ Checks whether this **RationalNumber** object is a Not a Number (NaN). ### isFinite8+ -isFinite​(): boolean +isFinite​():boolean Checks whether this **RationalNumber** object represents a finite value. **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if this **RationalNumber** object represents a finite value (the denominator is not **0**); returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if this **RationalNumber** object represents a finite value (the denominator is not **0**); returns **false** otherwise.| **Example** ```js @@ -551,9 +549,9 @@ Obtains the string representation of this **RationalNumber** object. **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | string | Returns **NaN** if the numerator and denominator of this object are both **0**; returns a string in Numerator/Denominator format otherwise, for example, **3/5**. | +| Type| Description| +| -------- | -------- | +| string | Returns **NaN** if the numerator and denominator of this object are both **0**; returns a string in Numerator/Denominator format otherwise, for example, **3/5**.| **Example** ```js @@ -567,9 +565,9 @@ Obtains the string representation of this **RationalNumber** object. **System capability**: SystemCapability.Utils.Lang - | Name | Type | Readable | Writable | Description | - | -------- | -------- | -------- | -------- | -------- | - | length | number | Yes | No | Total number of values in this buffer. | +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| length | number | Yes| No| Total number of values in this buffer.| **Example** ```js @@ -589,9 +587,9 @@ A constructor used to create an **LruBuffer** instance. The default capacity of **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | capacity | number | No | Capacity of the **LruBuffer** to create. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| capacity | number | No| Capacity of the **LruBuffer** to create.| **Example** ```js @@ -608,9 +606,9 @@ Changes the **LruBuffer** capacity. If the new capacity is less than or equal to **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | newCapacity | number | Yes | New capacity of the **LruBuffer**. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| newCapacity | number | Yes| New capacity of the **LruBuffer**.| **Example** ```js @@ -628,9 +626,9 @@ Obtains the string representation of this **LruBuffer** object. **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | string | String representation of this **LruBuffer** object. | +| Type| Description| +| -------- | -------- | +| string | String representation of this **LruBuffer** object.| **Example** ```js @@ -651,9 +649,9 @@ Obtains the capacity of this buffer. **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | number | Capacity of this buffer. | +| Type| Description| +| -------- | -------- | +| number | Capacity of this buffer.| **Example** ```js @@ -688,9 +686,9 @@ Obtains the number of return values for **createDefault()**. **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | number | Number of return values for **createDefault()**. | +| Type| Description| +| -------- | -------- | +| number | Number of return values for **createDefault()**.| **Example** ```js @@ -709,9 +707,9 @@ Obtains the number of times that the queried values are mismatched. **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | number | Number of times that the queried values are mismatched. | +| Type| Description| +| -------- | -------- | +| number | Number of times that the queried values are mismatched.| **Example** ```js @@ -731,9 +729,9 @@ Obtains the number of removals from this buffer. **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | number | Number of removals from the buffer. | +| Type| Description| +| -------- | -------- | +| number | Number of removals from the buffer.| **Example** ```js @@ -754,9 +752,9 @@ Obtains the number of times that the queried values are matched. **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | number | Number of times that the queried values are matched. | +| Type| Description| +| -------- | -------- | +| number | Number of times that the queried values are matched.| **Example** ```js @@ -776,9 +774,9 @@ Obtains the number of additions to this buffer. **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | number | Number of additions to the buffer. | +| Type| Description| +| -------- | -------- | +| number | Number of additions to the buffer.| **Example** ```js @@ -797,9 +795,9 @@ Checks whether this buffer is empty. **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the buffer does not contain any value. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the buffer does not contain any value.| **Example** ```js @@ -811,21 +809,21 @@ Checks whether this buffer is empty. ### get8+ -get(key: K): V | undefined +get(key: K): V | undefined Obtains the value of the specified key. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | key | K | Yes | Key based on which the value is queried. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| key | K | Yes| Key based on which the value is queried.| **Return value** - | Type | Description | - | -------- | -------- | - | V \ | undefind | Returns the value of the key if a match is found in the buffer; returns **undefined** otherwise. | +| Type| Description| +| -------- | -------- | +| V \| undefind | Returns the value of the key if a match is found in the buffer; returns **undefined** otherwise.| **Example** ```js @@ -844,15 +842,15 @@ Adds a key-value pair to this buffer. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | key | K | Yes | Key of the key-value pair to add. | - | value | V | Yes | Value of the key-value pair to add. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| key | K | Yes| Key of the key-value pair to add.| +| value | V | Yes| Value of the key-value pair to add.| **Return value** - | Type | Description | - | -------- | -------- | - | V | Returns the existing value if the key already exists; returns the value added otherwise. If the key or value is null, an exception will be thrown. | +| Type| Description| +| -------- | -------- | +| V | Returns the existing value if the key already exists; returns the value added otherwise. If the key or value is null, an exception will be thrown. | **Example** ```js @@ -870,9 +868,9 @@ Obtains all values in this buffer, listed from the most to the least recently ac **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | V [] | All values in the buffer, listed from the most to the least recently accessed. | +| Type| Description| +| -------- | -------- | +| V [] | All values in the buffer, listed from the most to the least recently accessed.| **Example** ```js @@ -893,9 +891,9 @@ Obtains all keys in this buffer, listed from the most to the least recently acce **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | K [] | All keys in the buffer, listed from the most to the least recently accessed. | +| Type| Description| +| -------- | -------- | +| K [] | All keys in the buffer, listed from the most to the least recently accessed.| **Example** ```js @@ -907,21 +905,21 @@ Obtains all keys in this buffer, listed from the most to the least recently acce ### remove8+ -remove(key: K): V | undefined +remove(key: K): V | undefined Removes the specified key and its value from this buffer. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | key | K | Yes | Key to remove. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| key | K | Yes| Key to remove.| **Return value** - | Type | Description | - | -------- | -------- | - | V \ | undefind | Returns an **Optional** object containing the removed key-value pair if the key exists in the buffer; returns an empty **Optional** object otherwise. If the key is null, an exception will be thrown. | +| Type| Description| +| -------- | -------- | +| V \| undefind | Returns an **Optional** object containing the removed key-value pair if the key exists in the buffer; returns an empty **Optional** object otherwise. If the key is null, an exception will be thrown.| **Example** ```js @@ -940,12 +938,12 @@ Performs subsequent operations after a value is removed. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | isEvict | boolean | No | Whether the buffer capacity is insufficient. If the value is **true**, this method is called due to insufficient capacity. | - | key | K | Yes | Key removed. | - | value | V | Yes | Value removed. | - | newValue | V | No | New value for the key if the **put()** method is called and the key to be added already exists. In other cases, this parameter is left blank. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| isEvict | boolean | No| Whether the buffer capacity is insufficient. If the value is **true**, this method is called due to insufficient capacity.| +| key | K | Yes| Key removed.| +| value | V | Yes| Value removed.| +| newValue | V | No| New value for the key if the **put()** method is called and the key to be added already exists. In other cases, this parameter is left blank.| **Example** ```js @@ -985,14 +983,14 @@ Checks whether this buffer contains the specified key. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | key | K | Yes | Key to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| key | K | Yes| Key to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the buffer contains the specified key; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the buffer contains the specified key; returns **false** otherwise.| **Example** ```js @@ -1011,14 +1009,14 @@ Creates a value if the value of the specified key is not available. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | key | K | Yes | Key of which the value is missing. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| key | K | Yes| Key of which the value is missing.| **Return value** - | Type | Description | - | -------- | -------- | - | V | Value of the key. | +| Type| Description| +| -------- | -------- | +| V | Value of the key.| **Example** ```js @@ -1036,9 +1034,9 @@ Obtains a new iterator object that contains all key-value pairs in this object. **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | [K, V] | Iterable array. | +| Type| Description| +| -------- | -------- | +| [K, V] | Iterable array.| **Example** ```js @@ -1057,9 +1055,9 @@ Obtains a two-dimensional array in key-value pairs. **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | [K, V] | Two-dimensional array in key-value pairs. | +| Type| Description| +| -------- | -------- | +| [K, V] | Two-dimensional array in key-value pairs.| **Example** ```js @@ -1081,7 +1079,7 @@ The values of the **ScopeComparable** type are used to implement the **compareTo interface ScopeComparable{ compareTo(other: ScopeComparable): boolean; } -type ScopeType = ScopeComparable | number; +type ScopeType = ScopeComparable | number; ``` @@ -1092,6 +1090,8 @@ Example ```js class Temperature{ constructor(value){ + // If TS is used for development, add the following code: + // private readonly _temp: Temperature; this._temp = value; } comapreTo(value){ @@ -1116,10 +1116,10 @@ A constructor used to create a **Scope** object with the specified upper and low **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | lowerObj | [ScopeType](#scopetype8) | Yes | Lower limit of the **Scope** object. | - | upperObj | [ScopeType](#scopetype8) | Yes | Upper limit of the **Scope** object. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| lowerObj | [ScopeType](#scopetype8) | Yes| Lower limit of the **Scope** object.| +| upperObj | [ScopeType](#scopetype8) | Yes| Upper limit of the **Scope** object.| **Example** ```js @@ -1138,9 +1138,9 @@ Obtains a string representation that contains this **Scope**. **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | string | String representation containing the **Scope**. | +| Type| Description| +| -------- | -------- | +| string | String representation containing the **Scope**.| **Example** ```js @@ -1160,14 +1160,14 @@ Obtains the intersection of this **Scope** and the given **Scope**. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | range | [Scope](#scope8) | Yes | **Scope** specified. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| range | [Scope](#scope8) | Yes| **Scope** specified.| **Return value** - | Type | Description | - | -------- | -------- | - | [Scope](#scope8) | Intersection of this **Scope** and the given **Scope**. | +| Type| Description| +| -------- | -------- | +| [Scope](#scope8) | Intersection of this **Scope** and the given **Scope**.| **Example** ```js @@ -1183,22 +1183,22 @@ Obtains the intersection of this **Scope** and the given **Scope**. ### intersect8+ -intersect(lowerObj: ScopeType,upperObj: ScopeType): Scope +intersect(lowerObj:ScopeType,upperObj:ScopeType):Scope Obtains the intersection of this **Scope** and the given lower and upper limits. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | lowerObj | [ScopeType](#scopetype8) | Yes | Lower limit. | - | upperObj | [ScopeType](#scopetype8) | Yes | Upper limit. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| lowerObj | [ScopeType](#scopetype8) | Yes| Lower limit.| +| upperObj | [ScopeType](#scopetype8) | Yes| Upper limit.| **Return value** - | Type | Description | - | -------- | -------- | - | [Scope](#scope8) | Intersection of this **Scope** and the given lower and upper limits. | +| Type| Description| +| -------- | -------- | +| [Scope](#scope8) | Intersection of this **Scope** and the given lower and upper limits.| **Example** ```js @@ -1221,9 +1221,9 @@ Obtains the upper limit of this **Scope**. **Return value** - | Type | Description | - | -------- | -------- | - | [ScopeType](#scopetype8) | Upper limit of this **Scope**. | +| Type| Description| +| -------- | -------- | +| [ScopeType](#scopetype8) | Upper limit of this **Scope**.| **Example** ```js @@ -1243,9 +1243,9 @@ Obtains the lower limit of this **Scope**. **System capability**: SystemCapability.Utils.Lang **Return value** - | Type | Description | - | -------- | -------- | - | [ScopeType](#scopetype8) | Lower limit of this **Scope**. | +| Type| Description| +| -------- | -------- | +| [ScopeType](#scopetype8) | Lower limit of this **Scope**.| **Example** ```js @@ -1265,17 +1265,18 @@ Obtains the union set of this **Scope** and the given lower and upper limits. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | lowerObj | [ScopeType](#scopetype8) | Yes | Lower limit. | - | upperObj | [ScopeType](#scopetype8) | Yes | Upper limit. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| lowerObj | [ScopeType](#scopetype8) | Yes| Lower limit.| +| upperObj | [ScopeType](#scopetype8) | Yes| Upper limit.| **Return value** - | Type | Description | - | -------- | -------- | - | [Scope](#scope8) | Union set of this **Scope** and the given lower and upper limits. | +| Type| Description| +| -------- | -------- | +| [Scope](#scope8) | Union set of this **Scope** and the given lower and upper limits.| **Example** + ```js var tempLower = new Temperature(30); var tempUpper = new Temperature(40); @@ -1288,21 +1289,21 @@ Obtains the union set of this **Scope** and the given lower and upper limits. ### expand8+ -expand(range:Scope):Scope +expand(range: Scope): Scope Obtains the union set of this **Scope** and the given **Scope**. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | range | [Scope](#scope8) | Yes | **Scope** specified. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| range | [Scope](#scope8) | Yes| **Scope** specified.| **Return value** - | Type | Description | - | -------- | -------- | - | [Scope](#scope8) | Union set of this **Scope** and the given **Scope**. | +| Type| Description| +| -------- | -------- | +| [Scope](#scope8) | Union set of this **Scope** and the given **Scope**.| **Example** ```js @@ -1325,14 +1326,14 @@ Obtains the union set of this **Scope** and the given value. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | [ScopeType](#scopetype8) | Yes | Value specified. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | [ScopeType](#scopetype8) | Yes| Value specified.| **Return value** - | Type | Description | - | -------- | -------- | - | [Scope](#scope8) | Union set of this **Scope** and the given value. | +| Type| Description| +| -------- | -------- | +| [Scope](#scope8) | Union set of this **Scope** and the given value.| **Example** ```js @@ -1353,14 +1354,14 @@ Checks whether a value is within this **Scope**. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | [ScopeType](#scopetype8) | Yes | Value specified. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | [ScopeType](#scopetype8) | Yes| Value specified.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the value is within this **Scope**; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the value is within this **Scope**; returns **false** otherwise.| **Example** ```js @@ -1381,14 +1382,14 @@ Checks whether a range is within this **Scope**. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | range | [Scope](#scope8) | Yes | **Scope** specified. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| range | [Scope](#scope8) | Yes| **Scope** specified.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the range is within this **Scope**; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the range is within this **Scope**; returns **false** otherwise.| **Example** ```js @@ -1411,14 +1412,14 @@ Limits a value to this **Scope**. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | [ScopeType](#scopetype8) | Yes | Value specified. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | [ScopeType](#scopetype8) | Yes| Value specified.| **Return value** - | Type | Description | - | -------- | -------- | - | [ScopeType](#scopetype8) | Returns **lowerObj** if the specified value is less than the lower limit; returns **upperObj** if the specified value is greater than the upper limit; returns the specified value if it is within this **Scope**. | +| Type| Description| +| -------- | -------- | +| [ScopeType](#scopetype8) | Returns **lowerObj** if the specified value is less than the lower limit; returns **upperObj** if the specified value is greater than the upper limit; returns the specified value if it is within this **Scope**.| **Example** ```js @@ -1456,14 +1457,14 @@ Encodes the input content. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | src | Uint8Array | Yes | Uint8Array to encode. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| src | Uint8Array | Yes| Uint8Array to encode.| **Return value** - | Type | Description | - | -------- | -------- | - | Uint8Array | Uint8Array encoded. | +| Type| Description| +| -------- | -------- | +| Uint8Array | Uint8Array encoded.| **Example** ```js @@ -1482,14 +1483,14 @@ Encodes the input content. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | src | Uint8Array | Yes | Uint8Array to encode. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| src | Uint8Array | Yes| Uint8Array to encode.| **Return value** - | Type | Description | - | -------- | -------- | - | string | String encoded from the Uint8Array. | +| Type| Description| +| -------- | -------- | +| string | String encoded from the Uint8Array.| **Example** ```js @@ -1501,21 +1502,21 @@ Encodes the input content. ### decodeSync8+ -decodeSync(src: Uint8Array | string): Uint8Array +decodeSync(src: Uint8Array | string): Uint8Array Decodes the input content. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | src | Uint8Array \ | string | Yes | Uint8Array or string to decode. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| src | Uint8Array \| string | Yes| Uint8Array or string to decode.| **Return value** - | Type | Description | - | -------- | -------- | - | Uint8Array | Uint8Array decoded. | +| Type| Description| +| -------- | -------- | +| Uint8Array | Uint8Array decoded.| **Example** ```js @@ -1534,14 +1535,14 @@ Encodes the input content asynchronously. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | src | Uint8Array | Yes | Uint8Array to encode asynchronously. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| src | Uint8Array | Yes| Uint8Array to encode asynchronously.| **Return value** - | Type | Description | - | -------- | -------- | - | Promise<Uint8Array> | Uint8Array obtained after asynchronous encoding. | +| Type| Description| +| -------- | -------- | +| Promise<Uint8Array> | Uint8Array obtained after asynchronous encoding.| **Example** ```js @@ -1565,14 +1566,14 @@ Encodes the input content asynchronously. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | src | Uint8Array | Yes | Uint8Array to encode asynchronously. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| src | Uint8Array | Yes| Uint8Array to encode asynchronously.| **Return value** - | Type | Description | - | -------- | -------- | - | Promise<string> | String obtained after asynchronous encoding. | +| Type| Description| +| -------- | -------- | +| Promise<string> | String obtained after asynchronous encoding.| **Example** ```js @@ -1586,21 +1587,21 @@ Encodes the input content asynchronously. ### decode8+ -decode(src: Uint8Array | string): Promise<Uint8Array> +decode(src: Uint8Array | string): Promise<Uint8Array> Decodes the input content asynchronously. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | src | Uint8Array \ | string | Yes | Uint8Array or string to decode asynchronously. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| src | Uint8Array \| string | Yes| Uint8Array or string to decode asynchronously.| **Return value** - | Type | Description | - | -------- | -------- | - | Promise<Uint8Array> | Uint8Array obtained after asynchronous decoding. | +| Type| Description| +| -------- | -------- | +| Promise<Uint8Array> | Uint8Array obtained after asynchronous decoding.| **Example** ```js @@ -1622,7 +1623,7 @@ Decodes the input content asynchronously. constructor() -A constructor used to create a **types** object. +A constructor used to create a **Types** object. **System capability**: SystemCapability.Utils.Lang @@ -1641,14 +1642,14 @@ Checks whether the input value is of the **ArrayBuffer** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **ArrayBuffer** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **ArrayBuffer** type; returns **false** otherwise.| **Example** ```js @@ -1668,14 +1669,14 @@ Checks whether the input value is of the **ArrayBufferView** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **ArrayBufferView** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **ArrayBufferView** type; returns **false** otherwise.| **Example** ```js @@ -1693,14 +1694,14 @@ Checks whether the input value is of the **arguments** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **arguments** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **arguments** type; returns **false** otherwise.| **Example** ```js @@ -1721,14 +1722,14 @@ Checks whether the input value is of the **ArrayBuffer** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **ArrayBuffer** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **ArrayBuffer** type; returns **false** otherwise.| **Example** ```js @@ -1746,14 +1747,14 @@ Checks whether the input value is an asynchronous function. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is an asynchronous function; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is an asynchronous function; returns **false** otherwise.| **Example** ```js @@ -1771,14 +1772,14 @@ Checks whether the input value is of the **Boolean** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **Boolean** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **Boolean** type; returns **false** otherwise.| **Example** ```js @@ -1796,14 +1797,14 @@ Checks whether the input value is of the **Boolean**, **Number**, **String**, or **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **Boolean**, **Number**, **String**, or **Symbol** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **Boolean**, **Number**, **String**, or **Symbol** type; returns **false** otherwise.| **Example** ```js @@ -1821,14 +1822,14 @@ Checks whether the input value is of the **DataView** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **DataView** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **DataView** type; returns **false** otherwise.| **Example** ```js @@ -1847,14 +1848,14 @@ Checks whether the input value is of the **Date** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **Date** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **Date** type; returns **false** otherwise.| **Example** ```js @@ -1872,14 +1873,14 @@ Checks whether the input value is of the **native external** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **native external** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **native external** type; returns **false** otherwise.| **Example** ```js @@ -1898,14 +1899,14 @@ Checks whether the input value is of the **Float32Array** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **Float32Array** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **Float32Array** type; returns **false** otherwise.| **Example** ```js @@ -1923,14 +1924,14 @@ Checks whether the input value is of the **Float64Array** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **Float64Array** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **Float64Array** type; returns **false** otherwise.| **Example** ```js @@ -1948,14 +1949,14 @@ Checks whether the input value is a generator function. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is a generator function; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is a generator function; returns **false** otherwise.| **Example** ```js @@ -1973,14 +1974,14 @@ Checks whether the input value is a generator object. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is a generator object; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is a generator object; returns **false** otherwise.| **Example** ```js @@ -2000,14 +2001,14 @@ Checks whether the input value is of the **Int8Array** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **Int8Array** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **Int8Array** type; returns **false** otherwise.| **Example** ```js @@ -2025,14 +2026,14 @@ Checks whether the input value is of the **Int16Array** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **Int16Array** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **Int16Array** type; returns **false** otherwise.| **Example** ```js @@ -2050,14 +2051,14 @@ Checks whether the input value is of the **Int32Array** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **Int32Array** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **Int32Array** type; returns **false** otherwise.| **Example** ```js @@ -2075,14 +2076,14 @@ Checks whether the input value is of the **Map** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **Map** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **Map** type; returns **false** otherwise.| **Example** ```js @@ -2100,14 +2101,14 @@ Checks whether the input value is of the **MapIterator** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **MapIterator** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **MapIterator** type; returns **false** otherwise.| **Example** ```js @@ -2126,14 +2127,14 @@ Checks whether the input value is of the **Error** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **Error** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **Error** type; returns **false** otherwise.| **Example** ```js @@ -2151,14 +2152,14 @@ Checks whether the input value is a number object. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is a number object; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is a number object; returns **false** otherwise.| **Example** ```js @@ -2176,14 +2177,14 @@ Checks whether the input value is a promise. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is a promise; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is a promise; returns **false** otherwise.| **Example** ```js @@ -2201,14 +2202,14 @@ Checks whether the input value is a proxy. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is a proxy; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is a proxy; returns **false** otherwise.| **Example** ```js @@ -2228,14 +2229,14 @@ Checks whether the input value is of the **RegExp** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **RegExp** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **RegExp** type; returns **false** otherwise.| **Example** ```js @@ -2253,14 +2254,14 @@ Checks whether the input value is of the **Set** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **Set** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **Set** type; returns **false** otherwise.| **Example** ```js @@ -2278,14 +2279,14 @@ Checks whether the input value is of the **SetIterator** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **SetIterator** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **SetIterator** type; returns **false** otherwise.| **Example** ```js @@ -2304,14 +2305,14 @@ Checks whether the input value is a string object. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is a string object; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is a string object; returns **false** otherwise.| **Example** ```js @@ -2329,14 +2330,14 @@ Checks whether the input value is a symbol object. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is a symbol object; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is a symbol object; returns **false** otherwise.| **Example** ```js @@ -2357,14 +2358,14 @@ Checks whether the input value is of the **TypedArray** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **TypedArray** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **TypedArray** type; returns **false** otherwise.| **Example** ```js @@ -2382,14 +2383,14 @@ Checks whether the input value is of the **Uint8Array** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **Uint8Array** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **Uint8Array** type; returns **false** otherwise.| **Example** ```js @@ -2407,14 +2408,14 @@ Checks whether the input value is of the **Uint8ClampedArray** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **Uint8ClampedArray** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **Uint8ClampedArray** type; returns **false** otherwise.| **Example** ```js @@ -2432,14 +2433,14 @@ Checks whether the input value is of the **Uint16Array** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **Uint16Array** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **Uint16Array** type; returns **false** otherwise.| **Example** ```js @@ -2457,14 +2458,14 @@ Checks whether the input value is of the **Uint32Array** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **Uint32Array** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **Uint32Array** type; returns **false** otherwise.| **Example** ```js @@ -2482,14 +2483,14 @@ Checks whether the input value is of the **WeakMap** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **WeakMap** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **WeakMap** type; returns **false** otherwise.| **Example** ```js @@ -2507,17 +2508,17 @@ Checks whether the input value is of the **WeakSet** type. **System capability**: SystemCapability.Utils.Lang **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | value | Object | Yes | Object to check. | +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| value | Object | Yes| Object to check.| **Return value** - | Type | Description | - | -------- | -------- | - | boolean | Returns **true** if the input value is of the **WeakSet** type; returns **false** otherwise. | +| Type| Description| +| -------- | -------- | +| boolean | Returns **true** if the input value is of the **WeakSet** type; returns **false** otherwise.| **Example** ```js var that = new util.types(); var result = that.isWeakSet(new WeakSet()); - ``` \ No newline at end of file + ``` diff --git a/en/application-dev/reference/apis/js-apis-xml.md b/en/application-dev/reference/apis/js-apis-xml.md index c014e5dbbef4cd972a9af5bb77efd71c3c363ae3..1175651b960bcc61cfef74c9c724d281487f6582 100644 --- a/en/application-dev/reference/apis/js-apis-xml.md +++ b/en/application-dev/reference/apis/js-apis-xml.md @@ -1,6 +1,7 @@ # XML Parsing and Generation -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> **NOTE** +> > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -25,7 +26,7 @@ A constructor used to create an **XmlSerializer** instance. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| buffer | ArrayBuffer \| DataView | Yes| **ArrayBuffer** or **DataView** for storing the XML information to write.| +| buffer | ArrayBuffer \| DataView | Yes| **ArrayBuffer** or **DataView** for storing the XML information to write.| | encoding | string | No| Encoding format.| **Example** @@ -55,6 +56,8 @@ Sets an attribute. **Example** ```js +var arrayBuffer = new ArrayBuffer(1024); +var bufView = new DataView(arrayBuffer); var thatSer = new xml.XmlSerializer(bufView); thatSer.setAttributes("importance", "high"); ``` @@ -77,6 +80,8 @@ Adds an empty element. **Example** ```js +var arrayBuffer = new ArrayBuffer(1024); +var bufView = new DataView(arrayBuffer); var thatSer = new xml.XmlSerializer(bufView); thatSer.addEmptyElement("b"); // => ``` @@ -93,6 +98,8 @@ Sets a declaration. **Example** ```js +var arrayBuffer = new ArrayBuffer(1024); +var bufView = new DataView(arrayBuffer); var thatSer = new xml.XmlSerializer(bufView); thatSer.setDeclaration() // => ; ``` @@ -133,6 +140,8 @@ Writes the end tag of the element. **Example** ```js +var arrayBuffer = new ArrayBuffer(1024); +var bufView = new DataView(arrayBuffer); var thatSer = new xml.XmlSerializer(bufView); thatSer.setNamespace("h", "http://www.w3.org/TR/html4/"); thatSer.startElement("table"); @@ -280,7 +289,7 @@ Creates and returns an **XmlPullParser** object. The **XmlPullParser** object pa | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| buffer | ArrayBuffer \| DataView | Yes| **ArrayBuffer** or **DataView** that contains XML text information.| +| buffer | ArrayBuffer \| DataView | Yes| **ArrayBuffer** or **DataView** that contains XML text information.| | encoding | string | No| Encoding format. Only UTF-8 is supported.| **Example** @@ -358,9 +367,9 @@ Defines the XML parsing options. | -------- | -------- | -------- | -------- | | supportDoctype | boolean | No| Whether to ignore **Doctype**. The default value is **false**.| | ignoreNameSpace | boolean | No| Whether to ignore **Namespace**. The default value is **false**.| -| tagValueCallbackFunction | (name: string, value: string)=> boolean | No| Callback used to return **tagValue**.| -| attributeValueCallbackFunction | (name: string, value: string)=> boolean | No| Callback used to return **attributeValue**.| -| tokenValueCallbackFunction | (eventType: [EventType](#eventtype), value: [ParseInfo](#parseinfo))=> boolean | No| Callback used to return **tokenValue**.| +| tagValueCallbackFunction | (name: string, value: string)=> boolean | No| Callback used to return **tagValue**.| +| attributeValueCallbackFunction | (name: string, value: string)=> boolean | No| Callback used to return **attributeValue**.| +| tokenValueCallbackFunction | (eventType: [EventType](#eventtype), value: [ParseInfo](#parseinfo))=> boolean | No| Callback used to return **tokenValue**.| ## ParseInfo