1/* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15/** 16 * TextDecoder support full encoding in ICU data utf-8 utf-16 iso8859 must support in all device, TextEncoder takes a 17 * stream of code points as input and emits a stream of UTF-8 bytes, and system help function. 18 * @since 7 19 * @syscap SystemCapability.Utils.Lang 20 * @import import util from '@ohos.util'; 21 * @permission N/A 22 */ 23declare namespace util { 24 /** 25 * %s: String will be used to convert all values except BigInt, Object and -0. BigInt values will be represented 26 * with an n and Objects that have no user defined toString function are inspected using util.inspect() with 27 * options { depth: 0, colors: false, compact: 3 }. 28 * %d: Number will be used to convert all values except BigInt and Symbol. 29 * %i: parseInt(value, 10) is used for all values except BigInt and Symbol. 30 * %f: parseFloat(value) is used for all values except Bigint and Symbol. 31 * %j: JSON. Replaced with the string '[Circular]' if the argument contains circular references. 32 * %o: Object. A string representation of an object with generic JavaScript object formatting.Similar to 33 * util.inspect() with options { showHidden: true, showProxy: true}. This will show the full object including 34 * non-enumerable properties and proxies. 35 * %O: Object. A string representation of an object with generic JavaScript object formatting. 36 * %O: Object. A string representation of an object with generic JavaScript object formatting.Similar to 37 * util.inspect() without options. This will show the full object not including non-enumerable properties and 38 * proxies. 39 * %c: CSS. This specifier is ignored and will skip any CSS passed in. 40 * %%: single percent sign ('%'). This does not consume an argument.Returns: <string> The formatted string. 41 * @since 7 42 * @syscap SystemCapability.Utils.Lang 43 * @param format styled string 44 * @param args data to be formatted 45 * @return Return the character string formatted in a specific format 46 */ 47 function printf(format: string, ...args: Object[]): string; 48 49 /** 50 * Get the string name of the system errno. 51 * @since 7 52 * @syscap SystemCapability.Utils.Lang 53 * @param errno the error code generated by an error in the system 54 * @return return the string name of a system errno 55 */ 56 function getErrorString(errno: number): string; 57 58 /** 59 * Takes an async function (or a function that returns a Promise) and returns a function following the 60 * error-first callback style. 61 * @since 7 62 * @syscap SystemCapability.Utils.Lang 63 * @param original asynchronous function 64 */ 65 function callbackWrapper(original: Function): (err: Object, value: Object) => void; 66 67 /** 68 * Takes a function following the common error-first callback style, i.e taking an (err, value) => 69 * callback as the last argument, and return a version that returns promises. 70 * @since 7 71 * @syscap SystemCapability.Utils.Lang 72 * @param original asynchronous function 73 * @return return a version that returns promises 74 */ 75 function promiseWrapper(original: (err: Object, value: Object) => void): Object; 76 77 class TextDecoder { 78 /** 79 * the source encoding's name, lowercased. 80 * @since 7 81 * @syscap SystemCapability.Utils.Lang 82 */ 83 readonly encoding: string; 84 85 /** 86 * Returns `true` if error mode is "fatal", and `false` otherwise. 87 * @since 7 88 * @syscap SystemCapability.Utils.Lang 89 */ 90 readonly fatal: boolean; 91 92 /** 93 * Returns `true` if ignore BOM flag is set, and `false` otherwise. 94 * @since 7 95 * @syscap SystemCapability.Utils.Lang 96 */ 97 readonly ignoreBOM = false; 98 99 /** 100 * the textEncoder constructor. 101 * @param 7 102 * @syscap SystemCapability.Utils.Lang 103 * @param encoding decoding format 104 */ 105 constructor( 106 encoding?: string, 107 options?: { fatal?: boolean; ignoreBOM?: boolean }, 108 ); 109 110 /** 111 * Returns the result of running encoding's decoder. 112 * @since 7 113 * @syscap SystemCapability.Utils.Lang 114 * @param input decoded numbers in accordance with the format 115 * @return return decoded text 116 */ 117 decode(input: Uint8Array, options?: { stream?: false }): string; 118 } 119 120 class TextEncoder { 121 /** 122 * Encoding format. 123 * @since 7 124 * @syscap SystemCapability.Utils.Lang 125 */ 126 readonly encoding = "utf-8"; 127 128 /** 129 * the textEncoder constructor. 130 * @since 7 131 * @syscap SystemCapability.Utils.Lang 132 */ 133 constructor(); 134 135 /** 136 * Returns the result of encoder. 137 * @since 7 138 * @syscap SystemCapability.Utils.Lang 139 * @param The string to be encoded. 140 * @return returns the encoded text. 141 */ 142 encode(input?: string): Uint8Array; 143 144 /** 145 * encode string, write the result to dest array. 146 * @since 7 147 * @syscap SystemCapability.Utils.Lang 148 * @param input The string to be encoded. 149 * @param dest decoded numbers in accordance with the format 150 * @return returns Returns the object, where read represents 151 * the number of characters that have been encoded, and written 152 * represents the number of bytes occupied by the encoded characters. 153 */ 154 encodeInto( 155 input: string, 156 dest: Uint8Array, 157 ): { read: number; written: number }; 158 } 159 160 class RationalNumber { 161 /** 162 * A constructor used to create a RationalNumber instance with a given numerator and denominator. 163 * @since 8 164 * @syscap SystemCapability.Utils.Lang 165 * @param numerator An integer number 166 * @param denominator An integer number 167 */ 168 constructor(numerator: number, denominator: number); 169 /** 170 * Creates a RationalNumber object based on a given string. 171 * @since 8 172 * @syscap SystemCapability.Utils.Lang 173 * @param String Expression of Rational Numbers 174 * @return Returns a RationalNumber object generated based on the given string. 175 */ 176 static createRationalFromString(rationalString: string): RationalNumber; 177 /** 178 * Compares the current RationalNumber object to the given object. 179 * @since 8 180 * @syscap SystemCapability.Utils.Lang 181 * @param An object of other rational numbers 182 * @return Returns 0 or 1, or -1, depending on the comparison. 183 */ 184 compareTo(another :RationalNumber): number; 185 /** 186 * Compares two objects for equality. 187 * @since 8 188 * @syscap SystemCapability.Utils.Lang 189 * @param An object 190 * @return Returns true if the given object is the same as the current object; Otherwise, false is returned. 191 */ 192 equals(obj: Object): boolean; 193 /** 194 * Gets integer and floating-point values of a rational number object. 195 * @since 8 196 * @syscap SystemCapability.Utils.Lang 197 * @return Returns the integer and floating-point values of a rational number object. 198 */ 199 valueOf(): number; 200 /** 201 * Get the greatest common divisor of two integers. 202 * @since 8 203 * @syscap SystemCapability.Utils.Lang 204 * @param number1 is an integer. 205 * @param number2 is an integer. 206 * @return Returns the greatest common divisor of two integers, integer type. 207 */ 208 static getCommonDivisor(number1: number, number2: number): number; 209 /** 210 * Gets the denominator of the current object. 211 * @since 8 212 * @syscap SystemCapability.Utils.Lang 213 * @return Returns the denominator of the current object. 214 */ 215 getDenominator(): number; 216 /** 217 * Gets the numerator of the current object. 218 * @since 8 219 * @syscap SystemCapability.Utils.Lang 220 * @return Returns the numerator of the current object. 221 */ 222 getNumerator(): number; 223 /** 224 * Checks whether the current RationalNumber object represents an infinite value. 225 * @since 8 226 * @syscap SystemCapability.Utils.Lang 227 * @return If the denominator is not 0, true is returned. Otherwise, false is returned. 228 */ 229 isFinite() : boolean; 230 /** 231 * Checks whether the current RationalNumber object represents a Not-a-Number (NaN) value. 232 * @since 8 233 * @syscap SystemCapability.Utils.Lang 234 * @return If both the denominator and numerator are 0, true is returned. Otherwise, false is returned. 235 */ 236 isNaN(): boolean; 237 /** 238 * Checks whether the current RationalNumber object represents the value 0. 239 * @since 8 240 * @syscap SystemCapability.Utils.Lang 241 * @return If the value represented by the current object is 0, true is returned. Otherwise, false is returned. 242 */ 243 isZero(): boolean; 244 /** 245 * Obtains a string representation of the current RationalNumber object. 246 * @since 8 247 * @syscap SystemCapability.Utils.Lang 248 * @return Returns a string representation of the current RationalNumber object. 249 */ 250 toString(): string; 251 } 252 253 class LruBuffer<K, V> { 254 /** 255 * Default constructor used to create a new LruBuffer instance with the default capacity of 64. 256 * @since 8 257 * @syscap SystemCapability.Utils.Lang 258 * @param capacity Indicates the capacity to customize for the buffer. 259 */ 260 constructor(capacity?:number); 261 /** 262 * Updates the buffer capacity to a specified capacity. 263 * @since 8 264 * @syscap SystemCapability.Utils.Lang 265 * @param newCapacity Indicates the new capacity to set. 266 */ 267 updateCapacity(newCapacity: number):void 268 /** 269 *Returns a string representation of the object. 270 * @since 8 271 * @syscap SystemCapability.Utils.Lang 272 * @return Returns the string representation of the object and outputs the string representation of the object. 273 */ 274 toString():string 275 /** 276 * Obtains a list of all values in the current buffer. 277 * @since 8 278 * @syscap SystemCapability.Utils.Lang 279 * @return Returns the total number of values in the current buffer. 280 */ 281 length:number 282 /** 283 * Obtains the capacity of the current buffer. 284 * @since 8 285 * @syscap SystemCapability.Utils.Lang 286 * @return Returns the capacity of the current buffer. 287 */ 288 getCapacity(): number; 289 /** 290 * Clears key-value pairs from the current buffer. 291 * @since 8 292 * @syscap SystemCapability.Utils.Lang 293 */ 294 clear(): void; 295 /** 296 * Obtains the number of times createDefault(Object) returned a value. 297 * @since 8 298 * @syscap SystemCapability.Utils.Lang 299 * @return Returns the number of times createDefault(java.lang.Object) returned a value. 300 */ 301 getCreateCount(): number; 302 /** 303 * Obtains the number of times that the queried values are not matched. 304 * @since 8 305 * @syscap SystemCapability.Utils.Lang 306 * @return Returns the number of times that the queried values are not matched. 307 */ 308 getMissCount(): number; 309 /** 310 * Obtains the number of times that values are evicted from the buffer. 311 * @since 8 312 * @syscap SystemCapability.Utils.Lang 313 * @return Returns the number of times that values are evicted from the buffer. 314 */ 315 getRemovalCount(): number; 316 /** 317 * Obtains the number of times that the queried values are successfully matched. 318 * @since 8 319 * @syscap SystemCapability.Utils.Lang 320 * @return Returns the number of times that the queried values are successfully matched. 321 */ 322 getMatchCount(): number; 323 /** 324 * Obtains the number of times that values are added to the buffer. 325 * @since 8 326 * @syscap SystemCapability.Utils.Lang 327 * @return Returns the number of times that values are added to the buffer. 328 */ 329 getPutCount(): number; 330 /** 331 * Checks whether the current buffer is empty. 332 * @since 8 333 * @syscap SystemCapability.Utils.Lang 334 * @return Returns true if the current buffer contains no value. 335 */ 336 isEmpty(): boolean; 337 /** 338 * Obtains the value associated with a specified key. 339 * @since 8 340 * @syscap SystemCapability.Utils.Lang 341 * @param key Indicates the key to query. 342 * @return Returns the value associated with the key if the specified key is present in the buffer; returns null otherwise. 343 */ 344 get(key: K): V | undefined; 345 /** 346 * Adds a key-value pair to the buffer. 347 * @since 8 348 * @syscap SystemCapability.Utils.Lang 349 * @param key Indicates the key to add. 350 * @param value Indicates the value associated with the key to add. 351 * @return Returns the value associated with the added key; returns the original value if the key to add already exists. 352 */ 353 put(key: K, value: V): V; 354 /** 355 * Obtains a list of all values in the current buffer. 356 * @since 8 357 * @syscap SystemCapability.Utils.Lang 358 * @return Returns the list of all values in the current buffer in ascending order, from the most recently accessed to least recently accessed. 359 */ 360 values(): V[]; 361 /** 362 * Obtains a list of keys for the values in the current buffer. 363 * @since 8 364 * @syscap SystemCapability.Utils.Lang 365 * @return Returns a list of keys sorted from most recently accessed to least recently accessed. 366 */ 367 keys(): K[]; 368 /** 369 * Deletes a specified key and its associated value from the current buffer. 370 * @since 8 371 * @syscap SystemCapability.Utils.Lang 372 * @param key Indicates the key to delete. 373 * @return Returns an Optional object containing the deleted key-value pair; returns an empty Optional object if the key does not exist. 374 */ 375 remove(key: K): V | undefined; 376 /** 377 * Executes subsequent operations after a value is deleted. 378 * @since 8 379 * @syscap SystemCapability.Utils.Lang 380 * @param isEvict The parameter value is true if this method is called due to insufficient capacity, and the parameter value is false in other cases. 381 * @param key Indicates the deleted key. 382 * @param value Indicates the deleted value. 383 * @param newValue The parameter value is the new value associated if the put(java.lang.Object,java.lang.Object) method is called and the key to add already exists. The parameter value is null in other cases. 384 */ 385 afterRemoval(isEvict: boolean, key: K, value: V, newValue: V): void; 386 /** 387 * Checks whether the current buffer contains a specified key. 388 * @since 8 389 * @syscap SystemCapability.Utils.Lang 390 * @param key Indicates the key to check. 391 * @return Returns true if the buffer contains the specified key. 392 */ 393 contains(key: K): boolean; 394 /** 395 * Executes subsequent operations if miss to compute a value for the specific key. 396 * @since 8 397 * @syscap SystemCapability.Utils.Lang 398 * @param key Indicates the missed key. 399 * @return Returns the value associated with the key. 400 */ 401 createDefault(key: K): V; 402 /** 403 * Returns an array of key-value pairs of enumeratable properties of a given object. 404 * @since 8 405 * @syscap SystemCapability.Utils.Lang 406 * @return Returns an array of key-value pairs for the enumeratable properties of the given object itself. 407 */ 408 entries(): IterableIterator<[K, V]>; 409 /** 410 * Specifies the default iterator for an object. 411 * @since 8 412 * @syscap SystemCapability.Utils.Lang 413 * @return Returns a two - dimensional array in the form of key - value pairs. 414 */ 415 [Symbol.iterator](): IterableIterator<[K, V]>; 416 } 417 interface ScopeComparable { 418 /** 419 * The comparison function is used by the scope. 420 * @since 8 421 * @syscap SystemCapability.Utils.Lang 422 * @return Returns whether the current object is greater than or equal to the input object. 423 */ 424 compareTo(other: ScopeComparable): boolean; 425 } 426 /** 427 * A type used to denote ScopeComparable or number. 428 * @since 8 429 * @syscap SystemCapability.Utils.Lang 430 */ 431 type ScopeType = ScopeComparable | number; 432 433 class Scope{ 434 /** 435 * A constructor used to create a Scope instance with the lower and upper bounds specified. 436 * @since 8 437 * @syscap SystemCapability.Utils.Lang 438 * @param lowerObj A ScopeType value 439 * @param upperObj A ScopeType value 440 */ 441 constructor(lowerObj: ScopeType, upperObj: ScopeType); 442 /** 443 * Obtains a string representation of the current range. 444 * @since 8 445 * @syscap SystemCapability.Utils.Lang 446 * @return Returns a string representation of the current range object. 447 */ 448 toString(): string; 449 /** 450 * Returns the intersection of a given range and the current range. 451 * @since 8 452 * @syscap SystemCapability.Utils.Lang 453 * @param range A Scope range object 454 * @return Returns the intersection of a given range and the current range. 455 */ 456 intersect(range: Scope): Scope; 457 /** 458 * Returns the intersection of the current range and the range specified by the given lower and upper bounds. 459 * @since 8 460 * @syscap SystemCapability.Utils.Lang 461 * @param lowerObj A ScopeType value 462 * @param upperObj A ScopeType value 463 * @return Returns the intersection of the current range and the range specified by the given lower and upper bounds. 464 */ 465 intersect(lowerObj: ScopeType, upperObj: ScopeType): Scope; 466 /** 467 * Obtains the upper bound of the current range. 468 * @since 8 469 * @syscap SystemCapability.Utils.Lang 470 * @return Returns the upper bound of the current range. 471 */ 472 getUpper(): ScopeType; 473 /** 474 * Obtains the lower bound of the current range. 475 * @since 8 476 * @syscap SystemCapability.Utils.Lang 477 * @return Returns the lower bound of the current range. 478 */ 479 getLower(): ScopeType; 480 /** 481 * Creates the smallest range that includes the current range and the given lower and upper bounds. 482 * @since 8 483 * @syscap SystemCapability.Utils.Lang 484 * @param lowerObj A ScopeType value 485 * @param upperObj A ScopeType value 486 * @return Returns the smallest range that includes the current range and the given lower and upper bounds. 487 */ 488 expand(lowerObj: ScopeType, upperObj: ScopeType): Scope; 489 /** 490 * Creates the smallest range that includes the current range and a given range. 491 * @since 8 492 * @syscap SystemCapability.Utils.Lang 493 * @param range A Scope range object 494 * @return Returns the smallest range that includes the current range and a given range. 495 */ 496 expand(range: Scope): Scope; 497 /** 498 * Creates the smallest range that includes the current range and a given value. 499 * @since 8 500 * @syscap SystemCapability.Utils.Lang 501 * @param value A ScopeType value 502 * @return Returns the smallest range that includes the current range and a given value. 503 */ 504 expand(value: ScopeType): Scope; 505 /** 506 * Checks whether a given value is within the current range. 507 * @since 8 508 * @syscap SystemCapability.Utils.Lang 509 * @param range A ScopeType range 510 * @return If the value is within the current range return true,otherwise return false. 511 */ 512 contains(value: ScopeType): boolean; 513 /** 514 * Checks whether a given range is within the current range. 515 * @since 8 516 * @syscap SystemCapability.Utils.Lang 517 * @param value A Scope value 518 * @return If the current range is within the given range return true,otherwise return false. 519 */ 520 contains(range: Scope): boolean; 521 /** 522 * Clamps a given value to the current range. 523 * @since 8 524 * @syscap SystemCapability.Utils.Lang 525 * @param value A ScopeType value 526 * @return Returns a ScopeType object that a given value is clamped to the current range.. 527 */ 528 clamp(value: ScopeType): ScopeType; 529 } 530 531 class Base64{ 532 /** 533 * Constructor for creating base64 encoding and decoding 534 * @since 8 535 * @syscap SystemCapability.Utils.Lang 536 * @param No input parameter is required. 537 * @return No return value. 538 */ 539 constructor(); 540 /** 541 * Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme. 542 * @since 8 543 * @syscap SystemCapability.Utils.Lang 544 * @param value A Uint8Array value 545 * @return Return the encoded new Uint8Array. 546 */ 547 encodeSync(src: Uint8Array): Uint8Array; 548 /** 549 * Encodes the specified byte array into a String using the Base64 encoding scheme. 550 * @since 8 551 * @syscap SystemCapability.Utils.Lang 552 * @param value A Uint8Array value 553 * @return Return the encoded string. 554 */ 555 encodeToStringSync(src: Uint8Array): string; 556 /** 557 * Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. 558 * @since 8 559 * @syscap SystemCapability.Utils.Lang 560 * @param value A Uint8Array value or value A string value 561 * @return Return the decoded Uint8Array. 562 */ 563 decodeSync(src: Uint8Array | string): Uint8Array; 564 /** 565 * Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. 566 * @since 8 567 * @syscap SystemCapability.Utils.Lang 568 * @param value A Uint8Array value 569 * @return Return the encodes asynchronous new Uint8Array. 570 */ 571 encode(src: Uint8Array): Promise<Uint8Array>; 572 /** 573 * Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. 574 * @since 8 575 * @syscap SystemCapability.Utils.Lang 576 * @param value A Uint8Array value 577 * @return Returns the encoded asynchronous string. 578 */ 579 encodeToString(src: Uint8Array): Promise<string>; 580 /** 581 * Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array. 582 * @since 8 583 * @syscap SystemCapability.Utils.Lang 584 * @param value A Uint8Array value or value A string value 585 * @return Return the decoded asynchronous Uint8Array. 586 */ 587 decode(src: Uint8Array | string): Promise<Uint8Array>; 588 } 589 590 class types{ 591 /** 592 * The types constructor 593 * @since 8 594 * @syscap SystemCapability.Utils.Lang 595 * @param No input parameter is required. 596 * @return No return value. 597 */ 598 constructor(); 599 /** 600 * Check whether the entered value is of arraybuffer or sharedarraybuffer type. 601 * @since 8 602 * @syscap SystemCapability.Utils.Lang 603 * @param value A ArrayBuffer or SharedArrayBuffer value 604 * @Returns true if the value is a built-in ArrayBuffer or SharedArrayBuffer instance.. 605 */ 606 isAnyArrayBuffer(value: Object): boolean; 607 /** 608 * Check whether the type is included in the isAnyArrayBuffer. 609 * @since 8 610 * @syscap SystemCapability.Utils.Lang 611 * @param value A included in the isAnyArrayBuffer value 612 * @return Returns true if the value is an instance of one of the ArrayBuffer views, such as typed array objects or DataView. Equivalent to ArrayBuffer.isView(). 613 */ 614 isArrayBufferView(value: Object): boolean; 615 /** 616 * Check whether the entered value is an arguments object type. 617 * @since 8 618 * @syscap SystemCapability.Utils.Lang 619 * @param value A arguments value 620 * @return Returns true if the value is an arguments object. 621 */ 622 isArgumentsObject(value: Object): boolean; 623 /** 624 * Check whether the entered value is of arraybuffer type. 625 * @since 8 626 * @syscap SystemCapability.Utils.Lang 627 * @param value A arraybuffer value 628 * @return Returns true if the value is a built-in ArrayBuffer instance. This does not include SharedArrayBuffer instances. Usually, it is desirable to test for both; See isAnyArrayBuffer() for that. 629 */ 630 isArrayBuffer(value: Object): boolean; 631 /** 632 * Check whether the value entered is an asynchronous function type. 633 * @since 8 634 * @syscap SystemCapability.Utils.Lang 635 * @param value A async function value 636 * @return Returns true if the value is an async function. This only reports back what the JavaScript engine is seeing; in particular, the return value may not match the original source code if a transpilation tool was used. 637 */ 638 isAsyncFunction(value: Object): boolean; 639 /** 640 * Check whether the entered value is of bigint64array array type. 641 * @since 8 642 * @syscap SystemCapability.Utils.Lang 643 * @param value A BigInt64Array value 644 * @return Returns true if the value is a BigInt64Array instance. 645 */ 646 isBigInt64Array(value: Object): boolean; 647 /** 648 * Check whether the entered value is of biguint64array array array type. 649 * @since 8 650 * @syscap SystemCapability.Utils.Lang 651 * @param value A BigUint64Array value 652 * @return Returns true if the value is a BigUint64Array instance. 653 */ 654 isBigUint64Array(value: Object): boolean; 655 /** 656 * Check whether the entered value is a Boolean object type. 657 * @since 8 658 * @syscap SystemCapability.Utils.Lang 659 * @param value A boolean object value 660 * @return Returns true if the value is a boolean object, e.g. created by new Boolean(). 661 */ 662 isBooleanObject(value: Object): boolean; 663 /** 664 * Check whether the entered value is a Boolean or number or string or symbol object type. 665 * @since 8 666 * @syscap SystemCapability.Utils.Lang 667 * @param value A boxed primitive object value 668 * @return Returns true if the value is any boxed primitive object, e.g. created by new Boolean(), new String() or Object(Symbol()). 669 */ 670 isBoxedPrimitive(value: Object): boolean; 671 /** 672 * Check whether the entered value is of DataView type. 673 * @since 8 674 * @syscap SystemCapability.Utils.Lang 675 * @param value A DataView value 676 * @return Returns true if the value is a built-in DataView instance. 677 */ 678 isDataView(value: Object): boolean; 679 /** 680 * Check whether the entered value is of type date. 681 * @since 8 682 * @syscap SystemCapability.Utils.Lang 683 * @param value A Date value 684 * @return Returns true if the value is a built-in Date instance. 685 */ 686 isDate(value: Object): boolean; 687 /** 688 * Check whether the entered value is a native external value type. 689 * @since 8 690 * @syscap SystemCapability.Utils.Lang 691 * @param value A External value 692 * @return Returns true if the value is a native External value. 693 */ 694 isExternal(value: Object): boolean; 695 /** 696 * Check whether the entered value is of float32array array type. 697 * @since 8 698 * @syscap SystemCapability.Utils.Lang 699 * @param value A Float32Array value 700 * @return Returns true if the value is a built-in Float32Array instance. 701 */ 702 isFloat32Array(value: Object): boolean; 703 /** 704 * Check whether the entered value is of float64array array type. 705 * @since 8 706 * @syscap SystemCapability.Utils.Lang 707 * @param value A Float64Array value 708 * @return Returns true if the value is a built-in Float64Array instance. 709 */ 710 isFloat64Array(value: Object): boolean; 711 /** 712 * Check whether the input value is a generator function type. 713 * @since 8 714 * @syscap SystemCapability.Utils.Lang 715 * @param value A generator function value 716 * @return Returns true if the value is a generator function. This only reports back what the JavaScript engine is seeing; in particular, the return value may not match the original source code if a transpilation tool was used. 717 */ 718 isGeneratorFunction(value: Object): boolean; 719 /** 720 * Check whether the entered value is a generator object type. 721 * @since 8 722 * @syscap SystemCapability.Utils.Lang 723 * @param value A generator object value 724 * @return Returns true if the value is a generator object as returned from a built-in generator function. This only reports back what the JavaScript engine is seeing; in particular, the return value may not match the original source code if a transpilation tool was used. 725 */ 726 isGeneratorObject(value: Object): boolean; 727 /** 728 * Check whether the entered value is of int8array array type. 729 * @since 8 730 * @syscap SystemCapability.Utils.Lang 731 * @param value A Int8Array value 732 * @return Returns true if the value is a built-in Int8Array instance. 733 */ 734 isInt8Array(value: Object): boolean; 735 /** 736 * Check whether the entered value is the int16array type. 737 * @since 8 738 * @syscap SystemCapability.Utils.Lang 739 * @param value A Int16Array value 740 * @return Returns true if the value is a built-in Int16Array instance. 741 */ 742 isInt16Array(value: Object): boolean; 743 /** 744 * Check whether the entered value is the int32array array type. 745 * @since 8 746 * @syscap SystemCapability.Utils.Lang 747 * @param value A Int32Array value 748 * @return Returns true if the value is a built-in Int32Array instance. 749 */ 750 isInt32Array(value: Object): boolean; 751 /** 752 * Check whether the entered value is of map type. 753 * @since 8 754 * @syscap SystemCapability.Utils.Lang 755 * @param value A Map value 756 * @return Returns true if the value is a built-in Map instance. 757 */ 758 isMap(value: Object): boolean; 759 /** 760 * Check whether the entered value is the iterator type of map. 761 * @since 8 762 * @syscap SystemCapability.Utils.Lang 763 * @param value A Map iterator value 764 * @return Returns true if the value is an iterator returned for a built-in Map instance. 765 */ 766 isMapIterator(value: Object): boolean; 767 /** 768 * Check whether the entered value is the module namespace object object type. 769 * @since 8 770 * @syscap SystemCapability.Utils.Lang 771 * @param value A Module Namespace Object value 772 * @return Returns true if the value is an instance of a Module Namespace Object. 773 */ 774 isModuleNamespaceObject(value: Object): boolean; 775 /** 776 * Check whether the value entered is of type error. 777 * @since 8 778 * @syscap SystemCapability.Utils.Lang 779 * @param value A Error value 780 * @return Returns true if the value is an instance of a built-in Error type. 781 */ 782 isNativeError(value: Object): boolean; 783 /** 784 * Check whether the entered value is of the number object type. 785 * @since 8 786 * @syscap SystemCapability.Utils.Lang 787 * @param value A number object value 788 * @return Returns true if the value is a number object, e.g. created by new Number(). 789 */ 790 isNumberObject(value: Object): boolean; 791 /** 792 * Check whether the entered value is of promise type. 793 * @since 8 794 * @syscap SystemCapability.Utils.Lang 795 * @param value A Promise value 796 * @return Returns true if the value is a built-in Promise. 797 */ 798 isPromise(value: Object): boolean; 799 /** 800 * Check whether the value entered is of proxy type. 801 * @since 8 802 * @syscap SystemCapability.Utils.Lang 803 * @param value A Proxy value 804 * @return Returns true if the value is a Proxy instance. 805 */ 806 isProxy(value: Object): boolean; 807 /** 808 * Check whether the entered value is of type regexp. 809 * @since 8 810 * @syscap SystemCapability.Utils.Lang 811 * @param value A regular expression object value 812 * @return Returns true if the value is a regular expression object. 813 */ 814 isRegExp(value: Object): boolean; 815 /** 816 * Check whether the entered value is of type set. 817 * @since 8 818 * @syscap SystemCapability.Utils.Lang 819 * @param value A Set instance value 820 * @return Returns true if the value is a built-in Set instance. 821 */ 822 isSet(value: Object): boolean; 823 /** 824 * Check whether the entered value is the iterator type of set. 825 * @since 8 826 * @syscap SystemCapability.Utils.Lang 827 * @param value A Set iterator value 828 * @return Returns true if the value is an iterator returned for a built-in Set instance. 829 */ 830 isSetIterator(value: Object): boolean; 831 /** 832 * Check whether the entered value is of type sharedarraybuffer. 833 * @since 8 834 * @syscap SystemCapability.Utils.Lang 835 * @param value A SharedArrayBuffer instance value 836 * @return Returns true if the value is a built-in SharedArrayBuffer instance. This does not include ArrayBuffer instances. Usually, it is desirable to test for both; See isAnyArrayBuffer() for that. 837 */ 838 isSharedArrayBuffer(value: Object): boolean; 839 /** 840 * Check whether the entered value is a string object type. 841 * @since 8 842 * @syscap SystemCapability.Utils.Lang 843 * @param value A String object value 844 * @return Returns true if the value is a string object, e.g. created by new String(). 845 */ 846 isStringObject(value: Object): boolean; 847 /** 848 * Check whether the entered value is a symbol object type. 849 * @since 8 850 * @syscap SystemCapability.Utils.Lang 851 * @param value A symbol object value 852 * @return Returns true if the value is a symbol object, created by calling Object() on a Symbol primitive. 853 */ 854 isSymbolObject(value: Object): boolean; 855 /** 856 * Check whether the entered value is a type contained in typedarray. 857 * @since 8 858 * @syscap SystemCapability.Utils.Lang 859 * @param value A TypedArray instance value 860 * @return Returns true if the value is a built-in TypedArray instance. 861 */ 862 isTypedArray(value: Object): boolean; 863 /** 864 * Check whether the entered value is the uint8array array type. 865 * @since 8 866 * @syscap SystemCapability.Utils.Lang 867 * @param value A Uint8Array value 868 * @return Returns true if the value is a built-in Uint8Array instance. 869 */ 870 isUint8Array(value: Object): boolean; 871 /** 872 * Check whether the entered value is the uint8clapedarray array type. 873 * @since 8 874 * @syscap SystemCapability.Utils.Lang 875 * @param value A Uint8ClampedArray value 876 * @return Returns true if the value is a built-in Uint8ClampedArray instance. 877 */ 878 isUint8ClampedArray(value: Object): boolean; 879 /** 880 * Check whether the entered value is the uint16array array array type. 881 * @since 8 882 * @syscap SystemCapability.Utils.Lang 883 * @param value A Uint16Array value 884 * @return Returns true if the value is a built-in Uint16Array instance. 885 */ 886 isUint16Array(value: Object): boolean; 887 /** 888 * Check whether the entered value is the uint32array array type. 889 * @since 8 890 * @syscap SystemCapability.Utils.Lang 891 * @param value A Uint32Array value 892 * @return Returns true if the value is a built-in Uint32Array instance. 893 */ 894 isUint32Array(value: Object): boolean; 895 /** 896 * Check whether the entered value is of type weakmap. 897 * @since 8 898 * @syscap SystemCapability.Utils.Lang 899 * @param value A WeakMap value 900 * @return Returns true if the value is a built-in WeakMap instance. 901 */ 902 isWeakMap(value: Object): boolean; 903 /** 904 * Check whether the entered value is of type weakset. 905 * @since 8 906 * @syscap SystemCapability.Utils.Lang 907 * @param value A WeakSet value 908 * @return Returns true if the value is a built-in WeakSet instance. 909 */ 910 isWeakSet(value: Object): boolean; 911 } 912} 913export default util; 914