Calls back an asynchronous function. In the callback, 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.
| original | Function | Yes| Asynchronous function.|
- Return value
**Return value**
| Type| Description|
| -------- | -------- |
| Function | Callback, in which the first parameter indicates the cause of the rejection (the value is **null** if the promise has been resolved) and the second parameter indicates the resolved value.|
| ignoreBOM | boolean | Yes| No| Whether to ignore the byte order marker (BOM). The default value is **false**, which indicates that the result contains the BOM.|
| input | Unit8Array | Yes| Uint8Array to decode.|
| options | Object | No| Options related to decoding.|
**Table 2** options
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| stream | boolean | No| Whether to allow data blocks in subsequent **decode()**. If data is processed in blocks, set this parameter to **true**. If this is the last data block to process or data is not divided into blocks, set this parameter to **false**. The default value is **false**.|
- Return value
**Return value**
| Type| Description|
| -------- | -------- |
| string | Data decoded.|
- Example
**Example**
```
var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM:true});
| another | RationalNumber | Yes| Object used to compare with this **RationalNumber** object.|
- Return value
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the two objects are equal; returns **1** if the given object is less than this object; return **-1** if the given object is greater than this object.|
- Example
**Example**
```
var rationalNumber = new util.RationalNumber(1,2);
var rational = rationalNumer.creatRationalFromString("3/4");
...
...
@@ -351,12 +374,14 @@ valueOf():number
Obtains the value of this **RationalNumber** object as an integer or a floating-point number.
| 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**
```
var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.toString();
...
...
@@ -520,14 +562,15 @@ Obtains the string representation of this **RationalNumber** object.
| key | K | Yes| Key of the key-value pair to add.|
| value | V | Yes| Value of the key-value pair to add.|
- Return value
**Return value**
| Type| Description|
| -------- | -------- |
| V | Returns the existing value if the key already exists; returns the value added otherwise. If the key or value is null, an exception will be thrown. |
- Example
**Example**
```
var pro = new util.LruBuffer();
var result = pro.put(2,10);
...
...
@@ -797,12 +866,14 @@ values():V[]
Obtains all values in this buffer, listed from the most to the least recently accessed.
| 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.|
| isEvict | boolean | No| Whether the buffer capacity is insufficient. If the value is **true**, this method is called due to insufficient capacity.|
...
...
@@ -869,7 +946,7 @@ Performs subsequent operations after a value is removed.
| value | V | Yes| Value removed.|
| newValue | V | No| New value for the key if the **put()** method is called and the key to be added already exists. In other cases, this parameter is left blank.|
- Example
**Example**
```
var arr = [];
class ChildLruBuffer extends util.LruBuffer
...
...
@@ -904,17 +981,19 @@ contains(key:K):boolean
Checks whether this buffer contains the specified key.
| value | [ScopeType](#scopetype8) | Yes| Value specified.|
- Return value
**Return value**
| Type| Description|
| -------- | -------- |
| [ScopeType](#scopetype8) | Returns **lowerObj** if the specified value is less than the lower limit; returns **upperObj** if the specified value is greater than the upper limit; returns the specified value if it is within this **Scope**.|
| boolean | Returns **true** if the input value is of the **ArrayBuffer** type; returns **false** otherwise.|
- Example
**Example**
```
var that = new util.Types();
var result = that.isAnyArrayBuffer(new ArrayBuffer([]));
...
...
@@ -1536,17 +1664,19 @@ Checks whether the input value is of the **ArrayBufferView** type.
**ArrayBufferView** is a helper type representing any of the following: **Int8Array**, **Int16Array**, **Int32Array**, **Uint8Array**, **Uint8ClampedArray**, **Uint32Array**, **Float32Array**, **Float64Array**, and **DataView**.
| boolean | Returns **true** if the input value is a symbol object; returns **false** otherwise.|
- Example
**Example**
```
var that = new util.Types();
const symbols = Symbol('foo');
...
...
@@ -2171,17 +2353,19 @@ Checks whether the input value is of the **TypedArray** type.
**TypedArray** is a helper type representing any of the following: **Int8Array**, **Int16Array**, **Int32Array**, **Uint8Array**, **Uint8ClampedArray**, **Uint16Array**, **Uint32Array**, **Float32Array**, **Float64Array**, and **DataView**.