提交 52d88c79 编写于 作者: L lixingyang-li 提交者: lixingyang

Modify the sample code language tag type for language compilation runtime

Signed-off-by: Nlixingyang-li <lixingyang8@huawei.com>
https://gitee.com/openharmony/docs/issues/I550NM
上级 faa43270
...@@ -39,7 +39,7 @@ Converts an XML text into a JavaScript object. ...@@ -39,7 +39,7 @@ Converts an XML text into a JavaScript object.
- Example - Example
``` ```js
let xml = let xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
......
...@@ -60,7 +60,7 @@ Waits until the child process ends. This method uses a promise to return the exi ...@@ -60,7 +60,7 @@ Waits until the child process ends. This method uses a promise to return the exi
**Example** **Example**
``` ```js
var child = process.runCmd('ls'); var child = process.runCmd('ls');
var result = child.wait(); var result = child.wait();
result.then(val=>{ result.then(val=>{
...@@ -85,7 +85,7 @@ Obtains the standard output of the child process. ...@@ -85,7 +85,7 @@ Obtains the standard output of the child process.
**Example** **Example**
``` ```js
var child = process.runCmd('ls'); var child = process.runCmd('ls');
var result = child.wait(); var result = child.wait();
child.getOutput.then(val=>{ child.getOutput.then(val=>{
...@@ -110,7 +110,7 @@ Obtains the standard error output of the child process. ...@@ -110,7 +110,7 @@ Obtains the standard error output of the child process.
**Example** **Example**
``` ```js
var child = process.runCmd('madir test.text'); var child = process.runCmd('madir test.text');
var result = child.wait(); var result = child.wait();
child.getErrorOutput.then(val=>{ child.getErrorOutput.then(val=>{
...@@ -129,7 +129,7 @@ Closes the child process in running. ...@@ -129,7 +129,7 @@ Closes the child process in running.
**Example** **Example**
``` ```js
var child = process.runCmd('sleep 5; ls'); var child = process.runCmd('sleep 5; ls');
child.close(); child.close();
``` ```
...@@ -151,7 +151,7 @@ Sends a signal to the specified child process to terminate it. ...@@ -151,7 +151,7 @@ Sends a signal to the specified child process to terminate it.
**Example** **Example**
``` ```js
var child = process.runCmd('sleep 5; ls'); var child = process.runCmd('sleep 5; ls');
child.kill(9); child.kill(9);
``` ```
...@@ -173,7 +173,7 @@ Checks whether this process is isolated. ...@@ -173,7 +173,7 @@ Checks whether this process is isolated.
**Example** **Example**
``` ```js
var result = process.isIsolatedProcess(); var result = process.isIsolatedProcess();
``` ```
...@@ -200,7 +200,7 @@ Checks whether a UID belongs to this app. ...@@ -200,7 +200,7 @@ Checks whether a UID belongs to this app.
**Example** **Example**
``` ```js
var result = process.isAppUid(688); var result = process.isAppUid(688);
``` ```
...@@ -221,7 +221,7 @@ Checks whether this process is running in a 64-bit environment. ...@@ -221,7 +221,7 @@ Checks whether this process is running in a 64-bit environment.
**Example** **Example**
``` ```js
var ressult = process.is64Bit(); var ressult = process.is64Bit();
``` ```
...@@ -248,7 +248,7 @@ Obtains the process UID based on the process name. ...@@ -248,7 +248,7 @@ Obtains the process UID based on the process name.
**Example** **Example**
``` ```js
var pres = process.getUidForName("tool") var pres = process.getUidForName("tool")
``` ```
...@@ -275,7 +275,7 @@ Obtains the thread priority based on the specified TID. ...@@ -275,7 +275,7 @@ Obtains the thread priority based on the specified TID.
**Example** **Example**
``` ```js
var tid = process.getTid(); var tid = process.getTid();
var pres = process.getThreadPriority(tid); var pres = process.getThreadPriority(tid);
``` ```
...@@ -297,7 +297,7 @@ Obtains the duration, in milliseconds, from the time the system starts to the ti ...@@ -297,7 +297,7 @@ Obtains the duration, in milliseconds, from the time the system starts to the ti
**Example** **Example**
``` ```js
var realtime = process.getStartRealtime(); var realtime = process.getStartRealtime();
``` ```
...@@ -317,7 +317,7 @@ Obtains the CPU time (in milliseconds) from the time the process starts to the c ...@@ -317,7 +317,7 @@ Obtains the CPU time (in milliseconds) from the time the process starts to the c
**Example** **Example**
``` ```js
var result = process.getPastCpuTime() ; var result = process.getPastCpuTime() ;
``` ```
...@@ -344,7 +344,7 @@ Obtains the system configuration. ...@@ -344,7 +344,7 @@ Obtains the system configuration.
**Example** **Example**
``` ```js
var _SC_ARG_MAX = 0 var _SC_ARG_MAX = 0
var pres = process.getSystemConfig(_SC_ARG_MAX) var pres = process.getSystemConfig(_SC_ARG_MAX)
``` ```
...@@ -372,7 +372,7 @@ Obtains the value of an environment variable. ...@@ -372,7 +372,7 @@ Obtains the value of an environment variable.
**Example** **Example**
``` ```js
var pres = process.getEnvironmentVar("PATH") var pres = process.getEnvironmentVar("PATH")
``` ```
...@@ -408,7 +408,7 @@ Forks a new process to run a shell command and returns the **ChildProcess** obje ...@@ -408,7 +408,7 @@ Forks a new process to run a shell command and returns the **ChildProcess** obje
**Example** **Example**
``` ```js
var child = process.runCmd('ls', { maxBuffer : 2 }); var child = process.runCmd('ls', { maxBuffer : 2 });
var result = child.wait(); var result = child.wait();
child.getOutput.then(val=>{ child.getOutput.then(val=>{
...@@ -427,7 +427,7 @@ Aborts a process and generates a core file. This method will cause a process to ...@@ -427,7 +427,7 @@ Aborts a process and generates a core file. This method will cause a process to
**Example** **Example**
``` ```js
process.abort(); process.abort();
``` ```
...@@ -455,7 +455,7 @@ Stores the events triggered by the user. ...@@ -455,7 +455,7 @@ Stores the events triggered by the user.
**Example** **Example**
``` ```js
process.on("data", (e)=>{ process.on("data", (e)=>{
console.log("data callback"); console.log("data callback");
}) })
...@@ -484,7 +484,7 @@ Deletes the event stored by the user. ...@@ -484,7 +484,7 @@ Deletes the event stored by the user.
**Example** **Example**
``` ```js
process.on("data", (e)=>{ process.on("data", (e)=>{
console.log("data callback"); console.log("data callback");
}) })
...@@ -510,7 +510,7 @@ Exercise caution when using this API. ...@@ -510,7 +510,7 @@ Exercise caution when using this API.
**Example** **Example**
``` ```js
process.exit(0); process.exit(0);
``` ```
...@@ -525,7 +525,7 @@ Obtains the working directory of this process. ...@@ -525,7 +525,7 @@ Obtains the working directory of this process.
**Example** **Example**
``` ```js
var path = process.cwd(); var path = process.cwd();
``` ```
...@@ -546,7 +546,7 @@ Changes the working directory of this process. ...@@ -546,7 +546,7 @@ Changes the working directory of this process.
**Example** **Example**
``` ```js
process.chdir('/system'); process.chdir('/system');
``` ```
...@@ -567,7 +567,7 @@ Obtains the running time of this process. ...@@ -567,7 +567,7 @@ Obtains the running time of this process.
**Example** **Example**
``` ```js
var time = process.uptime(); var time = process.uptime();
``` ```
...@@ -594,7 +594,7 @@ Sends a signal to the specified process to terminate it. ...@@ -594,7 +594,7 @@ Sends a signal to the specified process to terminate it.
| boolean | Returns **true** if the signal is sent successfully; returns **false** otherwise.| | boolean | Returns **true** if the signal is sent successfully; returns **false** otherwise.|
**Example** **Example**
``` ```js
var pres = process.pid var pres = process.pid
var result = that.kill(pres, 28) var result = that.kill(pres, 28)
``` ```
...@@ -46,11 +46,11 @@ A constructor used to create a URI instance. ...@@ -46,11 +46,11 @@ A constructor used to create a URI instance.
**Example** **Example**
``` ```js
var mm = 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment'; var mm = 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
new uri.URI(mm); // Output 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment'; new uri.URI(mm); // Output 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
``` ```
``` ```js
new uri.URI('http://username:password@host:8080'); // Output 'http://username:password@host:8080'; new uri.URI('http://username:password@host:8080'); // Output 'http://username:password@host:8080';
``` ```
...@@ -69,7 +69,7 @@ Obtains the query string applicable to this URL. ...@@ -69,7 +69,7 @@ Obtains the query string applicable to this URL.
**Example** **Example**
``` ```js
const url = new uri.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new uri.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toString() url.toString()
``` ```
...@@ -95,7 +95,7 @@ Checks whether this URI is the same as another URI object. ...@@ -95,7 +95,7 @@ Checks whether this URI is the same as another URI object.
**Example** **Example**
``` ```js
const uriInstance = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const uriInstance = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
const uriInstance1 = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment'); const uriInstance1 = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment');
uriInstance.equals(uriInstance1); uriInstance.equals(uriInstance1);
...@@ -115,7 +115,7 @@ Checks whether this URI is an absolute URI (whether the scheme component is defi ...@@ -115,7 +115,7 @@ Checks whether this URI is an absolute URI (whether the scheme component is defi
**Example** **Example**
``` ```js
const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080?query=pppppp'); const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080?query=pppppp');
uriInstance.checkIsAbsolute(); uriInstance.checkIsAbsolute();
``` ```
...@@ -134,7 +134,7 @@ Normalizes the path of this URI. ...@@ -134,7 +134,7 @@ Normalizes the path of this URI.
| URI | URI with the normalized path.| | URI | URI with the normalized path.|
**Example** **Example**
``` ```js
const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp'); const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp');
let uriInstance1 = uriInstance.normalize(); let uriInstance1 = uriInstance.normalize();
uriInstance1.path; uriInstance1.path;
......
...@@ -31,7 +31,7 @@ Creates a **URLSearchParams** instance. ...@@ -31,7 +31,7 @@ Creates a **URLSearchParams** instance.
**Example** **Example**
``` ```js
var objectParams = new URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]); var objectParams = new URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]);
var objectParams1 = new URLSearchParams({"fod" : 1 , "bard" : 2}); var objectParams1 = new URLSearchParams({"fod" : 1 , "bard" : 2});
var objectParams2 = new URLSearchParams('?fod=1&bard=2'); var objectParams2 = new URLSearchParams('?fod=1&bard=2');
...@@ -55,7 +55,7 @@ Appends a key-value pair into the query string. ...@@ -55,7 +55,7 @@ Appends a key-value pair into the query string.
**Example** **Example**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.append('fod', 3); paramsObject.append('fod', 3);
...@@ -76,7 +76,7 @@ Deletes key-value pairs of the specified key. ...@@ -76,7 +76,7 @@ Deletes key-value pairs of the specified key.
**Example** **Example**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsobject = new URLSearchParams(urlObject.search.slice(1)); let paramsobject = new URLSearchParams(urlObject.search.slice(1));
paramsobject.delete('fod'); paramsobject.delete('fod');
...@@ -103,7 +103,7 @@ Obtains all the key-value pairs based on the specified key. ...@@ -103,7 +103,7 @@ Obtains all the key-value pairs based on the specified key.
**Example** **Example**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.append('fod', 3); // Add a second value for the fod parameter. paramsObject.append('fod', 3); // Add a second value for the fod parameter.
...@@ -125,7 +125,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th ...@@ -125,7 +125,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
**Example** **Example**
``` ```js
var searchParamsObject = new URLSearchParams("keyName1=valueName1&keyName2=valueName2"); var searchParamsObject = new URLSearchParams("keyName1=valueName1&keyName2=valueName2");
for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pairs for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pairs
console.log(pair[0]+ ', '+ pair[1]); console.log(pair[0]+ ', '+ pair[1]);
...@@ -156,7 +156,7 @@ Traverses the key-value pairs in the **URLSearchParams** instance by using a cal ...@@ -156,7 +156,7 @@ Traverses the key-value pairs in the **URLSearchParams** instance by using a cal
**Example** **Example**
``` ```js
const myURLObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); const myURLObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
myURLObject.searchParams.forEach((value, name, searchParams) => { myURLObject.searchParams.forEach((value, name, searchParams) => {
console.log(name, value, myURLObject.searchParams === searchParams); console.log(name, value, myURLObject.searchParams === searchParams);
...@@ -185,7 +185,7 @@ Obtains the value of the first key-value pair based on the specified key. ...@@ -185,7 +185,7 @@ Obtains the value of the first key-value pair based on the specified key.
**Example** **Example**
``` ```js
var paramsOject = new URLSearchParams(document.location.search.substring(1)); var paramsOject = new URLSearchParams(document.location.search.substring(1));
var name = paramsOject.get("name"); // is the string "Jonathan" var name = paramsOject.get("name"); // is the string "Jonathan"
var age = parseInt(paramsOject.get("age"), 10); // is the number 18 var age = parseInt(paramsOject.get("age"), 10); // is the number 18
...@@ -213,7 +213,7 @@ Checks whether a key has a value. ...@@ -213,7 +213,7 @@ Checks whether a key has a value.
**Example** **Example**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.has('bard') === true; paramsObject.has('bard') === true;
...@@ -235,7 +235,7 @@ Sets the value for a key. If key-value pairs matching the specified key exist, t ...@@ -235,7 +235,7 @@ Sets the value for a key. If key-value pairs matching the specified key exist, t
**Example** **Example**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.set('baz', 3); // Add a third parameter. paramsObject.set('baz', 3); // Add a third parameter.
...@@ -251,7 +251,7 @@ Sorts all key-value pairs contained in this object based on the Unicode code poi ...@@ -251,7 +251,7 @@ Sorts all key-value pairs contained in this object based on the Unicode code poi
**Example** **Example**
``` ```js
var searchParamsObject = new URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object var searchParamsObject = new URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object
searchParamsObject.sort(); // Sort the key/value pairs 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 console.log(searchParamsObject.toString()); // Display the sorted query string // Output a=9&b=2&c=3&d=4
...@@ -273,7 +273,7 @@ Obtains an ES6 iterator that contains the keys of all the key-value pairs. ...@@ -273,7 +273,7 @@ Obtains an ES6 iterator that contains the keys of all the key-value pairs.
**Example** **Example**
``` ```js
var searchParamsObject = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing var searchParamsObject = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing
for (var key of searchParamsObject .keys()) { // Output key-value pairs for (var key of searchParamsObject .keys()) { // Output key-value pairs
console.log(key); console.log(key);
...@@ -295,7 +295,7 @@ Obtains an ES6 iterator that contains the values of all the key-value pairs. ...@@ -295,7 +295,7 @@ Obtains an ES6 iterator that contains the values of all the key-value pairs.
**Example** **Example**
``` ```js
var searchParams = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing var searchParams = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing
for (var value of searchParams.values()) { for (var value of searchParams.values()) {
console.log(value); console.log(value);
...@@ -318,7 +318,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th ...@@ -318,7 +318,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
**Example** **Example**
``` ```js
const paramsObject = new URLSearchParams('fod=bay&edg=bap'); const paramsObject = new URLSearchParams('fod=bay&edg=bap');
for (const [name, value] of paramsObject) { for (const [name, value] of paramsObject) {
console.log(name, value); console.log(name, value);
...@@ -341,7 +341,7 @@ Obtains search parameters that are serialized as a string and, if necessary, per ...@@ -341,7 +341,7 @@ Obtains search parameters that are serialized as a string and, if necessary, per
**Example** **Example**
``` ```js
let url = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let url = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let params = new URLSearchParams(url.search.slice(1)); let params = new URLSearchParams(url.search.slice(1));
params.append('fod', 3); params.append('fod', 3);
...@@ -386,7 +386,7 @@ Creates a URL. ...@@ -386,7 +386,7 @@ Creates a URL.
**Example** **Example**
``` ```js
var mm = 'http://username:password@host:8080'; var mm = 'http://username:password@host:8080';
var a = new URL("/", mm); // Output '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/'; var b = new URL(mm); // Output 'http://username:password@host:8080/';
...@@ -416,7 +416,7 @@ Converts the parsed URL into a string. ...@@ -416,7 +416,7 @@ Converts the parsed URL into a string.
**Example** **Example**
``` ```js
const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toString() url.toString()
``` ```
...@@ -436,7 +436,7 @@ Converts the parsed URL into a JSON string. ...@@ -436,7 +436,7 @@ Converts the parsed URL into a JSON string.
| string | Website address in a serialized string.| | string | Website address in a serialized string.|
**Example** **Example**
``` ```js
const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toJSON() url.toJSON()
``` ```
...@@ -23,18 +23,18 @@ Prints the input content in a formatted string. ...@@ -23,18 +23,18 @@ Prints the input content in a formatted string.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| format | string | Yes| Format of the string to print.| | format | string | Yes| Format of the string to print.|
| ...args | Object[] | No| Data to format.| | ...args | Object[] | No| Data to format.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | String in the specified format.| | string | String in the specified format.|
**Example** **Example**
``` ```js
var res = util.printf("%s", "hello world!"); var res = util.printf("%s", "hello world!");
console.log(res); console.log(res);
``` ```
...@@ -49,17 +49,17 @@ Obtains detailed information about a system error code. ...@@ -49,17 +49,17 @@ Obtains detailed information about a system error code.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| errno | number | Yes| Error code generated.| | errno | number | Yes| Error code generated.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Detailed information about the error code.| | string | Detailed information about the error code.|
**Example** **Example**
``` ```js
var errnum = 10; // 10 is the system error code. var errnum = 10; // 10 is the system error code.
var result = util.getErrorString(errnum); var result = util.getErrorString(errnum);
console.log("result = " + result); console.log("result = " + result);
...@@ -76,17 +76,17 @@ Calls back an asynchronous function. In the callback, the first parameter indica ...@@ -76,17 +76,17 @@ Calls back an asynchronous function. In the callback, the first parameter indica
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| original | Function | Yes| Asynchronous function.| | original | Function | Yes| Asynchronous function.|
**Return value** **Return value**
| Type| Description| | 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.| | 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** **Example**
``` ```js
async function promiseFn() { async function promiseFn() {
return Promise.reject('value'); return Promise.reject('value');
} }
...@@ -107,17 +107,17 @@ Processes an asynchronous function and returns a promise version. ...@@ -107,17 +107,17 @@ Processes an asynchronous function and returns a promise version.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| original | Function | Yes| Asynchronous function.| | original | Function | Yes| Asynchronous function.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Function | Function in the error-first style (that is, **(err, value) =>...** is called as the last parameter) and the promise version.| | Function | Function in the error-first style (that is, **(err, value) =>...** is called as the last parameter) and the promise version.|
**Example** **Example**
``` ```js
function aysnFun(str1, str2, callback) { function aysnFun(str1, str2, callback) {
if (typeof str1 === 'string' && typeof str2 === 'string') { if (typeof str1 === 'string' && typeof str2 === 'string') {
callback(null, str1 + str2); callback(null, str1 + str2);
...@@ -154,20 +154,20 @@ A constructor used to create a **TextDecoder** object. ...@@ -154,20 +154,20 @@ A constructor used to create a **TextDecoder** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| encoding | string | No| Encoding format.| | encoding | string | No| Encoding format.|
| options | Object | No| Encoding-related options, which include **fatal** and **ignoreBOM**.| | options | Object | No| Encoding-related options, which include **fatal** and **ignoreBOM**.|
**Table 1** options **Table 1** options
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| fatal | boolean | No| Whether to display fatal errors.| | fatal | boolean | No| Whether to display fatal errors.|
| ignoreBOM | boolean | No| Whether to ignore the BOM.| | ignoreBOM | boolean | No| Whether to ignore the BOM.|
**Example** **Example**
``` ```js
var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true}); var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true});
``` ```
...@@ -181,24 +181,24 @@ Decodes the input content. ...@@ -181,24 +181,24 @@ Decodes the input content.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| input | Unit8Array | Yes| Uint8Array to decode.| | input | Unit8Array | Yes| Uint8Array to decode.|
| options | Object | No| Options related to decoding.| | options | Object | No| Options related to decoding.|
**Table 2** options **Table 2** options
| Name| Type| Mandatory| Description| | 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**.| | 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** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Data decoded.| | string | Data decoded.|
**Example** **Example**
``` ```js
var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true}); var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true});
var result = new Uint8Array(6); var result = new Uint8Array(6);
result[0] = 0xEF; result[0] = 0xEF;
...@@ -236,7 +236,7 @@ A constructor used to create a **TextEncoder** object. ...@@ -236,7 +236,7 @@ A constructor used to create a **TextEncoder** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Example** **Example**
``` ```js
var textEncoder = new util.TextEncoder(); var textEncoder = new util.TextEncoder();
``` ```
...@@ -250,17 +250,17 @@ Encodes the input content. ...@@ -250,17 +250,17 @@ Encodes the input content.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| input | string | Yes| String to encode.| | input | string | Yes| String to encode.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Uint8Array | Encoded text.| | Uint8Array | Encoded text.|
**Example** **Example**
``` ```js
var textEncoder = new util.TextEncoder(); var textEncoder = new util.TextEncoder();
var result = new Uint8Array(buffer); var result = new Uint8Array(buffer);
result = textEncoder.encode("\uD800¥¥"); result = textEncoder.encode("\uD800¥¥");
...@@ -276,18 +276,18 @@ Stores the UTF-8 encoded text. ...@@ -276,18 +276,18 @@ Stores the UTF-8 encoded text.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| input | string | Yes| String to encode.| | input | string | Yes| String to encode.|
| dest | Uint8Array | Yes| **Uint8Array** instance used to store the UTF-8 encoded text.| | dest | Uint8Array | Yes| **Uint8Array** instance used to store the UTF-8 encoded text.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Uint8Array | Encoded text.| | Uint8Array | Encoded text.|
**Example** **Example**
``` ```js
var that = new util.TextEncoder(); var that = new util.TextEncoder();
var buffer = new ArrayBuffer(4); var buffer = new ArrayBuffer(4);
this.dest = new Uint8Array(buffer); this.dest = new Uint8Array(buffer);
...@@ -306,13 +306,13 @@ A constructor used to create a **RationalNumber** object. ...@@ -306,13 +306,13 @@ A constructor used to create a **RationalNumber** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| numerator | number | Yes| Numerator, which is an integer.| | numerator | number | Yes| Numerator, which is an integer.|
| denominator | number | Yes| Denominator, which is an integer.| | denominator | number | Yes| Denominator, which is an integer.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
``` ```
...@@ -326,17 +326,17 @@ Creates a **RationalNumber** object based on the given string. ...@@ -326,17 +326,17 @@ Creates a **RationalNumber** object based on the given string.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| rationalString | string | Yes| String used to create the **RationalNumber** object.| | rationalString | string | Yes| String used to create the **RationalNumber** object.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| object | **RationalNumber** object created.| | object | **RationalNumber** object created.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var rational = rationalNumer.creatRationalFromString("3/4"); var rational = rationalNumer.creatRationalFromString("3/4");
``` ```
...@@ -351,17 +351,18 @@ Compares this **RationalNumber** object with a given object. ...@@ -351,17 +351,18 @@ Compares this **RationalNumber** object with a given object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| another | RationalNumber | Yes| Object used to compare with this **RationalNumber** object.| | another | RationalNumber | Yes| Object used to compare with this **RationalNumber** object.|
**Return value** **Return value**
| Type| Description| | 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.| | 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** **Example**
```
```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var rational = rationalNumer.creatRationalFromString("3/4"); var rational = rationalNumer.creatRationalFromString("3/4");
var result = rationalNumber.compareTo(rational); var result = rationalNumber.compareTo(rational);
...@@ -377,12 +378,12 @@ Obtains the value of this **RationalNumber** object as an integer or a floating- ...@@ -377,12 +378,12 @@ Obtains the value of this **RationalNumber** object as an integer or a floating-
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | An integer or a floating-point number.| | number | An integer or a floating-point number.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.valueOf(); var result = rationalNumber.valueOf();
``` ```
...@@ -397,17 +398,17 @@ Checks whether this **RationalNumber** object equals the given object. ...@@ -397,17 +398,17 @@ Checks whether this **RationalNumber** object equals the given object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| object | Object | Yes| Object used to compare with this **RationalNumber** object.| | object | Object | Yes| Object used to compare with this **RationalNumber** object.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the two objects are equal; returns **false** otherwise.| | boolean | Returns **true** if the two objects are equal; returns **false** otherwise.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var rational = rationalNumer.creatRationalFromString("3/4"); var rational = rationalNumer.creatRationalFromString("3/4");
var result = rationalNumber.equals(rational); var result = rationalNumber.equals(rational);
...@@ -423,18 +424,18 @@ Obtains the greatest common divisor of two specified integers. ...@@ -423,18 +424,18 @@ Obtains the greatest common divisor of two specified integers.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| number1 | number | Yes| The first integer used to get the greatest common divisor.| | 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.| | number2 | number | Yes| The second integer used to get the greatest common divisor.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Greatest common divisor obtained.| | number | Greatest common divisor obtained.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.getCommonDivisor(4,6); var result = rationalNumber.getCommonDivisor(4,6);
``` ```
...@@ -450,12 +451,12 @@ Obtains the numerator of this **RationalNumber** object. ...@@ -450,12 +451,12 @@ Obtains the numerator of this **RationalNumber** object.
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Numerator of this **RationalNumber** object.| | number | Numerator of this **RationalNumber** object.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.getNumerator(); var result = rationalNumber.getNumerator();
``` ```
...@@ -470,12 +471,12 @@ Obtains the denominator of this **RationalNumber** object. ...@@ -470,12 +471,12 @@ Obtains the denominator of this **RationalNumber** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Denominator of this **RationalNumber** object.| | number | Denominator of this **RationalNumber** object.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.getDenominator(); var result = rationalNumber.getDenominator();
``` ```
...@@ -490,12 +491,12 @@ Checks whether this **RationalNumber** object is **0**. ...@@ -490,12 +491,12 @@ Checks whether this **RationalNumber** object is **0**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the value of this **RationalNumber** object is **0**; returns **false** otherwise.| | boolean | Returns **true** if the value of this **RationalNumber** object is **0**; returns **false** otherwise.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.isZero(); var result = rationalNumber.isZero();
``` ```
...@@ -510,12 +511,12 @@ Checks whether this **RationalNumber** object is a Not a Number (NaN). ...@@ -510,12 +511,12 @@ Checks whether this **RationalNumber** object is a Not a Number (NaN).
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if this **RationalNumber** object is a NaN (the denominator and numerator are both **0**); returns **false** otherwise.| | boolean | Returns **true** if this **RationalNumber** object is a NaN (the denominator and numerator are both **0**); returns **false** otherwise.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.isNaN(); var result = rationalNumber.isNaN();
``` ```
...@@ -530,12 +531,12 @@ Checks whether this **RationalNumber** object represents a finite value. ...@@ -530,12 +531,12 @@ Checks whether this **RationalNumber** object represents a finite value.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if this **RationalNumber** object represents a finite value (the denominator is not **0**); returns **false** otherwise.| | boolean | Returns **true** if this **RationalNumber** object represents a finite value (the denominator is not **0**); returns **false** otherwise.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.isFinite(); var result = rationalNumber.isFinite();
``` ```
...@@ -550,12 +551,12 @@ Obtains the string representation of this **RationalNumber** object. ...@@ -550,12 +551,12 @@ Obtains the string representation of this **RationalNumber** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | 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**.| | 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** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.toString(); var result = rationalNumber.toString();
``` ```
...@@ -571,7 +572,7 @@ Obtains the string representation of this **RationalNumber** object. ...@@ -571,7 +572,7 @@ Obtains the string representation of this **RationalNumber** object.
| length | number | Yes| No| Total number of values in this buffer.| | length | number | Yes| No| Total number of values in this buffer.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.put(1,8); pro.put(1,8);
...@@ -588,12 +589,12 @@ A constructor used to create an **LruBuffer** instance. The default capacity of ...@@ -588,12 +589,12 @@ A constructor used to create an **LruBuffer** instance. The default capacity of
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| capacity | number | No| Capacity of the **LruBuffer** to create.| | capacity | number | No| Capacity of the **LruBuffer** to create.|
**Example** **Example**
``` ```js
var lrubuffer= new util.LruBuffer(); var lrubuffer= new util.LruBuffer();
``` ```
...@@ -607,12 +608,12 @@ Changes the **LruBuffer** capacity. If the new capacity is less than or equal to ...@@ -607,12 +608,12 @@ Changes the **LruBuffer** capacity. If the new capacity is less than or equal to
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| newCapacity | number | Yes| New capacity of the **LruBuffer**.| | newCapacity | number | Yes| New capacity of the **LruBuffer**.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
var result = pro.updateCapacity(100); var result = pro.updateCapacity(100);
``` ```
...@@ -627,12 +628,12 @@ Obtains the string representation of this **LruBuffer** object. ...@@ -627,12 +628,12 @@ Obtains the string representation of this **LruBuffer** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | String representation of this **LruBuffer** object.| | string | String representation of this **LruBuffer** object.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.get(2); pro.get(2);
...@@ -650,12 +651,12 @@ Obtains the capacity of this buffer. ...@@ -650,12 +651,12 @@ Obtains the capacity of this buffer.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Capacity of this buffer.| | number | Capacity of this buffer.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
var result = pro.getCapacity(); var result = pro.getCapacity();
``` ```
...@@ -670,7 +671,7 @@ Clears key-value pairs from this buffer. The **afterRemoval()** method will be c ...@@ -670,7 +671,7 @@ Clears key-value pairs from this buffer. The **afterRemoval()** method will be c
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.size(); var result = pro.size();
...@@ -687,12 +688,12 @@ Obtains the number of return values for **createDefault()**. ...@@ -687,12 +688,12 @@ Obtains the number of return values for **createDefault()**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Number of return values for **createDefault()**.| | number | Number of return values for **createDefault()**.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(1,8); pro.put(1,8);
var result = pro.getCreateCount(); var result = pro.getCreateCount();
...@@ -708,12 +709,12 @@ Obtains the number of times that the queried values are mismatched. ...@@ -708,12 +709,12 @@ Obtains the number of times that the queried values are mismatched.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Number of times that the queried values are mismatched.| | number | Number of times that the queried values are mismatched.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.get(2); pro.get(2);
...@@ -730,12 +731,12 @@ Obtains the number of removals from this buffer. ...@@ -730,12 +731,12 @@ Obtains the number of removals from this buffer.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Number of removals from the buffer.| | number | Number of removals from the buffer.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.updateCapacity(2); pro.updateCapacity(2);
...@@ -753,12 +754,12 @@ Obtains the number of times that the queried values are matched. ...@@ -753,12 +754,12 @@ Obtains the number of times that the queried values are matched.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Number of times that the queried values are matched.| | number | Number of times that the queried values are matched.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.get(2); pro.get(2);
...@@ -775,12 +776,12 @@ Obtains the number of additions to this buffer. ...@@ -775,12 +776,12 @@ Obtains the number of additions to this buffer.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Number of additions to the buffer.| | number | Number of additions to the buffer.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.getPutCount(); var result = pro.getPutCount();
...@@ -796,12 +797,12 @@ Checks whether this buffer is empty. ...@@ -796,12 +797,12 @@ Checks whether this buffer is empty.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the buffer does not contain any value.| | boolean | Returns **true** if the buffer does not contain any value.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.isEmpty(); var result = pro.isEmpty();
...@@ -817,17 +818,17 @@ Obtains the value of the specified key. ...@@ -817,17 +818,17 @@ Obtains the value of the specified key.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | Yes| Key based on which the value is queried.| | key | K | Yes| Key based on which the value is queried.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| V&nbsp;\|&nbsp;undefind | Returns the value of the key if a match is found in the buffer; returns **undefined** otherwise.| | V&nbsp;\|&nbsp;undefind | Returns the value of the key if a match is found in the buffer; returns **undefined** otherwise.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.get(2); var result = pro.get(2);
...@@ -843,18 +844,18 @@ Adds a key-value pair to this buffer. ...@@ -843,18 +844,18 @@ Adds a key-value pair to this buffer.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | Yes| Key of the key-value pair to add.| | key | K | Yes| Key of the key-value pair to add.|
| value | V | Yes| Value of the key-value pair to add.| | value | V | Yes| Value of the key-value pair to add.|
**Return value** **Return value**
| Type| Description| | 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. | | 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** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
var result = pro.put(2,10); var result = pro.put(2,10);
``` ```
...@@ -869,12 +870,12 @@ Obtains all values in this buffer, listed from the most to the least recently ac ...@@ -869,12 +870,12 @@ Obtains all values in this buffer, listed from the most to the least recently ac
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| V&nbsp;[] | All values in the buffer, listed from the most to the least recently accessed.| | V&nbsp;[] | All values in the buffer, listed from the most to the least recently accessed.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.put(2,"anhu"); pro.put(2,"anhu");
...@@ -892,12 +893,12 @@ Obtains all keys in this buffer, listed from the most to the least recently acce ...@@ -892,12 +893,12 @@ Obtains all keys in this buffer, listed from the most to the least recently acce
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| K&nbsp;[] | All keys in the buffer, listed from the most to the least recently accessed.| | K&nbsp;[] | All keys in the buffer, listed from the most to the least recently accessed.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.keys(); var result = pro.keys();
...@@ -913,17 +914,17 @@ Removes the specified key and its value from this buffer. ...@@ -913,17 +914,17 @@ Removes the specified key and its value from this buffer.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | Yes| Key to remove.| | key | K | Yes| Key to remove.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| V&nbsp;\|&nbsp;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.| | V&nbsp;\|&nbsp;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** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.remove(20); var result = pro.remove(20);
...@@ -939,15 +940,15 @@ Performs subsequent operations after a value is removed. ...@@ -939,15 +940,15 @@ Performs subsequent operations after a value is removed.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | 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.| | 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.| | key | K | Yes| Key removed.|
| value | V | Yes| Value 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.| | 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** **Example**
``` ```js
var arr = []; var arr = [];
class ChildLruBuffer extends util.LruBuffer class ChildLruBuffer extends util.LruBuffer
{ {
...@@ -984,17 +985,17 @@ Checks whether this buffer contains the specified key. ...@@ -984,17 +985,17 @@ Checks whether this buffer contains the specified key.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | Yes| Key to check.| | key | K | Yes| Key to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the buffer contains the specified key; returns **false** otherwise.| | boolean | Returns **true** if the buffer contains the specified key; returns **false** otherwise.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.contains(20); var result = pro.contains(20);
...@@ -1010,17 +1011,17 @@ Creates a value if the value of the specified key is not available. ...@@ -1010,17 +1011,17 @@ Creates a value if the value of the specified key is not available.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | Yes| Key of which the value is missing.| | key | K | Yes| Key of which the value is missing.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| V | Value of the key.| | V | Value of the key.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
var result = pro.createDefault(50); var result = pro.createDefault(50);
``` ```
...@@ -1035,12 +1036,12 @@ Obtains a new iterator object that contains all key-value pairs in this object. ...@@ -1035,12 +1036,12 @@ Obtains a new iterator object that contains all key-value pairs in this object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [K,&nbsp;V] | Iterable array.| | [K,&nbsp;V] | Iterable array.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.entries(); var result = pro.entries();
...@@ -1056,12 +1057,12 @@ Obtains a two-dimensional array in key-value pairs. ...@@ -1056,12 +1057,12 @@ Obtains a two-dimensional array in key-value pairs.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [K,&nbsp;V] | Two-dimensional array in key-value pairs.| | [K,&nbsp;V] | Two-dimensional array in key-value pairs.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro[symbol.iterator](); var result = pro[symbol.iterator]();
...@@ -1076,7 +1077,7 @@ Obtains a two-dimensional array in key-value pairs. ...@@ -1076,7 +1077,7 @@ Obtains a two-dimensional array in key-value pairs.
Defines the type of values in a **Scope** object. The value type can be **ScopeComparable** or **number**. Defines the type of values in a **Scope** object. The value type can be **ScopeComparable** or **number**.
The values of the **ScopeComparable** type are used to implement the **compareTo** method. Therefore, ensure that the input parameters are comparable. The values of the **ScopeComparable** type are used to implement the **compareTo** method. Therefore, ensure that the input parameters are comparable.
``` ```js
interface ScopeComparable{ interface ScopeComparable{
compareTo(other: ScopeComparable): boolean; compareTo(other: ScopeComparable): boolean;
} }
...@@ -1088,7 +1089,7 @@ Create a class to implement the **compareTo** method. In the subsequent sample c ...@@ -1088,7 +1089,7 @@ Create a class to implement the **compareTo** method. In the subsequent sample c
Example Example
``` ```js
class Temperature{ class Temperature{
constructor(value){ constructor(value){
this._temp = value; this._temp = value;
...@@ -1115,13 +1116,13 @@ A constructor used to create a **Scope** object with the specified upper and low ...@@ -1115,13 +1116,13 @@ A constructor used to create a **Scope** object with the specified upper and low
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| lowerObj | [ScopeType](#scopetype8) | Yes| Lower limit of the **Scope** object.| | lowerObj | [ScopeType](#scopetype8) | Yes| Lower limit of the **Scope** object.|
| upperObj | [ScopeType](#scopetype8) | Yes| Upper limit of the **Scope** object.| | upperObj | [ScopeType](#scopetype8) | Yes| Upper limit of the **Scope** object.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1137,12 +1138,12 @@ Obtains a string representation that contains this **Scope**. ...@@ -1137,12 +1138,12 @@ Obtains a string representation that contains this **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | String representation containing the **Scope**.| | string | String representation containing the **Scope**.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1159,17 +1160,17 @@ Obtains the intersection of this **Scope** and the given **Scope**. ...@@ -1159,17 +1160,17 @@ Obtains the intersection of this **Scope** and the given **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| range | [Scope](#scope8) | Yes| **Scope** specified.| | range | [Scope](#scope8) | Yes| **Scope** specified.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | Intersection of this **Scope** and the given **Scope**.| | [Scope](#scope8) | Intersection of this **Scope** and the given **Scope**.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1189,18 +1190,18 @@ Obtains the intersection of this **Scope** and the given lower and upper limits. ...@@ -1189,18 +1190,18 @@ Obtains the intersection of this **Scope** and the given lower and upper limits.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| lowerObj | [ScopeType](#scopetype8) | Yes| Lower limit.| | lowerObj | [ScopeType](#scopetype8) | Yes| Lower limit.|
| upperObj | [ScopeType](#scopetype8) | Yes| Upper limit.| | upperObj | [ScopeType](#scopetype8) | Yes| Upper limit.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | Intersection of this **Scope** and the given lower and upper limits.| | [Scope](#scope8) | Intersection of this **Scope** and the given lower and upper limits.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1220,12 +1221,12 @@ Obtains the upper limit of this **Scope**. ...@@ -1220,12 +1221,12 @@ Obtains the upper limit of this **Scope**.
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [ScopeType](#scopetype8) | Upper limit of this **Scope**.| | [ScopeType](#scopetype8) | Upper limit of this **Scope**.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1242,12 +1243,12 @@ Obtains the lower limit of this **Scope**. ...@@ -1242,12 +1243,12 @@ Obtains the lower limit of this **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [ScopeType](#scopetype8) | Lower limit of this **Scope**.| | [ScopeType](#scopetype8) | Lower limit of this **Scope**.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1264,18 +1265,18 @@ Obtains the union set of this **Scope** and the given lower and upper limits. ...@@ -1264,18 +1265,18 @@ Obtains the union set of this **Scope** and the given lower and upper limits.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| lowerObj | [ScopeType](#scopetype8) | Yes| Lower limit.| | lowerObj | [ScopeType](#scopetype8) | Yes| Lower limit.|
| upperObj | [ScopeType](#scopetype8) | Yes| Upper limit.| | upperObj | [ScopeType](#scopetype8) | Yes| Upper limit.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | Union set of this **Scope** and the given lower and upper limits.| | [Scope](#scope8) | Union set of this **Scope** and the given lower and upper limits.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1294,17 +1295,17 @@ Obtains the union set of this **Scope** and the given **Scope**. ...@@ -1294,17 +1295,17 @@ Obtains the union set of this **Scope** and the given **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| range | [Scope](#scope8) | Yes| **Scope** specified.| | range | [Scope](#scope8) | Yes| **Scope** specified.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | Union set of this **Scope** and the given **Scope**.| | [Scope](#scope8) | Union set of this **Scope** and the given **Scope**.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1324,17 +1325,17 @@ Obtains the union set of this **Scope** and the given value. ...@@ -1324,17 +1325,17 @@ Obtains the union set of this **Scope** and the given value.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | [ScopeType](#scopetype8) | Yes| Value specified.| | value | [ScopeType](#scopetype8) | Yes| Value specified.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | Union set of this **Scope** and the given value.| | [Scope](#scope8) | Union set of this **Scope** and the given value.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1352,17 +1353,17 @@ Checks whether a value is within this **Scope**. ...@@ -1352,17 +1353,17 @@ Checks whether a value is within this **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | [ScopeType](#scopetype8) | Yes| Value specified.| | value | [ScopeType](#scopetype8) | Yes| Value specified.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the value is within this **Scope**; returns **false** otherwise.| | boolean | Returns **true** if the value is within this **Scope**; returns **false** otherwise.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1380,17 +1381,17 @@ Checks whether a range is within this **Scope**. ...@@ -1380,17 +1381,17 @@ Checks whether a range is within this **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| range | [Scope](#scope8) | Yes| **Scope** specified.| | range | [Scope](#scope8) | Yes| **Scope** specified.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the range is within this **Scope**; returns **false** otherwise.| | boolean | Returns **true** if the range is within this **Scope**; returns **false** otherwise.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1410,17 +1411,17 @@ Limits a value to this **Scope**. ...@@ -1410,17 +1411,17 @@ Limits a value to this **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | [ScopeType](#scopetype8) | Yes| Value specified.| | value | [ScopeType](#scopetype8) | Yes| Value specified.|
**Return value** **Return value**
| Type| Description| | 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**.| | [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** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1441,7 +1442,7 @@ A constructor used to create a **Base64** object. ...@@ -1441,7 +1442,7 @@ A constructor used to create a **Base64** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Example** **Example**
``` ```js
var base64 = new util.Base64(); var base64 = new util.Base64();
``` ```
...@@ -1455,17 +1456,17 @@ Encodes the input content. ...@@ -1455,17 +1456,17 @@ Encodes the input content.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | Yes| Uint8Array to encode.| | src | Uint8Array | Yes| Uint8Array to encode.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Uint8Array | Uint8Array encoded.| | Uint8Array | Uint8Array encoded.|
**Example** **Example**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
var result = that.encodeSync(array); var result = that.encodeSync(array);
...@@ -1481,17 +1482,17 @@ Encodes the input content. ...@@ -1481,17 +1482,17 @@ Encodes the input content.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | Yes| Uint8Array to encode.| | src | Uint8Array | Yes| Uint8Array to encode.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | String encoded from the Uint8Array.| | string | String encoded from the Uint8Array.|
**Example** **Example**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
var result = that.encodeToStringSync(array); var result = that.encodeToStringSync(array);
...@@ -1507,17 +1508,17 @@ Decodes the input content. ...@@ -1507,17 +1508,17 @@ Decodes the input content.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array&nbsp;\|&nbsp;string | Yes| Uint8Array or string to decode.| | src | Uint8Array&nbsp;\|&nbsp;string | Yes| Uint8Array or string to decode.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Uint8Array | Uint8Array decoded.| | Uint8Array | Uint8Array decoded.|
**Example** **Example**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var buff = 'czEz'; var buff = 'czEz';
var result = that.decodeSync(buff); var result = that.decodeSync(buff);
...@@ -1533,17 +1534,17 @@ Encodes the input content asynchronously. ...@@ -1533,17 +1534,17 @@ Encodes the input content asynchronously.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | Yes| Uint8Array to encode asynchronously.| | src | Uint8Array | Yes| Uint8Array to encode asynchronously.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;Uint8Array&gt; | Uint8Array obtained after asynchronous encoding.| | Promise&lt;Uint8Array&gt; | Uint8Array obtained after asynchronous encoding.|
**Example** **Example**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
var rarray = new Uint8Array([99,122,69,122]); var rarray = new Uint8Array([99,122,69,122]);
...@@ -1564,17 +1565,17 @@ Encodes the input content asynchronously. ...@@ -1564,17 +1565,17 @@ Encodes the input content asynchronously.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | Yes| Uint8Array to encode asynchronously.| | src | Uint8Array | Yes| Uint8Array to encode asynchronously.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;string&gt; | String obtained after asynchronous encoding.| | Promise&lt;string&gt; | String obtained after asynchronous encoding.|
**Example** **Example**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
that.encodeToString(array).then(val=>{ that.encodeToString(array).then(val=>{
...@@ -1592,17 +1593,17 @@ Decodes the input content asynchronously. ...@@ -1592,17 +1593,17 @@ Decodes the input content asynchronously.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array&nbsp;\|&nbsp;string | Yes| Uint8Array or string to decode asynchronously.| | src | Uint8Array&nbsp;\|&nbsp;string | Yes| Uint8Array or string to decode asynchronously.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;Uint8Array&gt; | Uint8Array obtained after asynchronous decoding.| | Promise&lt;Uint8Array&gt; | Uint8Array obtained after asynchronous decoding.|
**Example** **Example**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([99,122,69,122]); var array = new Uint8Array([99,122,69,122]);
var rarray = new Uint8Array([115,49,51]); var rarray = new Uint8Array([115,49,51]);
...@@ -1626,7 +1627,7 @@ A constructor used to create a **types** object. ...@@ -1626,7 +1627,7 @@ A constructor used to create a **types** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Example** **Example**
``` ```js
var type = new util.types(); var type = new util.types();
``` ```
...@@ -1640,17 +1641,17 @@ Checks whether the input value is of the **ArrayBuffer** type. ...@@ -1640,17 +1641,17 @@ Checks whether the input value is of the **ArrayBuffer** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **ArrayBuffer** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **ArrayBuffer** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isAnyArrayBuffer(new ArrayBuffer([])); var result = that.isAnyArrayBuffer(new ArrayBuffer([]));
``` ```
...@@ -1667,17 +1668,17 @@ Checks whether the input value is of the **ArrayBufferView** type. ...@@ -1667,17 +1668,17 @@ Checks whether the input value is of the **ArrayBufferView** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **ArrayBufferView** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **ArrayBufferView** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isArrayBufferView(new Int8Array([])); var result = that.isArrayBufferView(new Int8Array([]));
``` ```
...@@ -1692,17 +1693,17 @@ Checks whether the input value is of the **arguments** type. ...@@ -1692,17 +1693,17 @@ Checks whether the input value is of the **arguments** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **arguments** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **arguments** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
function foo() { function foo() {
var result = that.isArgumentsObject(arguments); var result = that.isArgumentsObject(arguments);
...@@ -1720,17 +1721,17 @@ Checks whether the input value is of the **ArrayBuffer** type. ...@@ -1720,17 +1721,17 @@ Checks whether the input value is of the **ArrayBuffer** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **ArrayBuffer** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **ArrayBuffer** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isArrayBuffer(new ArrayBuffer([])); var result = that.isArrayBuffer(new ArrayBuffer([]));
``` ```
...@@ -1745,17 +1746,17 @@ Checks whether the input value is an asynchronous function. ...@@ -1745,17 +1746,17 @@ Checks whether the input value is an asynchronous function.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is an asynchronous function; returns **false** otherwise.| | boolean | Returns **true** if the input value is an asynchronous function; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isAsyncFunction(async function foo() {}); var result = that.isAsyncFunction(async function foo() {});
``` ```
...@@ -1770,17 +1771,17 @@ Checks whether the input value is of the **Boolean** type. ...@@ -1770,17 +1771,17 @@ Checks whether the input value is of the **Boolean** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Boolean** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Boolean** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isBooleanObject(new Boolean(true)); var result = that.isBooleanObject(new Boolean(true));
``` ```
...@@ -1795,17 +1796,17 @@ Checks whether the input value is of the **Boolean**, **Number**, **String**, or ...@@ -1795,17 +1796,17 @@ Checks whether the input value is of the **Boolean**, **Number**, **String**, or
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Boolean**, **Number**, **String**, or **Symbol** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Boolean**, **Number**, **String**, or **Symbol** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isBoxedPrimitive(new Boolean(false)); var result = that.isBoxedPrimitive(new Boolean(false));
``` ```
...@@ -1820,17 +1821,17 @@ Checks whether the input value is of the **DataView** type. ...@@ -1820,17 +1821,17 @@ Checks whether the input value is of the **DataView** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **DataView** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **DataView** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
const ab = new ArrayBuffer(20); const ab = new ArrayBuffer(20);
var result = that.isDataView(new DataView(ab)); var result = that.isDataView(new DataView(ab));
...@@ -1846,17 +1847,17 @@ Checks whether the input value is of the **Date** type. ...@@ -1846,17 +1847,17 @@ Checks whether the input value is of the **Date** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Date** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Date** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isDate(new Date()); var result = that.isDate(new Date());
``` ```
...@@ -1871,17 +1872,17 @@ Checks whether the input value is of the **native external** type. ...@@ -1871,17 +1872,17 @@ Checks whether the input value is of the **native external** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **native external** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **native external** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
const data = util.createExternalType(); const data = util.createExternalType();
var result = that.isExternal(data); var result = that.isExternal(data);
...@@ -1897,17 +1898,17 @@ Checks whether the input value is of the **Float32Array** type. ...@@ -1897,17 +1898,17 @@ Checks whether the input value is of the **Float32Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Float32Array** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Float32Array** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isFloat32Array(new Float32Array()); var result = that.isFloat32Array(new Float32Array());
``` ```
...@@ -1922,17 +1923,17 @@ Checks whether the input value is of the **Float64Array** type. ...@@ -1922,17 +1923,17 @@ Checks whether the input value is of the **Float64Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Float64Array** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Float64Array** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isFloat64Array(new Float64Array()); var result = that.isFloat64Array(new Float64Array());
``` ```
...@@ -1947,17 +1948,17 @@ Checks whether the input value is a generator function. ...@@ -1947,17 +1948,17 @@ Checks whether the input value is a generator function.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a generator function; returns **false** otherwise.| | boolean | Returns **true** if the input value is a generator function; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isGeneratorFunction(function* foo() {}); var result = that.isGeneratorFunction(function* foo() {});
``` ```
...@@ -1972,17 +1973,17 @@ Checks whether the input value is a generator object. ...@@ -1972,17 +1973,17 @@ Checks whether the input value is a generator object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a generator object; returns **false** otherwise.| | boolean | Returns **true** if the input value is a generator object; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
function* foo() {} function* foo() {}
const generator = foo(); const generator = foo();
...@@ -1999,17 +2000,17 @@ Checks whether the input value is of the **Int8Array** type. ...@@ -1999,17 +2000,17 @@ Checks whether the input value is of the **Int8Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Int8Array** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Int8Array** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isInt8Array(new Int8Array([])); var result = that.isInt8Array(new Int8Array([]));
``` ```
...@@ -2024,17 +2025,17 @@ Checks whether the input value is of the **Int16Array** type. ...@@ -2024,17 +2025,17 @@ Checks whether the input value is of the **Int16Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Int16Array** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Int16Array** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isInt16Array(new Int16Array([])); var result = that.isInt16Array(new Int16Array([]));
``` ```
...@@ -2049,17 +2050,17 @@ Checks whether the input value is of the **Int32Array** type. ...@@ -2049,17 +2050,17 @@ Checks whether the input value is of the **Int32Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Int32Array** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Int32Array** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isInt32Array(new Int32Array([])); var result = that.isInt32Array(new Int32Array([]));
``` ```
...@@ -2074,17 +2075,17 @@ Checks whether the input value is of the **Map** type. ...@@ -2074,17 +2075,17 @@ Checks whether the input value is of the **Map** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Map** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Map** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isMap(new Map()); var result = that.isMap(new Map());
``` ```
...@@ -2099,17 +2100,17 @@ Checks whether the input value is of the **MapIterator** type. ...@@ -2099,17 +2100,17 @@ Checks whether the input value is of the **MapIterator** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **MapIterator** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **MapIterator** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
const map = new Map(); const map = new Map();
var result = that.isMapIterator(map.keys()); var result = that.isMapIterator(map.keys());
...@@ -2125,17 +2126,17 @@ Checks whether the input value is of the **Error** type. ...@@ -2125,17 +2126,17 @@ Checks whether the input value is of the **Error** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Error** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Error** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isNativeError(new TypeError()); var result = that.isNativeError(new TypeError());
``` ```
...@@ -2150,17 +2151,17 @@ Checks whether the input value is a number object. ...@@ -2150,17 +2151,17 @@ Checks whether the input value is a number object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a number object; returns **false** otherwise.| | boolean | Returns **true** if the input value is a number object; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isNumberObject(new Number(0)); var result = that.isNumberObject(new Number(0));
``` ```
...@@ -2175,17 +2176,17 @@ Checks whether the input value is a promise. ...@@ -2175,17 +2176,17 @@ Checks whether the input value is a promise.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a promise; returns **false** otherwise.| | boolean | Returns **true** if the input value is a promise; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isPromise(Promise.resolve(1)); var result = that.isPromise(Promise.resolve(1));
``` ```
...@@ -2200,17 +2201,17 @@ Checks whether the input value is a proxy. ...@@ -2200,17 +2201,17 @@ Checks whether the input value is a proxy.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a proxy; returns **false** otherwise.| | boolean | Returns **true** if the input value is a proxy; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
const target = {}; const target = {};
const proxy = new Proxy(target, {}); const proxy = new Proxy(target, {});
...@@ -2227,17 +2228,17 @@ Checks whether the input value is of the **RegExp** type. ...@@ -2227,17 +2228,17 @@ Checks whether the input value is of the **RegExp** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **RegExp** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **RegExp** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isRegExp(new RegExp('abc')); var result = that.isRegExp(new RegExp('abc'));
``` ```
...@@ -2252,17 +2253,17 @@ Checks whether the input value is of the **Set** type. ...@@ -2252,17 +2253,17 @@ Checks whether the input value is of the **Set** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Set** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Set** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isSet(new Set()); var result = that.isSet(new Set());
``` ```
...@@ -2277,17 +2278,17 @@ Checks whether the input value is of the **SetIterator** type. ...@@ -2277,17 +2278,17 @@ Checks whether the input value is of the **SetIterator** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **SetIterator** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **SetIterator** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
const set = new Set(); const set = new Set();
var result = that.isSetIterator(set.keys()); var result = that.isSetIterator(set.keys());
...@@ -2303,17 +2304,17 @@ Checks whether the input value is a string object. ...@@ -2303,17 +2304,17 @@ Checks whether the input value is a string object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a string object; returns **false** otherwise.| | boolean | Returns **true** if the input value is a string object; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isStringObject(new String('foo')); var result = that.isStringObject(new String('foo'));
``` ```
...@@ -2328,17 +2329,17 @@ Checks whether the input value is a symbol object. ...@@ -2328,17 +2329,17 @@ Checks whether the input value is a symbol object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a symbol object; returns **false** otherwise.| | boolean | Returns **true** if the input value is a symbol object; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
const symbols = Symbol('foo'); const symbols = Symbol('foo');
var result = that.isSymbolObject(Object(symbols)); var result = that.isSymbolObject(Object(symbols));
...@@ -2356,17 +2357,17 @@ Checks whether the input value is of the **TypedArray** type. ...@@ -2356,17 +2357,17 @@ Checks whether the input value is of the **TypedArray** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **TypedArray** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **TypedArray** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isTypedArray(new Float64Array([])); var result = that.isTypedArray(new Float64Array([]));
``` ```
...@@ -2381,17 +2382,17 @@ Checks whether the input value is of the **Uint8Array** type. ...@@ -2381,17 +2382,17 @@ Checks whether the input value is of the **Uint8Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Uint8Array** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Uint8Array** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isUint8Array(new Uint8Array([])); var result = that.isUint8Array(new Uint8Array([]));
``` ```
...@@ -2406,17 +2407,17 @@ Checks whether the input value is of the **Uint8ClampedArray** type. ...@@ -2406,17 +2407,17 @@ Checks whether the input value is of the **Uint8ClampedArray** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Uint8ClampedArray** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Uint8ClampedArray** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isUint8ClampedArray(new Uint8ClampedArray([])); var result = that.isUint8ClampedArray(new Uint8ClampedArray([]));
``` ```
...@@ -2431,17 +2432,17 @@ Checks whether the input value is of the **Uint16Array** type. ...@@ -2431,17 +2432,17 @@ Checks whether the input value is of the **Uint16Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Uint16Array** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Uint16Array** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isUint16Array(new Uint16Array([])); var result = that.isUint16Array(new Uint16Array([]));
``` ```
...@@ -2456,17 +2457,17 @@ Checks whether the input value is of the **Uint32Array** type. ...@@ -2456,17 +2457,17 @@ Checks whether the input value is of the **Uint32Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Uint32Array** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Uint32Array** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isUint32Array(new Uint32Array([])); var result = that.isUint32Array(new Uint32Array([]));
``` ```
...@@ -2481,17 +2482,17 @@ Checks whether the input value is of the **WeakMap** type. ...@@ -2481,17 +2482,17 @@ Checks whether the input value is of the **WeakMap** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **WeakMap** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **WeakMap** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isWeakMap(new WeakMap()); var result = that.isWeakMap(new WeakMap());
``` ```
...@@ -2506,17 +2507,17 @@ Checks whether the input value is of the **WeakSet** type. ...@@ -2506,17 +2507,17 @@ Checks whether the input value is of the **WeakSet** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **WeakSet** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **WeakSet** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isWeakSet(new WeakSet()); var result = that.isWeakSet(new WeakSet());
``` ```
...@@ -32,7 +32,7 @@ A constructor used to create an **XmlSerializer** instance. ...@@ -32,7 +32,7 @@ A constructor used to create an **XmlSerializer** instance.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var bufView = new DataView(arrayBuffer); var bufView = new DataView(arrayBuffer);
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
...@@ -54,7 +54,7 @@ Sets an attribute. ...@@ -54,7 +54,7 @@ Sets an attribute.
**Example** **Example**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setAttributes("importance", "high"); thatSer.setAttributes("importance", "high");
``` ```
...@@ -74,8 +74,8 @@ Adds an empty element. ...@@ -74,8 +74,8 @@ Adds an empty element.
**Example** **Example**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.addEmptyElement("b"); // => <b/> thatSer.addEmptyElement("b"); // => <b/>
``` ```
...@@ -88,7 +88,7 @@ Sets a declaration. ...@@ -88,7 +88,7 @@ Sets a declaration.
**Example** **Example**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setDeclaration() // => <?xml version="1.0" encoding="utf-8"?>; thatSer.setDeclaration() // => <?xml version="1.0" encoding="utf-8"?>;
``` ```
...@@ -108,7 +108,7 @@ Writes the start tag based on the given element name. ...@@ -108,7 +108,7 @@ Writes the start tag based on the given element name.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("notel"); thatSer.startElement("notel");
...@@ -124,7 +124,7 @@ Writes the end tag of the element. ...@@ -124,7 +124,7 @@ Writes the end tag of the element.
**Example** **Example**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setNamespace("h", "http://www.w3.org/TR/html4/"); thatSer.setNamespace("h", "http://www.w3.org/TR/html4/");
thatSer.startElement("table"); thatSer.startElement("table");
...@@ -149,7 +149,7 @@ Sets the namespace for an element tag. ...@@ -149,7 +149,7 @@ Sets the namespace for an element tag.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setDeclaration(); thatSer.setDeclaration();
...@@ -172,7 +172,7 @@ Sets the comment. ...@@ -172,7 +172,7 @@ Sets the comment.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
...@@ -195,7 +195,7 @@ Sets CDATA attributes. ...@@ -195,7 +195,7 @@ Sets CDATA attributes.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1028); var arrayBuffer = new ArrayBuffer(1028);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setCDATA('root SYSTEM') // => '<![CDATA[root SYSTEM]]>'; thatSer.setCDATA('root SYSTEM') // => '<![CDATA[root SYSTEM]]>';
...@@ -216,7 +216,7 @@ Sets **Text**. ...@@ -216,7 +216,7 @@ Sets **Text**.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
...@@ -240,7 +240,7 @@ Sets **DocType**. ...@@ -240,7 +240,7 @@ Sets **DocType**.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setDocType('root SYSTEM'); // => '<!DOCTYPE root SYSTEM>'; thatSer.setDocType('root SYSTEM'); // => '<!DOCTYPE root SYSTEM>';
...@@ -265,7 +265,7 @@ Creates and returns an **XmlPullParser** object. The **XmlPullParser** object pa ...@@ -265,7 +265,7 @@ Creates and returns an **XmlPullParser** object. The **XmlPullParser** object pa
**Example** **Example**
``` ```js
var strXml = var strXml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
...@@ -297,7 +297,7 @@ Parses XML information. ...@@ -297,7 +297,7 @@ Parses XML information.
**Example** **Example**
``` ```js
var strXml = var strXml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
......
...@@ -39,7 +39,7 @@ convert(xml: string, options?: ConvertOptions) : Object ...@@ -39,7 +39,7 @@ convert(xml: string, options?: ConvertOptions) : Object
- 示例: - 示例:
``` ```js
let xml = let xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
......
...@@ -60,7 +60,7 @@ wait(): Promise&lt;number&gt; ...@@ -60,7 +60,7 @@ wait(): Promise&lt;number&gt;
**示例:** **示例:**
``` ```js
var child = process.runCmd('ls'); var child = process.runCmd('ls');
var result = child.wait(); var result = child.wait();
result.then(val=>{ result.then(val=>{
...@@ -85,7 +85,7 @@ getOutput(): Promise&lt;Uint8Array&gt; ...@@ -85,7 +85,7 @@ getOutput(): Promise&lt;Uint8Array&gt;
**示例:** **示例:**
``` ```js
var child = process.runCmd('ls'); var child = process.runCmd('ls');
var result = child.wait(); var result = child.wait();
child.getOutput.then(val=>{ child.getOutput.then(val=>{
...@@ -110,7 +110,7 @@ getErrorOutput(): Promise&lt;Uint8Array&gt; ...@@ -110,7 +110,7 @@ getErrorOutput(): Promise&lt;Uint8Array&gt;
**示例:** **示例:**
``` ```js
var child = process.runCmd('madir test.text'); var child = process.runCmd('madir test.text');
var result = child.wait(); var result = child.wait();
child.getErrorOutput.then(val=>{ child.getErrorOutput.then(val=>{
...@@ -129,7 +129,7 @@ close(): void ...@@ -129,7 +129,7 @@ close(): void
**示例:** **示例:**
``` ```js
var child = process.runCmd('sleep 5; ls'); var child = process.runCmd('sleep 5; ls');
child.close(); child.close();
``` ```
...@@ -151,7 +151,7 @@ kill(signal: number | string): void ...@@ -151,7 +151,7 @@ kill(signal: number | string): void
**示例:** **示例:**
``` ```js
var child = process.runCmd('sleep 5; ls'); var child = process.runCmd('sleep 5; ls');
child.kill(9); child.kill(9);
``` ```
...@@ -173,7 +173,7 @@ isIsolatedProcess(): boolean ...@@ -173,7 +173,7 @@ isIsolatedProcess(): boolean
**示例:** **示例:**
``` ```js
var result = process.isIsolatedProcess(); var result = process.isIsolatedProcess();
``` ```
...@@ -200,7 +200,7 @@ isAppUid(v: number): boolean ...@@ -200,7 +200,7 @@ isAppUid(v: number): boolean
**示例:** **示例:**
``` ```js
var result = process.isAppUid(688); var result = process.isAppUid(688);
``` ```
...@@ -221,7 +221,7 @@ is64Bit(): boolean ...@@ -221,7 +221,7 @@ is64Bit(): boolean
**示例:** **示例:**
``` ```js
var ressult = process.is64Bit(); var ressult = process.is64Bit();
``` ```
...@@ -248,7 +248,7 @@ getUidForName(v: string): number ...@@ -248,7 +248,7 @@ getUidForName(v: string): number
**示例:** **示例:**
``` ```js
var pres = process.getUidForName("tool") var pres = process.getUidForName("tool")
``` ```
...@@ -275,7 +275,7 @@ getThreadPriority(v: number): number ...@@ -275,7 +275,7 @@ getThreadPriority(v: number): number
**示例:** **示例:**
``` ```js
var tid = process.getTid(); var tid = process.getTid();
var pres = process.getThreadPriority(tid); var pres = process.getThreadPriority(tid);
``` ```
...@@ -297,7 +297,7 @@ getStartRealtime(): number ...@@ -297,7 +297,7 @@ getStartRealtime(): number
**示例:** **示例:**
``` ```js
var realtime = process.getStartRealtime(); var realtime = process.getStartRealtime();
``` ```
...@@ -317,7 +317,7 @@ getPastCpuTime(): number ...@@ -317,7 +317,7 @@ getPastCpuTime(): number
**示例:** **示例:**
``` ```js
var result = process.getPastCpuTime() ; var result = process.getPastCpuTime() ;
``` ```
...@@ -344,7 +344,7 @@ getSystemConfig(name: number): number ...@@ -344,7 +344,7 @@ getSystemConfig(name: number): number
**示例:** **示例:**
``` ```js
var _SC_ARG_MAX = 0 var _SC_ARG_MAX = 0
var pres = process.getSystemConfig(_SC_ARG_MAX) var pres = process.getSystemConfig(_SC_ARG_MAX)
``` ```
...@@ -372,7 +372,7 @@ getEnvironmentVar(name: string): string ...@@ -372,7 +372,7 @@ getEnvironmentVar(name: string): string
**示例:** **示例:**
``` ```js
var pres = process.getEnvironmentVar("PATH") var pres = process.getEnvironmentVar("PATH")
``` ```
...@@ -408,7 +408,7 @@ runCmd(command: string, options?: { timeout : number, killSignal : number | stri ...@@ -408,7 +408,7 @@ runCmd(command: string, options?: { timeout : number, killSignal : number | stri
**示例:** **示例:**
``` ```js
var child = process.runCmd('ls', { maxBuffer : 2 }); var child = process.runCmd('ls', { maxBuffer : 2 });
var result = child.wait(); var result = child.wait();
child.getOutput.then(val=>{ child.getOutput.then(val=>{
...@@ -427,7 +427,7 @@ abort(): void ...@@ -427,7 +427,7 @@ abort(): void
**示例:** **示例:**
``` ```js
process.abort(); process.abort();
``` ```
...@@ -455,7 +455,7 @@ on(type: string, listener: EventListener): void ...@@ -455,7 +455,7 @@ on(type: string, listener: EventListener): void
**示例:** **示例:**
``` ```js
process.on("data", (e)=>{ process.on("data", (e)=>{
console.log("data callback"); console.log("data callback");
}) })
...@@ -484,7 +484,7 @@ off(type: string): boolean ...@@ -484,7 +484,7 @@ off(type: string): boolean
**示例:** **示例:**
``` ```js
process.on("data", (e)=>{ process.on("data", (e)=>{
console.log("data callback"); console.log("data callback");
}) })
...@@ -510,7 +510,7 @@ exit(code: number): void ...@@ -510,7 +510,7 @@ exit(code: number): void
**示例:** **示例:**
``` ```js
process.exit(0); process.exit(0);
``` ```
...@@ -525,7 +525,7 @@ cwd(): string ...@@ -525,7 +525,7 @@ cwd(): string
**示例:** **示例:**
``` ```js
var path = process.cwd(); var path = process.cwd();
``` ```
...@@ -546,7 +546,7 @@ chdir(dir: string): void ...@@ -546,7 +546,7 @@ chdir(dir: string): void
**示例:** **示例:**
``` ```js
process.chdir('/system'); process.chdir('/system');
``` ```
...@@ -567,7 +567,7 @@ uptime(): number ...@@ -567,7 +567,7 @@ uptime(): number
**示例:** **示例:**
``` ```js
var time = process.uptime(); var time = process.uptime();
``` ```
...@@ -594,7 +594,8 @@ kill(signal: number, pid: number): boolean ...@@ -594,7 +594,8 @@ kill(signal: number, pid: number): boolean
| boolean | 信号是否发送成功。 | | boolean | 信号是否发送成功。 |
**示例:** **示例:**
```
```js
var pres = process.pid var pres = process.pid
var result = that.kill(pres, 28) var result = that.kill(pres, 28)
``` ```
...@@ -46,11 +46,11 @@ constructor是URI的构造函数。 ...@@ -46,11 +46,11 @@ constructor是URI的构造函数。
**示例:** **示例:**
``` ```js
var mm = 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment'; var mm = 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
new uri.URI(mm); // Output 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment'; new uri.URI(mm); // Output 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
``` ```
``` ```js
new uri.URI('http://username:password@host:8080'); // Output 'http://username:password@host:8080'; new uri.URI('http://username:password@host:8080'); // Output 'http://username:password@host:8080';
``` ```
...@@ -69,7 +69,7 @@ toString(): string ...@@ -69,7 +69,7 @@ toString(): string
**示例:** **示例:**
``` ```js
const url = new uri.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new uri.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toString() url.toString()
``` ```
...@@ -95,7 +95,7 @@ equals(other: URI): boolean ...@@ -95,7 +95,7 @@ equals(other: URI): boolean
**示例:** **示例:**
``` ```js
const uriInstance = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const uriInstance = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
const uriInstance1 = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment'); const uriInstance1 = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment');
uriInstance.equals(uriInstance1); uriInstance.equals(uriInstance1);
...@@ -115,7 +115,7 @@ checkIsAbsolute(): boolean ...@@ -115,7 +115,7 @@ checkIsAbsolute(): boolean
**示例:** **示例:**
``` ```js
const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080?query=pppppp'); const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080?query=pppppp');
uriInstance.checkIsAbsolute(); uriInstance.checkIsAbsolute();
``` ```
...@@ -134,7 +134,7 @@ normalize(): URI ...@@ -134,7 +134,7 @@ normalize(): URI
| URI | 返回一个path被规范化后的URI对象。 | | URI | 返回一个path被规范化后的URI对象。 |
**示例:** **示例:**
``` ```js
const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp'); const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp');
let uriInstance1 = uriInstance.normalize(); let uriInstance1 = uriInstance.normalize();
uriInstance1.path; uriInstance1.path;
......
...@@ -31,7 +31,7 @@ URLSearchParams的构造函数。 ...@@ -31,7 +31,7 @@ URLSearchParams的构造函数。
**示例:** **示例:**
``` ```js
var objectParams = new URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]); var objectParams = new URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]);
var objectParams1 = new URLSearchParams({"fod" : 1 , "bard" : 2}); var objectParams1 = new URLSearchParams({"fod" : 1 , "bard" : 2});
var objectParams2 = new URLSearchParams('?fod=1&bard=2'); var objectParams2 = new URLSearchParams('?fod=1&bard=2');
...@@ -55,7 +55,7 @@ append(name: string, value: string): void ...@@ -55,7 +55,7 @@ append(name: string, value: string): void
**示例:** **示例:**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.append('fod', 3); paramsObject.append('fod', 3);
...@@ -76,7 +76,7 @@ delete(name: string): void ...@@ -76,7 +76,7 @@ delete(name: string): void
**示例:** **示例:**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsobject = new URLSearchParams(urlObject.search.slice(1)); let paramsobject = new URLSearchParams(urlObject.search.slice(1));
paramsobject.delete('fod'); paramsobject.delete('fod');
...@@ -103,7 +103,7 @@ getAll(name: string): string[] ...@@ -103,7 +103,7 @@ getAll(name: string): string[]
**示例:** **示例:**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.append('fod', 3); // Add a second value for the fod parameter. paramsObject.append('fod', 3); // Add a second value for the fod parameter.
...@@ -125,7 +125,7 @@ entries(): IterableIterator<[string, string]> ...@@ -125,7 +125,7 @@ entries(): IterableIterator<[string, string]>
**示例:** **示例:**
``` ```js
var searchParamsObject = new URLSearchParams("keyName1=valueName1&keyName2=valueName2"); var searchParamsObject = new URLSearchParams("keyName1=valueName1&keyName2=valueName2");
for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pairs for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pairs
console.log(pair[0]+ ', '+ pair[1]); console.log(pair[0]+ ', '+ pair[1]);
...@@ -156,7 +156,7 @@ forEach(callbackfn: (value: string, key: string, searchParams: this) => void, th ...@@ -156,7 +156,7 @@ forEach(callbackfn: (value: string, key: string, searchParams: this) => void, th
**示例:** **示例:**
``` ```js
const myURLObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); const myURLObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
myURLObject.searchParams.forEach((value, name, searchParams) => { myURLObject.searchParams.forEach((value, name, searchParams) => {
console.log(name, value, myURLObject.searchParams === searchParams); console.log(name, value, myURLObject.searchParams === searchParams);
...@@ -185,7 +185,7 @@ get(name: string): string | null ...@@ -185,7 +185,7 @@ get(name: string): string | null
**示例:** **示例:**
``` ```js
var paramsOject = new URLSearchParams(document.location.search.substring(1)); var paramsOject = new URLSearchParams(document.location.search.substring(1));
var name = paramsOject.get("name"); // is the string "Jonathan" var name = paramsOject.get("name"); // is the string "Jonathan"
var age = parseInt(paramsOject.get("age"), 10); // is the number 18 var age = parseInt(paramsOject.get("age"), 10); // is the number 18
...@@ -213,7 +213,7 @@ has(name: string): boolean ...@@ -213,7 +213,7 @@ has(name: string): boolean
**示例:** **示例:**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.has('bard') === true; paramsObject.has('bard') === true;
...@@ -235,7 +235,7 @@ set(name: string, value: string): void ...@@ -235,7 +235,7 @@ set(name: string, value: string): void
**示例:** **示例:**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.set('baz', 3); // Add a third parameter. paramsObject.set('baz', 3); // Add a third parameter.
...@@ -251,7 +251,7 @@ sort(): void ...@@ -251,7 +251,7 @@ sort(): void
**示例:** **示例:**
``` ```js
var searchParamsObject = new URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object var searchParamsObject = new URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object
searchParamsObject.sort(); // Sort the key/value pairs 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 console.log(searchParamsObject.toString()); // Display the sorted query string // Output a=9&b=2&c=3&d=4
...@@ -273,7 +273,7 @@ keys(): IterableIterator&lt;string&gt; ...@@ -273,7 +273,7 @@ keys(): IterableIterator&lt;string&gt;
**示例:** **示例:**
``` ```js
var searchParamsObject = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing var searchParamsObject = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing
for (var key of searchParamsObject .keys()) { // Output key-value pairs for (var key of searchParamsObject .keys()) { // Output key-value pairs
console.log(key); console.log(key);
...@@ -295,7 +295,7 @@ values(): IterableIterator&lt;string&gt; ...@@ -295,7 +295,7 @@ values(): IterableIterator&lt;string&gt;
**示例:** **示例:**
``` ```js
var searchParams = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing var searchParams = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing
for (var value of searchParams.values()) { for (var value of searchParams.values()) {
console.log(value); console.log(value);
...@@ -318,7 +318,7 @@ for (var value of searchParams.values()) { ...@@ -318,7 +318,7 @@ for (var value of searchParams.values()) {
**示例:** **示例:**
``` ```js
const paramsObject = new URLSearchParams('fod=bay&edg=bap'); const paramsObject = new URLSearchParams('fod=bay&edg=bap');
for (const [name, value] of paramsObject) { for (const [name, value] of paramsObject) {
console.log(name, value); console.log(name, value);
...@@ -341,7 +341,7 @@ toString(): string ...@@ -341,7 +341,7 @@ toString(): string
**示例:** **示例:**
``` ```js
let url = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let url = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let params = new URLSearchParams(url.search.slice(1)); let params = new URLSearchParams(url.search.slice(1));
params.append('fod', 3); params.append('fod', 3);
...@@ -386,7 +386,7 @@ URL的构造函数。 ...@@ -386,7 +386,7 @@ URL的构造函数。
**示例:** **示例:**
``` ```js
var mm = 'http://username:password@host:8080'; var mm = 'http://username:password@host:8080';
var a = new URL("/", mm); // Output '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/'; var b = new URL(mm); // Output 'http://username:password@host:8080/';
...@@ -416,7 +416,7 @@ toString(): string ...@@ -416,7 +416,7 @@ toString(): string
**示例:** **示例:**
``` ```js
const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toString() url.toString()
``` ```
...@@ -436,7 +436,7 @@ toJSON(): string ...@@ -436,7 +436,7 @@ toJSON(): string
| string | 用于返回网址的字符串序列化。 | | string | 用于返回网址的字符串序列化。 |
**示例:** **示例:**
``` ```js
const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toJSON() url.toJSON()
``` ```
...@@ -23,18 +23,18 @@ printf(format: string, ...args: Object[]): string ...@@ -23,18 +23,18 @@ printf(format: string, ...args: Object[]): string
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| format | string | 是 | 式样化字符串。 | | format | string | 是 | 式样化字符串。 |
| ...args | Object[] | 否 | 待式样化数据。 | | ...args | Object[] | 否 | 待式样化数据。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| string | 按特定格式式样化后的字符串。 | | string | 按特定格式式样化后的字符串。 |
**示例:** **示例:**
``` ```js
var res = util.printf("%s", "hello world!"); var res = util.printf("%s", "hello world!");
console.log(res); console.log(res);
``` ```
...@@ -49,17 +49,17 @@ getErrorString(errno: number): string ...@@ -49,17 +49,17 @@ getErrorString(errno: number): string
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| errno | number | 是 | 系统发生错误产生的错误码。 | | errno | number | 是 | 系统发生错误产生的错误码。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| string | 错误码对应的详细信息。 | | string | 错误码对应的详细信息。 |
**示例:** **示例:**
``` ```js
var errnum = 10; // 10:a system error number var errnum = 10; // 10:a system error number
var result = util.getErrorString(errnum); var result = util.getErrorString(errnum);
console.log("result = " + result); console.log("result = " + result);
...@@ -76,17 +76,17 @@ callbackWrapper(original: Function): (err: Object, value: Object )=&gt;void ...@@ -76,17 +76,17 @@ callbackWrapper(original: Function): (err: Object, value: Object )=&gt;void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| original | Function | 是 | 异步函数。 | | original | Function | 是 | 异步函数。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Function | 返回一个第一个参数是拒绝原因(如果&nbsp;Promise&nbsp;已解决,则为&nbsp;null),第二个参数是已解决的回调函数。 | | Function | 返回一个第一个参数是拒绝原因(如果&nbsp;Promise&nbsp;已解决,则为&nbsp;null),第二个参数是已解决的回调函数。 |
**示例:** **示例:**
``` ```js
async function promiseFn() { async function promiseFn() {
return Promise.reject('value'); return Promise.reject('value');
} }
...@@ -107,17 +107,17 @@ promiseWrapper(original: (err: Object, value: Object) =&gt; void): Object ...@@ -107,17 +107,17 @@ promiseWrapper(original: (err: Object, value: Object) =&gt; void): Object
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| original | Function | 是 | 异步函数。 | | original | Function | 是 | 异步函数。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Function | 采用遵循常见的错误优先的回调风格的函数(也就是将&nbsp;(err,&nbsp;value)&nbsp;=&gt;&nbsp;...&nbsp;回调作为最后一个参数),并返回一个返回&nbsp;promise&nbsp;的版本。 | | Function | 采用遵循常见的错误优先的回调风格的函数(也就是将&nbsp;(err,&nbsp;value)&nbsp;=&gt;&nbsp;...&nbsp;回调作为最后一个参数),并返回一个返回&nbsp;promise&nbsp;的版本。 |
**示例:** **示例:**
``` ```js
function aysnFun(str1, str2, callback) { function aysnFun(str1, str2, callback) {
if (typeof str1 === 'string' && typeof str2 === 'string') { if (typeof str1 === 'string' && typeof str2 === 'string') {
callback(null, str1 + str2); callback(null, str1 + str2);
...@@ -154,20 +154,20 @@ TextDecoder的构造函数。 ...@@ -154,20 +154,20 @@ TextDecoder的构造函数。
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| encoding | string | 否 | 编码格式。 | | encoding | string | 否 | 编码格式。 |
| options | Object | 否 | 编码相关选项参数,存在两个属性fatal和ignoreBOM。 | | options | Object | 否 | 编码相关选项参数,存在两个属性fatal和ignoreBOM。 |
**表1** options **表1** options
| 名称 | 参数类型 | 必填 | 说明 | | 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| fatal | boolean | 否 | 是否显示致命错误。 | | fatal | boolean | 否 | 是否显示致命错误。 |
| ignoreBOM | boolean | 否 | 是否忽略BOM标记。 | | ignoreBOM | boolean | 否 | 是否忽略BOM标记。 |
**示例:** **示例:**
``` ```js
var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true}); var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true});
``` ```
...@@ -181,24 +181,24 @@ decode(input: Uint8Array, options?: { stream?: false }): string ...@@ -181,24 +181,24 @@ decode(input: Uint8Array, options?: { stream?: false }): string
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| input | Unit8Array | 是 | 符合格式需要解码的数组。 | | input | Unit8Array | 是 | 符合格式需要解码的数组。 |
| options | Object | 否 | 解码相关选项参数。 | | options | Object | 否 | 解码相关选项参数。 |
**表2** options **表2** options
| 名称 | 参数类型 | 必填 | 说明 | | 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| stream | boolean | 否 | 在随后的decode()调用中是否跟随附加数据块。如果以块的形式处理数据,则设置为true;如果处理最后的数据块或数据未分块,则设置为false。默认为false。 | | stream | boolean | 否 | 在随后的decode()调用中是否跟随附加数据块。如果以块的形式处理数据,则设置为true;如果处理最后的数据块或数据未分块,则设置为false。默认为false。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| string | 解码后的数据。 | | string | 解码后的数据。 |
**示例:** **示例:**
``` ```js
var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true}); var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true});
var result = new Uint8Array(6); var result = new Uint8Array(6);
result[0] = 0xEF; result[0] = 0xEF;
...@@ -236,7 +236,7 @@ TextEncoder的构造函数。 ...@@ -236,7 +236,7 @@ TextEncoder的构造函数。
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**示例:** **示例:**
``` ```js
var textEncoder = new util.TextEncoder(); var textEncoder = new util.TextEncoder();
``` ```
...@@ -250,17 +250,17 @@ encode(input?: string): Uint8Array ...@@ -250,17 +250,17 @@ encode(input?: string): Uint8Array
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| input | string | 是 | 需要编码的字符串。 | | input | string | 是 | 需要编码的字符串。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Uint8Array | 返回编码后的文本。 | | Uint8Array | 返回编码后的文本。 |
**示例:** **示例:**
``` ```js
var textEncoder = new util.TextEncoder(); var textEncoder = new util.TextEncoder();
var result = new Uint8Array(buffer); var result = new Uint8Array(buffer);
result = textEncoder.encode("\uD800¥¥"); result = textEncoder.encode("\uD800¥¥");
...@@ -276,18 +276,18 @@ encodeInto(input: string, dest: Uint8Array, ): { read: number; written: number } ...@@ -276,18 +276,18 @@ encodeInto(input: string, dest: Uint8Array, ): { read: number; written: number }
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| input | string | 是 | 需要编码的字符串。 | | input | string | 是 | 需要编码的字符串。 |
| dest | Uint8Array | 是 | Uint8Array对象实例,用于将生成的UTF-8编码文本放入其中。 | | dest | Uint8Array | 是 | Uint8Array对象实例,用于将生成的UTF-8编码文本放入其中。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Uint8Array | 返回编码后的文本。 | | Uint8Array | 返回编码后的文本。 |
**示例:** **示例:**
``` ```js
var that = new util.TextEncoder(); var that = new util.TextEncoder();
var buffer = new ArrayBuffer(4); var buffer = new ArrayBuffer(4);
this.dest = new Uint8Array(buffer); this.dest = new Uint8Array(buffer);
...@@ -306,13 +306,13 @@ RationalNumber的构造函数。 ...@@ -306,13 +306,13 @@ RationalNumber的构造函数。
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| numerator | number | 是 | 分子,整数类型。 | | numerator | number | 是 | 分子,整数类型。 |
| denominator | number | 是 | 分母,整数类型。 | | denominator | number | 是 | 分母,整数类型。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
``` ```
...@@ -326,17 +326,17 @@ static createRationalFromString​(rationalString: string): RationalNumber​ ...@@ -326,17 +326,17 @@ static createRationalFromString​(rationalString: string): RationalNumber​
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| rationalString | string | 是 | 字符串格式。 | | rationalString | string | 是 | 字符串格式。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| object | 返回有理数类的对象。 | | object | 返回有理数类的对象。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var rational = rationalNumer.creatRationalFromString("3/4"); var rational = rationalNumer.creatRationalFromString("3/4");
``` ```
...@@ -351,17 +351,17 @@ compareTo​(another: RationalNumber): number​ ...@@ -351,17 +351,17 @@ compareTo​(another: RationalNumber): number​
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| another | RationalNumber | 是 | 其他的有理数对象。 | | another | RationalNumber | 是 | 其他的有理数对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 如果两个对象相等,则返回0;如果给定对象小于当前对象,则返回1;如果给定对象大于当前对象,则返回-1。 | | number | 如果两个对象相等,则返回0;如果给定对象小于当前对象,则返回1;如果给定对象大于当前对象,则返回-1。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var rational = rationalNumer.creatRationalFromString("3/4"); var rational = rationalNumer.creatRationalFromString("3/4");
var result = rationalNumber.compareTo(rational); var result = rationalNumber.compareTo(rational);
...@@ -377,12 +377,12 @@ valueOf(): number ...@@ -377,12 +377,12 @@ valueOf(): number
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回整数或者浮点数的值。 | | number | 返回整数或者浮点数的值。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.valueOf(); var result = rationalNumber.valueOf();
``` ```
...@@ -397,17 +397,17 @@ equals​(obj: Object): boolean ...@@ -397,17 +397,17 @@ equals​(obj: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| object | Object | 是 | 其他类型对象。 | | object | Object | 是 | 其他类型对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 如果给定对象与当前对象相同,则返回true;否则返回false。 | | boolean | 如果给定对象与当前对象相同,则返回true;否则返回false。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var rational = rationalNumer.creatRationalFromString("3/4"); var rational = rationalNumer.creatRationalFromString("3/4");
var result = rationalNumber.equals(rational); var result = rationalNumber.equals(rational);
...@@ -423,18 +423,18 @@ static getCommonDivisor​(number1: number,number2: number): number ...@@ -423,18 +423,18 @@ static getCommonDivisor​(number1: number,number2: number): number
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| number1 | number | 是 | 整数类型。 | | number1 | number | 是 | 整数类型。 |
| number2 | number | 是 | 整数类型。 | | number2 | number | 是 | 整数类型。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回两个给定数字的最大公约数。 | | number | 返回两个给定数字的最大公约数。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.getCommonDivisor(4,6); var result = rationalNumber.getCommonDivisor(4,6);
``` ```
...@@ -450,12 +450,12 @@ getNumerator​(): number ...@@ -450,12 +450,12 @@ getNumerator​(): number
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回RationalNumber对象的分子的值。 | | number | 返回RationalNumber对象的分子的值。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.getNumerator(); var result = rationalNumber.getNumerator();
``` ```
...@@ -470,12 +470,12 @@ getDenominator​(): number ...@@ -470,12 +470,12 @@ getDenominator​(): number
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回RationalNumber对象的分母的值。 | | number | 返回RationalNumber对象的分母的值。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.getDenominator(); var result = rationalNumber.getDenominator();
``` ```
...@@ -490,12 +490,12 @@ isZero​():boolean ...@@ -490,12 +490,12 @@ isZero​():boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 如果当前对象表示的值为0,则返回true;否则返回false。 | | boolean | 如果当前对象表示的值为0,则返回true;否则返回false。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.isZero(); var result = rationalNumber.isZero();
``` ```
...@@ -510,12 +510,12 @@ isNaN​(): boolean ...@@ -510,12 +510,12 @@ isNaN​(): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 如果分母和分子都为0,则返回true;否则返回false。 | | boolean | 如果分母和分子都为0,则返回true;否则返回false。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.isNaN(); var result = rationalNumber.isNaN();
``` ```
...@@ -530,12 +530,12 @@ isFinite​():boolean ...@@ -530,12 +530,12 @@ isFinite​():boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 如果分母不为0,则返回true;否则返回false。 | | boolean | 如果分母不为0,则返回true;否则返回false。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.isFinite(); var result = rationalNumber.isFinite();
``` ```
...@@ -550,12 +550,12 @@ toString​(): string ...@@ -550,12 +550,12 @@ toString​(): string
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| string | 返回Numerator/Denominator格式的字符串,例如3/5,如果当前对象的分子和分母都为0,则返回NaN。 | | string | 返回Numerator/Denominator格式的字符串,例如3/5,如果当前对象的分子和分母都为0,则返回NaN。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.toString(); var result = rationalNumber.toString();
``` ```
...@@ -571,7 +571,7 @@ toString​(): string ...@@ -571,7 +571,7 @@ toString​(): string
| length | number | 是 | 否 | 当前缓冲区中值的总数。 | | length | number | 是 | 否 | 当前缓冲区中值的总数。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.put(1,8); pro.put(1,8);
...@@ -588,12 +588,12 @@ constructor(capacity?: number) ...@@ -588,12 +588,12 @@ constructor(capacity?: number)
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| capacity | number | 否 | 指示要为缓冲区自定义的容量。 | | capacity | number | 否 | 指示要为缓冲区自定义的容量。 |
**示例:** **示例:**
``` ```js
var lrubuffer= new util.LruBuffer(); var lrubuffer= new util.LruBuffer();
``` ```
...@@ -607,12 +607,12 @@ updateCapacity(newCapacity: number): void ...@@ -607,12 +607,12 @@ updateCapacity(newCapacity: number): void
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| newCapacity | number | 是 | 指示要为缓冲区自定义的容量。 | | newCapacity | number | 是 | 指示要为缓冲区自定义的容量。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
var result = pro.updateCapacity(100); var result = pro.updateCapacity(100);
``` ```
...@@ -627,12 +627,12 @@ toString(): string ...@@ -627,12 +627,12 @@ toString(): string
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| string | 返回对象的字符串表示形式。 | | string | 返回对象的字符串表示形式。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.get(2); pro.get(2);
...@@ -650,12 +650,12 @@ getCapacity(): number ...@@ -650,12 +650,12 @@ getCapacity(): number
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回当前缓冲区的容量。 | | number | 返回当前缓冲区的容量。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
var result = pro.getCapacity(); var result = pro.getCapacity();
``` ```
...@@ -670,7 +670,7 @@ clear(): void ...@@ -670,7 +670,7 @@ clear(): void
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.size(); var result = pro.size();
...@@ -687,12 +687,12 @@ getCreateCount(): number ...@@ -687,12 +687,12 @@ getCreateCount(): number
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回createDefault()返回值的次数。 | | number | 返回createDefault()返回值的次数。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(1,8); pro.put(1,8);
var result = pro.getCreateCount(); var result = pro.getCreateCount();
...@@ -708,12 +708,12 @@ getMissCount(): number ...@@ -708,12 +708,12 @@ getMissCount(): number
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回查询值不匹配的次数。 | | number | 返回查询值不匹配的次数。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.get(2); pro.get(2);
...@@ -730,12 +730,12 @@ getRemovalCount(): number ...@@ -730,12 +730,12 @@ getRemovalCount(): number
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回从缓冲区中驱逐的次数。 | | number | 返回从缓冲区中驱逐的次数。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.updateCapacity(2); pro.updateCapacity(2);
...@@ -753,12 +753,12 @@ getMatchCount(): number ...@@ -753,12 +753,12 @@ getMatchCount(): number
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回查询值匹配成功的次数。 | | number | 返回查询值匹配成功的次数。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.get(2); pro.get(2);
...@@ -775,12 +775,12 @@ getPutCount(): number ...@@ -775,12 +775,12 @@ getPutCount(): number
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回将值添加到缓冲区的次数。 | | number | 返回将值添加到缓冲区的次数。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.getPutCount(); var result = pro.getPutCount();
...@@ -796,12 +796,12 @@ isEmpty(): boolean ...@@ -796,12 +796,12 @@ isEmpty(): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 如果当前缓冲区不包含任何值,则返回true。 | | boolean | 如果当前缓冲区不包含任何值,则返回true。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.isEmpty(); var result = pro.isEmpty();
...@@ -817,17 +817,17 @@ get(key: K): V | undefined ...@@ -817,17 +817,17 @@ get(key: K): V | undefined
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | 是 | 要查询的键。 | | key | K | 是 | 要查询的键。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| V&nbsp;\|&nbsp;undefind | 如果指定的键存在于缓冲区中,则返回与键关联的值;否则返回undefined。 | | V&nbsp;\|&nbsp;undefind | 如果指定的键存在于缓冲区中,则返回与键关联的值;否则返回undefined。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.get(2); var result = pro.get(2);
...@@ -843,18 +843,18 @@ put(key: K,value: V): V ...@@ -843,18 +843,18 @@ put(key: K,value: V): V
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | 是 | 要添加的密钥。 | | key | K | 是 | 要添加的密钥。 |
| value | V | 是 | 指示与要添加的键关联的值。 | | value | V | 是 | 指示与要添加的键关联的值。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| V | 返回与添加的键关联的值;如果要添加的键已经存在,则返回原始值,如果键或值为空,则抛出此异常。 | | V | 返回与添加的键关联的值;如果要添加的键已经存在,则返回原始值,如果键或值为空,则抛出此异常。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
var result = pro.put(2,10); var result = pro.put(2,10);
``` ```
...@@ -869,12 +869,12 @@ values(): V[] ...@@ -869,12 +869,12 @@ values(): V[]
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| V&nbsp;[] | 按从最近访问到最近最少访问的顺序返回当前缓冲区中所有值的列表。 | | V&nbsp;[] | 按从最近访问到最近最少访问的顺序返回当前缓冲区中所有值的列表。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.put(2,"anhu"); pro.put(2,"anhu");
...@@ -892,12 +892,12 @@ keys(): K[] ...@@ -892,12 +892,12 @@ keys(): K[]
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| K&nbsp;[] | 按升序返回当前缓冲区中所有键的列表,从最近访问到最近最少访问。 | | K&nbsp;[] | 按升序返回当前缓冲区中所有键的列表,从最近访问到最近最少访问。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.keys(); var result = pro.keys();
...@@ -913,17 +913,17 @@ remove(key: K): V | undefined ...@@ -913,17 +913,17 @@ remove(key: K): V | undefined
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | 是 | 要删除的密钥。 | | key | K | 是 | 要删除的密钥。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| V&nbsp;\|&nbsp;undefind | 返回一个包含已删除键值对的Optional对象;如果key不存在,则返回一个空的Optional对象,如果key为null,则抛出异常。 | | V&nbsp;\|&nbsp;undefind | 返回一个包含已删除键值对的Optional对象;如果key不存在,则返回一个空的Optional对象,如果key为null,则抛出异常。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.remove(20); var result = pro.remove(20);
...@@ -939,15 +939,15 @@ afterRemoval(isEvict: boolean,key: K,value: V,newValue: V): void ...@@ -939,15 +939,15 @@ afterRemoval(isEvict: boolean,key: K,value: V,newValue: V): void
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| isEvict | boolean | 否 | 因容量不足而调用该方法时,参数值为true,其他情况为false。 | | isEvict | boolean | 否 | 因容量不足而调用该方法时,参数值为true,其他情况为false。 |
| key | K | 是 | 表示删除的键。 | | key | K | 是 | 表示删除的键。 |
| value | V | 是 | 表示删除的值。 | | value | V | 是 | 表示删除的值。 |
| newValue | V | 否 | 如果已调用put方法并且要添加的键已经存在,则参数值是关联的新值。其他情况下参数值为空。 | | newValue | V | 否 | 如果已调用put方法并且要添加的键已经存在,则参数值是关联的新值。其他情况下参数值为空。 |
**示例:** **示例:**
``` ```js
var arr = []; var arr = [];
class ChildLruBuffer extends util.LruBuffer class ChildLruBuffer extends util.LruBuffer
{ {
...@@ -984,17 +984,17 @@ contains(key: K): boolean ...@@ -984,17 +984,17 @@ contains(key: K): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | 是 | 表示要检查的键。 | | key | K | 是 | 表示要检查的键。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 如果缓冲区包含指定的键,则返回&nbsp;true。 | | boolean | 如果缓冲区包含指定的键,则返回&nbsp;true。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.contains(20); var result = pro.contains(20);
...@@ -1010,17 +1010,17 @@ createDefault(key: K): V ...@@ -1010,17 +1010,17 @@ createDefault(key: K): V
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | 是 | 表示丢失的键。 | | key | K | 是 | 表示丢失的键。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| V | 返回与键关联的值。 | | V | 返回与键关联的值。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
var result = pro.createDefault(50); var result = pro.createDefault(50);
``` ```
...@@ -1035,12 +1035,12 @@ entries(): IterableIterator&lt;[K,V]&gt; ...@@ -1035,12 +1035,12 @@ entries(): IterableIterator&lt;[K,V]&gt;
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [K,&nbsp;V] | 返回一个可迭代数组。 | | [K,&nbsp;V] | 返回一个可迭代数组。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.entries(); var result = pro.entries();
...@@ -1056,12 +1056,12 @@ entries(): IterableIterator&lt;[K,V]&gt; ...@@ -1056,12 +1056,12 @@ entries(): IterableIterator&lt;[K,V]&gt;
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [K,&nbsp;V] | 返回一个键值对形式的二维数组。 | | [K,&nbsp;V] | 返回一个键值对形式的二维数组。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro[symbol.iterator](); var result = pro[symbol.iterator]();
...@@ -1076,7 +1076,7 @@ entries(): IterableIterator&lt;[K,V]&gt; ...@@ -1076,7 +1076,7 @@ entries(): IterableIterator&lt;[K,V]&gt;
用于表示范围中的值的类型。该类型的值,类型可以为ScopeComparable或number。 用于表示范围中的值的类型。该类型的值,类型可以为ScopeComparable或number。
ScopeComparable类型的值需要实现compareTo方法,确保传入的数据具有可比性。 ScopeComparable类型的值需要实现compareTo方法,确保传入的数据具有可比性。
``` ```js
interface ScopeComparable{ interface ScopeComparable{
compareTo(other: ScopeComparable): boolean; compareTo(other: ScopeComparable): boolean;
} }
...@@ -1088,7 +1088,7 @@ type ScopeType = ScopeComparable | number; ...@@ -1088,7 +1088,7 @@ type ScopeType = ScopeComparable | number;
示例: 示例:
``` ```js
class Temperature{ class Temperature{
constructor(value){ constructor(value){
this._temp = value; this._temp = value;
...@@ -1115,13 +1115,13 @@ constructor(lowerObj: ScopeType, upperObj: ScopeType) ...@@ -1115,13 +1115,13 @@ constructor(lowerObj: ScopeType, upperObj: ScopeType)
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| lowerObj | [ScopeType](#scopetype8) | 是 | 指定作用域实例的下限。 | | lowerObj | [ScopeType](#scopetype8) | 是 | 指定作用域实例的下限。 |
| upperObj | [ScopeType](#scopetype8) | 是 | 指定作用域实例的上限。 | | upperObj | [ScopeType](#scopetype8) | 是 | 指定作用域实例的上限。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1137,12 +1137,12 @@ toString(): string ...@@ -1137,12 +1137,12 @@ toString(): string
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| string | 返回包含当前范围对象的字符串表示形式。 | | string | 返回包含当前范围对象的字符串表示形式。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1159,17 +1159,17 @@ intersect(range: Scope): Scope ...@@ -1159,17 +1159,17 @@ intersect(range: Scope): Scope
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| range | [Scope](#scope8) | 是 | 传入一个给定范围。 | | range | [Scope](#scope8) | 是 | 传入一个给定范围。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | 返回给定范围和当前范围的交集。 | | [Scope](#scope8) | 返回给定范围和当前范围的交集。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1189,18 +1189,18 @@ intersect(lowerObj:ScopeType,upperObj:ScopeType):Scope ...@@ -1189,18 +1189,18 @@ intersect(lowerObj:ScopeType,upperObj:ScopeType):Scope
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| lowerObj | [ScopeType](#scopetype8) | 是 | 给定范围的下限。 | | lowerObj | [ScopeType](#scopetype8) | 是 | 给定范围的下限。 |
| upperObj | [ScopeType](#scopetype8) | 是 | 给定范围的上限。 | | upperObj | [ScopeType](#scopetype8) | 是 | 给定范围的上限。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | 返回当前范围与给定下限和上限范围的交集。 | | [Scope](#scope8) | 返回当前范围与给定下限和上限范围的交集。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1220,12 +1220,12 @@ getUpper(): ScopeType ...@@ -1220,12 +1220,12 @@ getUpper(): ScopeType
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [ScopeType](#scopetype8) | 返回当前范围的上限值。 | | [ScopeType](#scopetype8) | 返回当前范围的上限值。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1242,12 +1242,12 @@ getLower(): ScopeType ...@@ -1242,12 +1242,12 @@ getLower(): ScopeType
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [ScopeType](#scopetype8) | 返回当前范围的下限值。 | | [ScopeType](#scopetype8) | 返回当前范围的下限值。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1264,18 +1264,19 @@ expand(lowerObj: ScopeType,upperObj: ScopeType): Scope ...@@ -1264,18 +1264,19 @@ expand(lowerObj: ScopeType,upperObj: ScopeType): Scope
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| lowerObj | [ScopeType](#scopetype8) | 是 | 给定范围的下限。 | | lowerObj | [ScopeType](#scopetype8) | 是 | 给定范围的下限。 |
| upperObj | [ScopeType](#scopetype8) | 是 | 给定范围的上限。 | | upperObj | [ScopeType](#scopetype8) | 是 | 给定范围的上限。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | 返回当前范围和给定下限和上限的并集。 | | [Scope](#scope8) | 返回当前范围和给定下限和上限的并集。 |
**示例:** **示例:**
```
```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1294,17 +1295,17 @@ expand(range: Scope): Scope ...@@ -1294,17 +1295,17 @@ expand(range: Scope): Scope
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| range | [Scope](#scope8) | 是 | 传入一个给定范围。 | | range | [Scope](#scope8) | 是 | 传入一个给定范围。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | 返回包括当前范围和给定范围的并集。 | | [Scope](#scope8) | 返回包括当前范围和给定范围的并集。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1324,17 +1325,17 @@ expand(value: ScopeType): Scope ...@@ -1324,17 +1325,17 @@ expand(value: ScopeType): Scope
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | [ScopeType](#scopetype8) | 是 | 传入一个给定值。 | | value | [ScopeType](#scopetype8) | 是 | 传入一个给定值。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | 返回包括当前范围和给定值的并集。 | | [Scope](#scope8) | 返回包括当前范围和给定值的并集。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1352,17 +1353,17 @@ contains(value: ScopeType): boolean ...@@ -1352,17 +1353,17 @@ contains(value: ScopeType): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | [ScopeType](#scopetype8) | 是 | 传入一个给定值。 | | value | [ScopeType](#scopetype8) | 是 | 传入一个给定值。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 如果给定值包含在当前范围内返回true,否则返回false。 | | boolean | 如果给定值包含在当前范围内返回true,否则返回false。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1380,17 +1381,17 @@ contains(range: Scope): boolean ...@@ -1380,17 +1381,17 @@ contains(range: Scope): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| range | [Scope](#scope8) | 是 | 传入一个给定范围。 | | range | [Scope](#scope8) | 是 | 传入一个给定范围。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 如果给定范围包含在当前范围内返回true,否则返回false。 | | boolean | 如果给定范围包含在当前范围内返回true,否则返回false。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1410,17 +1411,17 @@ clamp(value: ScopeType): ScopeType ...@@ -1410,17 +1411,17 @@ clamp(value: ScopeType): ScopeType
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | [ScopeType](#scopetype8) | 是 | 传入的给定值。 | | value | [ScopeType](#scopetype8) | 是 | 传入的给定值。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [ScopeType](#scopetype8) | 如果传入的value小于下限,则返回lowerObj;如果大于上限值则返回upperObj;如果在当前范围内,则返回value。 | | [ScopeType](#scopetype8) | 如果传入的value小于下限,则返回lowerObj;如果大于上限值则返回upperObj;如果在当前范围内,则返回value。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1441,7 +1442,7 @@ Base64的构造函数。 ...@@ -1441,7 +1442,7 @@ Base64的构造函数。
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**示例:** **示例:**
``` ```js
var base64 = new util.Base64(); var base64 = new util.Base64();
``` ```
...@@ -1455,17 +1456,17 @@ encodeSync(src: Uint8Array): Uint8Array ...@@ -1455,17 +1456,17 @@ encodeSync(src: Uint8Array): Uint8Array
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | 是 | 编码输入Uint8数组。 | | src | Uint8Array | 是 | 编码输入Uint8数组。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Uint8Array | 返回编码后新分配的Uint8数组。 | | Uint8Array | 返回编码后新分配的Uint8数组。 |
**示例:** **示例:**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
var result = that.encodeSync(array); var result = that.encodeSync(array);
...@@ -1481,17 +1482,17 @@ encodeToStringSync(src: Uint8Array): string ...@@ -1481,17 +1482,17 @@ encodeToStringSync(src: Uint8Array): string
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | 是 | 编码输入Uint8数组。 | | src | Uint8Array | 是 | 编码输入Uint8数组。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| string | 返回编码后的字符串。 | | string | 返回编码后的字符串。 |
**示例:** **示例:**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
var result = that.encodeToStringSync(array); var result = that.encodeToStringSync(array);
...@@ -1507,17 +1508,17 @@ decodeSync(src: Uint8Array | string): Uint8Array ...@@ -1507,17 +1508,17 @@ decodeSync(src: Uint8Array | string): Uint8Array
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array&nbsp;\|&nbsp;string | 是 | 解码输入Uint8数组或者字符串。 | | src | Uint8Array&nbsp;\|&nbsp;string | 是 | 解码输入Uint8数组或者字符串。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Uint8Array | 返回解码后新分配的Uint8数组。 | | Uint8Array | 返回解码后新分配的Uint8数组。 |
**示例:** **示例:**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var buff = 'czEz'; var buff = 'czEz';
var result = that.decodeSync(buff); var result = that.decodeSync(buff);
...@@ -1533,17 +1534,17 @@ encode(src: Uint8Array): Promise&lt;Uint8Array&gt; ...@@ -1533,17 +1534,17 @@ encode(src: Uint8Array): Promise&lt;Uint8Array&gt;
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | 是 | 异步编码输入Uint8数组。 | | src | Uint8Array | 是 | 异步编码输入Uint8数组。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;Uint8Array&gt; | 返回异步编码后新分配的Uint8数组。 | | Promise&lt;Uint8Array&gt; | 返回异步编码后新分配的Uint8数组。 |
**示例:** **示例:**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
var rarray = new Uint8Array([99,122,69,122]); var rarray = new Uint8Array([99,122,69,122]);
...@@ -1564,17 +1565,17 @@ encodeToString(src: Uint8Array): Promise&lt;string&gt; ...@@ -1564,17 +1565,17 @@ encodeToString(src: Uint8Array): Promise&lt;string&gt;
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | 是 | 异步编码输入Uint8数组。 | | src | Uint8Array | 是 | 异步编码输入Uint8数组。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;string&gt; | 返回异步编码后的字符串。 | | Promise&lt;string&gt; | 返回异步编码后的字符串。 |
**示例:** **示例:**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
that.encodeToString(array).then(val=>{ that.encodeToString(array).then(val=>{
...@@ -1592,17 +1593,17 @@ decode(src: Uint8Array | string): Promise&lt;Uint8Array&gt; ...@@ -1592,17 +1593,17 @@ decode(src: Uint8Array | string): Promise&lt;Uint8Array&gt;
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array&nbsp;\|&nbsp;string | 是 | 异步解码输入Uint8数组或者字符串。 | | src | Uint8Array&nbsp;\|&nbsp;string | 是 | 异步解码输入Uint8数组或者字符串。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;Uint8Array&gt; | 返回异步解码后新分配的Uint8数组。 | | Promise&lt;Uint8Array&gt; | 返回异步解码后新分配的Uint8数组。 |
**示例:** **示例:**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([99,122,69,122]); var array = new Uint8Array([99,122,69,122]);
var rarray = new Uint8Array([115,49,51]); var rarray = new Uint8Array([115,49,51]);
...@@ -1626,7 +1627,7 @@ Types的构造函数。 ...@@ -1626,7 +1627,7 @@ Types的构造函数。
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**示例:** **示例:**
``` ```js
var type = new util.types(); var type = new util.types();
``` ```
...@@ -1640,17 +1641,17 @@ isAnyArrayBuffer(value: Object): boolean ...@@ -1640,17 +1641,17 @@ isAnyArrayBuffer(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是ArrayBuffer类型为true,反之为false。 | | boolean | 判断的结果,如果是ArrayBuffer类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isAnyArrayBuffer(new ArrayBuffer([])); var result = that.isAnyArrayBuffer(new ArrayBuffer([]));
``` ```
...@@ -1667,17 +1668,17 @@ ArrayBufferView辅助类型包括:Int8Array、Int16Array、Int32Array、Uint8A ...@@ -1667,17 +1668,17 @@ ArrayBufferView辅助类型包括:Int8Array、Int16Array、Int32Array、Uint8A
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的ArrayBufferView辅助类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的ArrayBufferView辅助类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isArrayBufferView(new Int8Array([])); var result = that.isArrayBufferView(new Int8Array([]));
``` ```
...@@ -1692,17 +1693,17 @@ isArgumentsObject(value: Object): boolean ...@@ -1692,17 +1693,17 @@ isArgumentsObject(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的arguments类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的arguments类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
function foo() { function foo() {
var result = that.isArgumentsObject(arguments); var result = that.isArgumentsObject(arguments);
...@@ -1720,17 +1721,17 @@ isArrayBuffer(value: Object): boolean ...@@ -1720,17 +1721,17 @@ isArrayBuffer(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的ArrayBuffer类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的ArrayBuffer类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isArrayBuffer(new ArrayBuffer([])); var result = that.isArrayBuffer(new ArrayBuffer([]));
``` ```
...@@ -1745,17 +1746,17 @@ isAsyncFunction(value: Object): boolean ...@@ -1745,17 +1746,17 @@ isAsyncFunction(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的异步函数类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的异步函数类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isAsyncFunction(async function foo() {}); var result = that.isAsyncFunction(async function foo() {});
``` ```
...@@ -1770,17 +1771,17 @@ isBooleanObject(value: Object): boolean ...@@ -1770,17 +1771,17 @@ isBooleanObject(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Boolean对象类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Boolean对象类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isBooleanObject(new Boolean(true)); var result = that.isBooleanObject(new Boolean(true));
``` ```
...@@ -1795,17 +1796,17 @@ isBoxedPrimitive(value: Object): boolean ...@@ -1795,17 +1796,17 @@ isBoxedPrimitive(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Boolean或Number或String或Symbol对象类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Boolean或Number或String或Symbol对象类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isBoxedPrimitive(new Boolean(false)); var result = that.isBoxedPrimitive(new Boolean(false));
``` ```
...@@ -1820,17 +1821,17 @@ isDataView(value: Object): boolean ...@@ -1820,17 +1821,17 @@ isDataView(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的DataView对象类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的DataView对象类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
const ab = new ArrayBuffer(20); const ab = new ArrayBuffer(20);
var result = that.isDataView(new DataView(ab)); var result = that.isDataView(new DataView(ab));
...@@ -1846,17 +1847,17 @@ isDate(value: Object): boolean ...@@ -1846,17 +1847,17 @@ isDate(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Date对象类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Date对象类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isDate(new Date()); var result = that.isDate(new Date());
``` ```
...@@ -1871,17 +1872,17 @@ isExternal(value: Object): boolean ...@@ -1871,17 +1872,17 @@ isExternal(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含native&nbsp;External类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含native&nbsp;External类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
const data = util.createExternalType(); const data = util.createExternalType();
var result = that.isExternal(data); var result = that.isExternal(data);
...@@ -1897,17 +1898,17 @@ isFloat32Array(value: Object): boolean ...@@ -1897,17 +1898,17 @@ isFloat32Array(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Float32Array数组类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Float32Array数组类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isFloat32Array(new Float32Array()); var result = that.isFloat32Array(new Float32Array());
``` ```
...@@ -1922,17 +1923,17 @@ isFloat64Array(value: Object): boolean ...@@ -1922,17 +1923,17 @@ isFloat64Array(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Float64Array数组类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Float64Array数组类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isFloat64Array(new Float64Array()); var result = that.isFloat64Array(new Float64Array());
``` ```
...@@ -1947,17 +1948,17 @@ isGeneratorFunction(value: Object): boolean ...@@ -1947,17 +1948,17 @@ isGeneratorFunction(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的generator函数类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的generator函数类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isGeneratorFunction(function* foo() {}); var result = that.isGeneratorFunction(function* foo() {});
``` ```
...@@ -1972,17 +1973,17 @@ isGeneratorObject(value: Object): boolean ...@@ -1972,17 +1973,17 @@ isGeneratorObject(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的generator对象类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的generator对象类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
function* foo() {} function* foo() {}
const generator = foo(); const generator = foo();
...@@ -1999,17 +2000,17 @@ isInt8Array(value: Object): boolean ...@@ -1999,17 +2000,17 @@ isInt8Array(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Int8Array数组类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Int8Array数组类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isInt8Array(new Int8Array([])); var result = that.isInt8Array(new Int8Array([]));
``` ```
...@@ -2024,17 +2025,17 @@ isInt16Array(value: Object): boolean ...@@ -2024,17 +2025,17 @@ isInt16Array(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Int16Array数组类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Int16Array数组类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isInt16Array(new Int16Array([])); var result = that.isInt16Array(new Int16Array([]));
``` ```
...@@ -2049,17 +2050,17 @@ isInt32Array(value: Object): boolean ...@@ -2049,17 +2050,17 @@ isInt32Array(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Int32Array数组类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Int32Array数组类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isInt32Array(new Int32Array([])); var result = that.isInt32Array(new Int32Array([]));
``` ```
...@@ -2074,17 +2075,17 @@ isMap(value: Object): boolean ...@@ -2074,17 +2075,17 @@ isMap(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Map类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Map类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isMap(new Map()); var result = that.isMap(new Map());
``` ```
...@@ -2099,17 +2100,17 @@ isMapIterator(value: Object): boolean ...@@ -2099,17 +2100,17 @@ isMapIterator(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Map的Iterator类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Map的Iterator类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
const map = new Map(); const map = new Map();
var result = that.isMapIterator(map.keys()); var result = that.isMapIterator(map.keys());
...@@ -2125,17 +2126,17 @@ isNativeError(value: Object): boolean ...@@ -2125,17 +2126,17 @@ isNativeError(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Error类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Error类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isNativeError(new TypeError()); var result = that.isNativeError(new TypeError());
``` ```
...@@ -2150,17 +2151,17 @@ isNumberObject(value: Object): boolean ...@@ -2150,17 +2151,17 @@ isNumberObject(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Number对象类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Number对象类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isNumberObject(new Number(0)); var result = that.isNumberObject(new Number(0));
``` ```
...@@ -2175,17 +2176,17 @@ isPromise(value: Object): boolean ...@@ -2175,17 +2176,17 @@ isPromise(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Promise类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Promise类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isPromise(Promise.resolve(1)); var result = that.isPromise(Promise.resolve(1));
``` ```
...@@ -2200,17 +2201,17 @@ isProxy(value: Object): boolean ...@@ -2200,17 +2201,17 @@ isProxy(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Proxy类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Proxy类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
const target = {}; const target = {};
const proxy = new Proxy(target, {}); const proxy = new Proxy(target, {});
...@@ -2227,17 +2228,17 @@ isRegExp(value: Object): boolean ...@@ -2227,17 +2228,17 @@ isRegExp(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的RegExp类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的RegExp类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isRegExp(new RegExp('abc')); var result = that.isRegExp(new RegExp('abc'));
``` ```
...@@ -2252,17 +2253,17 @@ isSet(value: Object): boolean ...@@ -2252,17 +2253,17 @@ isSet(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Set类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Set类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isSet(new Set()); var result = that.isSet(new Set());
``` ```
...@@ -2277,17 +2278,17 @@ isSetIterator(value: Object): boolean ...@@ -2277,17 +2278,17 @@ isSetIterator(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Set的Iterator类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Set的Iterator类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
const set = new Set(); const set = new Set();
var result = that.isSetIterator(set.keys()); var result = that.isSetIterator(set.keys());
...@@ -2303,17 +2304,17 @@ isStringObject(value: Object): boolean ...@@ -2303,17 +2304,17 @@ isStringObject(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的String对象类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的String对象类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isStringObject(new String('foo')); var result = that.isStringObject(new String('foo'));
``` ```
...@@ -2328,17 +2329,17 @@ isSymbolObject(value: Object): boolean ...@@ -2328,17 +2329,17 @@ isSymbolObject(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Symbol对象类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Symbol对象类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
const symbols = Symbol('foo'); const symbols = Symbol('foo');
var result = that.isSymbolObject(Object(symbols)); var result = that.isSymbolObject(Object(symbols));
...@@ -2356,17 +2357,17 @@ TypedArray类型的辅助类型,包括Int8Array、Int16Array、Int32Array、Ui ...@@ -2356,17 +2357,17 @@ TypedArray类型的辅助类型,包括Int8Array、Int16Array、Int32Array、Ui
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的TypedArray包含的类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的TypedArray包含的类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isTypedArray(new Float64Array([])); var result = that.isTypedArray(new Float64Array([]));
``` ```
...@@ -2381,17 +2382,17 @@ isUint8Array(value: Object): boolean ...@@ -2381,17 +2382,17 @@ isUint8Array(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Uint8Array数组类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Uint8Array数组类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isUint8Array(new Uint8Array([])); var result = that.isUint8Array(new Uint8Array([]));
``` ```
...@@ -2406,17 +2407,17 @@ isUint8ClampedArray(value: Object): boolean ...@@ -2406,17 +2407,17 @@ isUint8ClampedArray(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Uint8ClampedArray数组类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Uint8ClampedArray数组类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isUint8ClampedArray(new Uint8ClampedArray([])); var result = that.isUint8ClampedArray(new Uint8ClampedArray([]));
``` ```
...@@ -2431,17 +2432,17 @@ isUint16Array(value: Object): boolean ...@@ -2431,17 +2432,17 @@ isUint16Array(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Uint16Array数组类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Uint16Array数组类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isUint16Array(new Uint16Array([])); var result = that.isUint16Array(new Uint16Array([]));
``` ```
...@@ -2456,17 +2457,17 @@ isUint32Array(value: Object): boolean ...@@ -2456,17 +2457,17 @@ isUint32Array(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Uint32Array数组类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Uint32Array数组类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isUint32Array(new Uint32Array([])); var result = that.isUint32Array(new Uint32Array([]));
``` ```
...@@ -2481,17 +2482,17 @@ isWeakMap(value: Object): boolean ...@@ -2481,17 +2482,17 @@ isWeakMap(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的WeakMap类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的WeakMap类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isWeakMap(new WeakMap()); var result = that.isWeakMap(new WeakMap());
``` ```
...@@ -2506,17 +2507,17 @@ isWeakSet(value: Object): boolean ...@@ -2506,17 +2507,17 @@ isWeakSet(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的WeakSet类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的WeakSet类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isWeakSet(new WeakSet()); var result = that.isWeakSet(new WeakSet());
``` ```
...@@ -32,7 +32,7 @@ XmlSerializer的构造函数。 ...@@ -32,7 +32,7 @@ XmlSerializer的构造函数。
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var bufView = new DataView(arrayBuffer); var bufView = new DataView(arrayBuffer);
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
...@@ -54,7 +54,7 @@ setAttributes(name: string, value: string): void ...@@ -54,7 +54,7 @@ setAttributes(name: string, value: string): void
**示例:** **示例:**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setAttributes("importance", "high"); thatSer.setAttributes("importance", "high");
``` ```
...@@ -74,8 +74,8 @@ addEmptyElement(name: string): void ...@@ -74,8 +74,8 @@ addEmptyElement(name: string): void
**示例:** **示例:**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.addEmptyElement("b"); // => <b/> thatSer.addEmptyElement("b"); // => <b/>
``` ```
...@@ -88,7 +88,7 @@ setDeclaration(): void ...@@ -88,7 +88,7 @@ setDeclaration(): void
**示例:** **示例:**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setDeclaration() // => <?xml version="1.0" encoding="utf-8"?>; thatSer.setDeclaration() // => <?xml version="1.0" encoding="utf-8"?>;
``` ```
...@@ -108,7 +108,7 @@ startElement(name: string): void ...@@ -108,7 +108,7 @@ startElement(name: string): void
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("notel"); thatSer.startElement("notel");
...@@ -124,7 +124,7 @@ endElement(): void ...@@ -124,7 +124,7 @@ endElement(): void
**示例:** **示例:**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setNamespace("h", "http://www.w3.org/TR/html4/"); thatSer.setNamespace("h", "http://www.w3.org/TR/html4/");
thatSer.startElement("table"); thatSer.startElement("table");
...@@ -149,7 +149,7 @@ setNamespace(prefix: string, namespace: string): void ...@@ -149,7 +149,7 @@ setNamespace(prefix: string, namespace: string): void
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setDeclaration(); thatSer.setDeclaration();
...@@ -172,7 +172,7 @@ setComment(text: string): void ...@@ -172,7 +172,7 @@ setComment(text: string): void
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
...@@ -195,7 +195,7 @@ setCDATA(text: string): void ...@@ -195,7 +195,7 @@ setCDATA(text: string): void
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1028); var arrayBuffer = new ArrayBuffer(1028);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setCDATA('root SYSTEM') // => '<![CDATA[root SYSTEM]]>'; thatSer.setCDATA('root SYSTEM') // => '<![CDATA[root SYSTEM]]>';
...@@ -216,7 +216,7 @@ setText(text: string): void ...@@ -216,7 +216,7 @@ setText(text: string): void
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
...@@ -240,7 +240,7 @@ setDocType(text: string): void ...@@ -240,7 +240,7 @@ setDocType(text: string): void
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setDocType('root SYSTEM'); // => '<!DOCTYPE root SYSTEM>'; thatSer.setDocType('root SYSTEM'); // => '<!DOCTYPE root SYSTEM>';
...@@ -265,7 +265,7 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string) ...@@ -265,7 +265,7 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string)
**示例:** **示例:**
``` ```js
var strXml = var strXml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
...@@ -297,7 +297,7 @@ parse(option: ParseOptions): void ...@@ -297,7 +297,7 @@ parse(option: ParseOptions): void
**示例:** **示例:**
``` ```js
var strXml = var strXml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册