| string | Detailed information about the error code.|
| string | Detailed information about the error code.|
**Example**
**Example**
```
```js
varerrnum=10;// 10 is the system error code.
varerrnum=10;// 10 is the system error code.
varresult=util.getErrorString(errnum);
varresult=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
asyncfunctionpromiseFn(){
asyncfunctionpromiseFn(){
returnPromise.reject('value');
returnPromise.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.
| 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**.|
| 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.|
| 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
varrationalNumber=newutil.RationalNumber(1,2);
varrationalNumber=newutil.RationalNumber(1,2);
varresult=rationalNumber.toString();
varresult=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
varpro=newutil.LruBuffer();
varpro=newutil.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
| 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
varpro=newutil.LruBuffer();
varpro=newutil.LruBuffer();
varresult=pro.put(2,10);
varresult=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
| V \| undefind | Returns an **Optional** object containing the removed key-value pair if the key exists in the buffer; returns an empty **Optional** object otherwise. If the key is null, an exception will be thrown.|
| V \| undefind | Returns an **Optional** object containing the removed key-value pair if the key exists in the buffer; returns an empty **Optional** object otherwise. If the key is null, an exception will be thrown.|
**Example**
**Example**
```
```js
varpro=newutil.LruBuffer();
varpro=newutil.LruBuffer();
pro.put(2,10);
pro.put(2,10);
varresult=pro.remove(20);
varresult=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.
| 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
vararr=[];
vararr=[];
classChildLruBufferextendsutil.LruBuffer
classChildLruBufferextendsutil.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.
| 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
vartempLower=newTemperature(30);
vartempLower=newTemperature(30);
vartempUpper=newTemperature(40);
vartempUpper=newTemperature(40);
vartempMiDF=newTemperature(35);
vartempMiDF=newTemperature(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.