Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AnyValueArray

Cross-language implementation of dynamic object array what can hold values of any type. The stored values can be converted to different types using variety of accessor methods.

Example

let value1 = new AnyValueArray([1, "123.456", "2018-01-01"]);

value1.getAsBoolean(0);   // Result: true
value1.getAsInteger(1);   // Result: 123
value1.getAsFloat(1);     // Result: 123.456
value1.getAsDateTime(2);  // Result: new Date(2018,0,1)
see

StringConverter

see

TypeConverter

see

BooleanConverter

see

IntegerConverter

see

LongConverter

see

DoubleConverter

see

FloatConverter

see

DateTimeConverter

see

ICloneable

Hierarchy

  • Array<any>
    • AnyValueArray

Implements

Indexable

[n: number]: any

Cross-language implementation of dynamic object array what can hold values of any type. The stored values can be converted to different types using variety of accessor methods.

Example

let value1 = new AnyValueArray([1, "123.456", "2018-01-01"]);

value1.getAsBoolean(0);   // Result: true
value1.getAsInteger(1);   // Result: 123
value1.getAsFloat(1);     // Result: 123.456
value1.getAsDateTime(2);  // Result: new Date(2018,0,1)

Index

Constructors

constructor

  • Creates a new instance of the array and assigns its value.

    Parameters

    • Default value values: any[] = null

    Returns AnyValueArray

Properties

Static Array

Array: ArrayConstructor

Static length

length: number

Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.

Methods

append

  • append(elements: any[]): void
  • Appends new elements to this array.

    Parameters

    • elements: any[]

      a list of elements to be added.

    Returns void

clear

  • clear(): void
  • Clears this array by removing all its elements.

    Returns void

clone

  • clone(): any
  • Creates a binary clone of this object.

    Returns any

    a clone of this object.

contains

  • contains(value: any): boolean
  • Checks if this array contains a value. The check uses direct comparison between elements and the specified value.

    Parameters

    • value: any

      a value to be checked

    Returns boolean

    true if this array contains the value or false otherwise.

containsAsType

  • containsAsType<T>(typeCode: TypeCode, value: any): boolean
  • Checks if this array contains a value. The check before comparison converts elements and the value to type specified by type code.

    see

    TypeConverter.toType

    see

    TypeConverter.toNullableType

    Type parameters

    • T

    Parameters

    • typeCode: TypeCode

      a type code that defines a type to convert values before comparison

    • value: any

      a value to be checked

    Returns boolean

    true if this array contains the value or false otherwise.

get

  • get(index: number): any
  • Gets an array element specified by its index.

    Parameters

    • index: number

      an index of the element to get.

    Returns any

    the value of the array element.

getAsArray

  • Converts array element into an AnyValueArray or returns empty AnyValueArray if conversion is not possible.

    see

    fromValue

    Parameters

    • index: number

      an index of element to get.

    Returns AnyValueArray

    AnyValueArray value of the element or empty AnyValueArray if conversion is not supported.

getAsArrayWithDefault

  • Converts array element into an AnyValueArray or returns default value if conversion is not possible.

    see

    getAsNullableArray

    Parameters

    • index: number

      an index of element to get.

    • defaultValue: AnyValueArray

      the default value

    Returns AnyValueArray

    AnyValueArray value of the element or default value if conversion is not supported.

getAsBoolean

  • getAsBoolean(index: number): boolean
  • Converts array element into a boolean or returns false if conversion is not possible.

    see

    getAsBooleanWithDefault

    Parameters

    • index: number

      an index of element to get.

    Returns boolean

    boolean value ot the element or false if conversion is not supported.

getAsBooleanWithDefault

  • getAsBooleanWithDefault(index: number, defaultValue: boolean): boolean
  • Converts array element into a boolean or returns default value if conversion is not possible.

    see

    BooleanConverter.toBooleanWithDefault

    Parameters

    • index: number

      an index of element to get.

    • defaultValue: boolean

      the default value

    Returns boolean

    boolean value ot the element or default value if conversion is not supported.

getAsDateTime

  • getAsDateTime(index: number): Date
  • Converts array element into a Date or returns the current date if conversion is not possible.

    see

    getAsDateTimeWithDefault

    Parameters

    • index: number

      an index of element to get.

    Returns Date

    Date value ot the element or the current date if conversion is not supported.

getAsDateTimeWithDefault

  • getAsDateTimeWithDefault(index: number, defaultValue: Date): Date
  • Converts array element into a Date or returns default value if conversion is not possible.

    see

    DateTimeConverter.toDateTimeWithDefault

    Parameters

    • index: number

      an index of element to get.

    • defaultValue: Date

      the default value

    Returns Date

    Date value ot the element or default value if conversion is not supported.

getAsDouble

  • getAsDouble(index: number): number
  • Converts array element into a double or returns 0 if conversion is not possible.

    see

    getAsDoubleWithDefault

    Parameters

    • index: number

      an index of element to get.

    Returns number

    double value ot the element or 0 if conversion is not supported.

getAsDoubleWithDefault

  • getAsDoubleWithDefault(index: number, defaultValue: number): number
  • Converts array element into a double or returns default value if conversion is not possible.

    see

    DoubleConverter.toDoubleWithDefault

    Parameters

    • index: number

      an index of element to get.

    • defaultValue: number

      the default value

    Returns number

    double value ot the element or default value if conversion is not supported.

getAsFloat

  • getAsFloat(index: number): number
  • Converts array element into a float or returns 0 if conversion is not possible.

    see

    getAsFloatWithDefault

    Parameters

    • index: number

      an index of element to get.

    Returns number

    float value ot the element or 0 if conversion is not supported.

getAsFloatWithDefault

  • getAsFloatWithDefault(index: number, defaultValue: number): number
  • Converts array element into a float or returns default value if conversion is not possible.

    see

    FloatConverter.toFloatWithDefault

    Parameters

    • index: number

      an index of element to get.

    • defaultValue: number

      the default value

    Returns number

    float value ot the element or default value if conversion is not supported.

getAsInteger

  • getAsInteger(index: number): number
  • Converts array element into an integer or returns 0 if conversion is not possible.

    see

    getAsIntegerWithDefault

    Parameters

    • index: number

      an index of element to get.

    Returns number

    integer value ot the element or 0 if conversion is not supported.

getAsIntegerWithDefault

  • getAsIntegerWithDefault(index: number, defaultValue: number): number
  • Converts array element into an integer or returns default value if conversion is not possible.

    see

    IntegerConverter.toIntegerWithDefault

    Parameters

    • index: number

      an index of element to get.

    • defaultValue: number

      the default value

    Returns number

    integer value ot the element or default value if conversion is not supported.

getAsLong

  • getAsLong(index: number): number
  • Converts array element into a long or returns 0 if conversion is not possible.

    see

    getAsLongWithDefault

    Parameters

    • index: number

      an index of element to get.

    Returns number

    long value ot the element or 0 if conversion is not supported.

getAsLongWithDefault

  • getAsLongWithDefault(index: number, defaultValue: number): number
  • Converts array element into a long or returns default value if conversion is not possible.

    see

    LongConverter.toLongWithDefault

    Parameters

    • index: number

      an index of element to get.

    • defaultValue: number

      the default value

    Returns number

    long value ot the element or default value if conversion is not supported.

getAsMap

  • Converts array element into an AnyValueMap or returns empty AnyValueMap if conversion is not possible.

    see

    AnyValueMap

    see

    AnyValueMap.fromValue

    Parameters

    • index: number

      an index of element to get.

    Returns AnyValueMap

    AnyValueMap value of the element or empty AnyValueMap if conversion is not supported.

getAsMapWithDefault

  • Converts array element into an AnyValueMap or returns default value if conversion is not possible.

    see

    getAsNullableMap

    Parameters

    • index: number

      an index of element to get.

    • defaultValue: AnyValueMap

      the default value

    Returns AnyValueMap

    AnyValueMap value of the element or default value if conversion is not supported.

getAsNullableArray

  • Converts array element into an AnyValueArray or returns null if conversion is not possible.

    see

    fromValue

    Parameters

    • index: number

      an index of element to get.

    Returns AnyValueArray

    AnyValueArray value of the element or null if conversion is not supported.

getAsNullableBoolean

  • getAsNullableBoolean(index: number): boolean
  • Converts array element into a boolean or returns null if conversion is not possible.

    see

    BooleanConverter.toNullableBoolean

    Parameters

    • index: number

      an index of element to get.

    Returns boolean

    boolean value of the element or null if conversion is not supported.

getAsNullableDateTime

  • getAsNullableDateTime(index: number): Date
  • Converts array element into a Date or returns null if conversion is not possible.

    see

    DateTimeConverter.toNullableDateTime

    Parameters

    • index: number

      an index of element to get.

    Returns Date

    Date value of the element or null if conversion is not supported.

getAsNullableDouble

  • getAsNullableDouble(index: number): number
  • Converts array element into a double or returns null if conversion is not possible.

    see

    DoubleConverter.toNullableDouble

    Parameters

    • index: number

      an index of element to get.

    Returns number

    double value of the element or null if conversion is not supported.

getAsNullableFloat

  • getAsNullableFloat(index: number): number
  • Converts array element into a float or returns null if conversion is not possible.

    see

    FloatConverter.toNullableFloat

    Parameters

    • index: number

      an index of element to get.

    Returns number

    float value of the element or null if conversion is not supported.

getAsNullableInteger

  • getAsNullableInteger(index: number): number
  • Converts array element into an integer or returns null if conversion is not possible.

    see

    IntegerConverter.toNullableInteger

    Parameters

    • index: number

      an index of element to get.

    Returns number

    integer value of the element or null if conversion is not supported.

getAsNullableLong

  • getAsNullableLong(index: number): number
  • Converts array element into a long or returns null if conversion is not possible.

    see

    LongConverter.toNullableLong

    Parameters

    • index: number

      an index of element to get.

    Returns number

    long value of the element or null if conversion is not supported.

getAsNullableMap

  • Converts array element into an AnyValueMap or returns null if conversion is not possible.

    see

    AnyValueMap

    see

    AnyValueMap.fromValue

    Parameters

    • index: number

      an index of element to get.

    Returns AnyValueMap

    AnyValueMap value of the element or null if conversion is not supported.

getAsNullableString

  • getAsNullableString(index: number): string
  • Converts array element into a string or returns null if conversion is not possible.

    see

    StringConverter.toNullableString

    Parameters

    • index: number

      an index of element to get.

    Returns string

    string value of the element or null if conversion is not supported.

getAsNullableType

  • getAsNullableType<T>(type: TypeCode, index: number): T
  • Converts array element into a value defined by specied typecode. If conversion is not possible it returns null.

    see

    TypeConverter.toNullableType

    Type parameters

    • T

    Parameters

    • type: TypeCode

      the TypeCode that defined the type of the result

    • index: number

      an index of element to get.

    Returns T

    element value defined by the typecode or null if conversion is not supported.

getAsObject

  • getAsObject(index?: number): any
  • Gets the value stored in array element without any conversions. When element index is not defined it returns the entire array value.

    Parameters

    • Default value index: number = undefined

      (optional) an index of the element to get

    Returns any

    the element value or value of the array when index is not defined.

getAsString

  • getAsString(index: number): string
  • Converts array element into a string or returns "" if conversion is not possible.

    see

    getAsStringWithDefault

    Parameters

    • index: number

      an index of element to get.

    Returns string

    string value ot the element or "" if conversion is not supported.

getAsStringWithDefault

  • getAsStringWithDefault(index: number, defaultValue: string): string
  • Converts array element into a string or returns default value if conversion is not possible.

    see

    StringConverter.toStringWithDefault

    Parameters

    • index: number

      an index of element to get.

    • defaultValue: string

      the default value

    Returns string

    string value ot the element or default value if conversion is not supported.

getAsType

  • getAsType<T>(type: TypeCode, index: number): T
  • Converts array element into a value defined by specied typecode. If conversion is not possible it returns default value for the specified type.

    see

    getAsTypeWithDefault

    Type parameters

    • T

    Parameters

    • type: TypeCode

      the TypeCode that defined the type of the result

    • index: number

      an index of element to get.

    Returns T

    element value defined by the typecode or default if conversion is not supported.

getAsTypeWithDefault

  • getAsTypeWithDefault<T>(type: TypeCode, index: number, defaultValue: T): T
  • Converts array element into a value defined by specied typecode. If conversion is not possible it returns default value.

    see

    TypeConverter.toTypeWithDefault

    Type parameters

    • T

    Parameters

    • type: TypeCode

      the TypeCode that defined the type of the result

    • index: number

      an index of element to get.

    • defaultValue: T

      the default value

    Returns T

    element value defined by the typecode or default value if conversion is not supported.

getAsValue

  • Converts array element into an AnyValue or returns an empty AnyValue if conversion is not possible.

    see

    AnyValue

    see

    AnyValue.constructor

    Parameters

    • index: number

      an index of element to get.

    Returns AnyValue

    AnyValue value of the element or empty AnyValue if conversion is not supported.

put

  • put(index: number, value: any): void
  • Puts a new value into array element specified by its index.

    Parameters

    • index: number

      an index of the element to put.

    • value: any

      a new value for array element.

    Returns void

remove

  • remove(index: number): void
  • Removes an array element specified by its index

    Parameters

    • index: number

      an index of the element to remove.

    Returns void

setAsObject

  • setAsObject(index: any, value?: any): void
  • Sets a new value to array element specified by its index. When the index is not defined, it resets the entire array value. This method has double purpose because method overrides are not supported in JavaScript.

    see

    ArrayConverter.toArray

    Parameters

    • index: any

      (optional) an index of the element to set

    • Default value value: any = undefined

      a new element or array value.

    Returns void

toString

  • toString(): string
  • Gets a string representation of the object. The result is a comma-separated list of string representations of individual elements as "value1,value2,value3"

    see

    StringConverter.toString

    Returns string

    a string representation of the object.

Static __@iterator

  • __@iterator(): IterableIterator<any>
  • Iterator

    Returns IterableIterator<any>

Static __@unscopables

  • __@unscopables(): object
  • Returns an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.

    Returns object

    • copyWithin: boolean
    • entries: boolean
    • fill: boolean
    • find: boolean
    • findIndex: boolean
    • keys: boolean
    • values: boolean

Static concat

  • concat(...items: ConcatArray<any>[]): any[]
  • concat(...items: (T | ConcatArray<T>)[]): any[]
  • Combines two or more arrays.

    Parameters

    • Rest ...items: ConcatArray<any>[]

      Additional items to add to the end of array1.

    Returns any[]

  • Combines two or more arrays.

    Parameters

    • Rest ...items: (T | ConcatArray<T>)[]

      Additional items to add to the end of array1.

    Returns any[]

Static copyWithin

  • copyWithin(target: number, start: number, end?: number): this
  • Returns the this object after copying a section of the array identified by start and end to the same array starting at position target

    Parameters

    • target: number

      If target is negative, it is treated as length+target where length is the length of the array.

    • start: number

      If start is negative, it is treated as length+start. If end is negative, it is treated as length+end.

    • Optional end: number

      If not specified, length of the this object is used as its default value.

    Returns this

Static entries

  • entries(): IterableIterator<[number, any]>
  • Returns an iterable of key, value pairs for every entry in the array

    Returns IterableIterator<[number, any]>

Static every

  • every(callbackfn: function, thisArg?: any): boolean
  • Determines whether all the members of an array satisfy the specified test.

    Parameters

    • callbackfn: function

      A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.

        • (value: any, index: number, array: any[]): boolean
        • Parameters

          • value: any
          • index: number
          • array: any[]

          Returns boolean

    • Optional thisArg: any

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    Returns boolean

Static fill

  • fill(value: any, start?: number, end?: number): this
  • Returns the this object after filling the section identified by start and end with value

    Parameters

    • value: any

      value to fill array section with

    • Optional start: number

      index to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array.

    • Optional end: number

      index to stop filling the array at. If end is negative, it is treated as length+end.

    Returns this

Static filter

  • filter<S>(callbackfn: function, thisArg?: any): S[]
  • filter(callbackfn: function, thisArg?: any): any[]
  • Returns the elements of an array that meet the condition specified in a callback function.

    Type parameters

    • S: any

    Parameters

    • callbackfn: function

      A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.

        • (value: any, index: number, array: any[]): boolean
        • Parameters

          • value: any
          • index: number
          • array: any[]

          Returns boolean

    • Optional thisArg: any

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    Returns S[]

  • Returns the elements of an array that meet the condition specified in a callback function.

    Parameters

    • callbackfn: function

      A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.

        • (value: any, index: number, array: any[]): any
        • Parameters

          • value: any
          • index: number
          • array: any[]

          Returns any

    • Optional thisArg: any

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    Returns any[]

Static find

  • find<S>(predicate: function, thisArg?: any): S | undefined
  • find(predicate: function, thisArg?: any): any | undefined
  • Returns the value of the first element in the array where predicate is true, and undefined otherwise.

    Type parameters

    • S: any

    Parameters

    • predicate: function

      find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

        • (this: void, value: any, index: number, obj: any[]): boolean
        • Parameters

          • this: void
          • value: any
          • index: number
          • obj: any[]

          Returns boolean

    • Optional thisArg: any

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    Returns S | undefined

  • Parameters

    • predicate: function
        • (value: any, index: number, obj: any[]): boolean
        • Parameters

          • value: any
          • index: number
          • obj: any[]

          Returns boolean

    • Optional thisArg: any

    Returns any | undefined

Static findIndex

  • findIndex(predicate: function, thisArg?: any): number
  • Returns the index of the first element in the array where predicate is true, and -1 otherwise.

    Parameters

    • predicate: function

      find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.

        • (value: any, index: number, obj: any[]): boolean
        • Parameters

          • value: any
          • index: number
          • obj: any[]

          Returns boolean

    • Optional thisArg: any

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    Returns number

Static forEach

  • forEach(callbackfn: function, thisArg?: any): void
  • Performs the specified action for each element in an array.

    Parameters

    • callbackfn: function

      A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

        • (value: any, index: number, array: any[]): void
        • Parameters

          • value: any
          • index: number
          • array: any[]

          Returns void

    • Optional thisArg: any

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    Returns void

Static fromString

  • fromString(values: string, separator: string, removeDuplicates?: boolean): AnyValueArray
  • Splits specified string into elements using a separator and assigns the elements to a newly created AnyValueArray.

    Parameters

    • values: string

      a string value to be split and assigned to AnyValueArray

    • separator: string

      a separator to split the string

    • Default value removeDuplicates: boolean = false

      (optional) true to remove duplicated elements

    Returns AnyValueArray

    a newly created AnyValueArray.

Static fromValue

  • Converts specified value into AnyValueArray.

    see

    ArrayConverter.toNullableArray

    Parameters

    • value: any

      value to be converted

    Returns AnyValueArray

    a newly created AnyValueArray.

Static fromValues

  • Creates a new AnyValueArray from a list of values

    Parameters

    • Rest ...values: any[]

      a list of values to initialize the created AnyValueArray

    Returns AnyValueArray

    a newly created AnyValueArray.

Static indexOf

  • indexOf(searchElement: any, fromIndex?: number): number
  • Returns the index of the first occurrence of a value in an array.

    Parameters

    • searchElement: any

      The value to locate in the array.

    • Optional fromIndex: number

      The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

    Returns number

Static join

  • join(separator?: string): string
  • Adds all the elements of an array separated by the specified separator string.

    Parameters

    • Optional separator: string

      A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.

    Returns string

Static keys

  • keys(): IterableIterator<number>
  • Returns an iterable of keys in the array

    Returns IterableIterator<number>

Static lastIndexOf

  • lastIndexOf(searchElement: any, fromIndex?: number): number
  • Returns the index of the last occurrence of a specified value in an array.

    Parameters

    • searchElement: any

      The value to locate in the array.

    • Optional fromIndex: number

      The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.

    Returns number

Static map

  • map<U>(callbackfn: function, thisArg?: any): U[]
  • Calls a defined callback function on each element of an array, and returns an array that contains the results.

    Type parameters

    • U

    Parameters

    • callbackfn: function

      A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

        • (value: any, index: number, array: any[]): U
        • Parameters

          • value: any
          • index: number
          • array: any[]

          Returns U

    • Optional thisArg: any

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    Returns U[]

Static pop

  • pop(): any | undefined
  • Removes the last element from an array and returns it.

    Returns any | undefined

Static push

  • push(...items: any[]): number
  • Appends new elements to an array, and returns the new length of the array.

    Parameters

    • Rest ...items: any[]

      New elements of the Array.

    Returns number

Static reduce

  • reduce(callbackfn: function): any
  • reduce(callbackfn: function, initialValue: any): any
  • reduce<U>(callbackfn: function, initialValue: U): U
  • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    Parameters

    • callbackfn: function

      A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

        • (previousValue: any, currentValue: any, currentIndex: number, array: any[]): any
        • Parameters

          • previousValue: any
          • currentValue: any
          • currentIndex: number
          • array: any[]

          Returns any

    Returns any

  • Parameters

    • callbackfn: function
        • (previousValue: any, currentValue: any, currentIndex: number, array: any[]): any
        • Parameters

          • previousValue: any
          • currentValue: any
          • currentIndex: number
          • array: any[]

          Returns any

    • initialValue: any

    Returns any

  • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    Type parameters

    • U

    Parameters

    • callbackfn: function

      A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

        • (previousValue: U, currentValue: any, currentIndex: number, array: any[]): U
        • Parameters

          • previousValue: U
          • currentValue: any
          • currentIndex: number
          • array: any[]

          Returns U

    • initialValue: U

      If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

    Returns U

Static reduceRight

  • reduceRight(callbackfn: function): any
  • reduceRight(callbackfn: function, initialValue: any): any
  • reduceRight<U>(callbackfn: function, initialValue: U): U
  • Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    Parameters

    • callbackfn: function

      A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

        • (previousValue: any, currentValue: any, currentIndex: number, array: any[]): any
        • Parameters

          • previousValue: any
          • currentValue: any
          • currentIndex: number
          • array: any[]

          Returns any

    Returns any

  • Parameters

    • callbackfn: function
        • (previousValue: any, currentValue: any, currentIndex: number, array: any[]): any
        • Parameters

          • previousValue: any
          • currentValue: any
          • currentIndex: number
          • array: any[]

          Returns any

    • initialValue: any

    Returns any

  • Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    Type parameters

    • U

    Parameters

    • callbackfn: function

      A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

        • (previousValue: U, currentValue: any, currentIndex: number, array: any[]): U
        • Parameters

          • previousValue: U
          • currentValue: any
          • currentIndex: number
          • array: any[]

          Returns U

    • initialValue: U

      If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

    Returns U

Static reverse

  • reverse(): any[]
  • Reverses the elements in an Array.

    Returns any[]

Static shift

  • shift(): any | undefined
  • Removes the first element from an array and returns it.

    Returns any | undefined

Static slice

  • slice(start?: number, end?: number): any[]
  • Returns a section of an array.

    Parameters

    • Optional start: number

      The beginning of the specified portion of the array.

    • Optional end: number

      The end of the specified portion of the array.

    Returns any[]

Static some

  • some(callbackfn: function, thisArg?: any): boolean
  • Determines whether the specified callback function returns true for any element of an array.

    Parameters

    • callbackfn: function

      A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.

        • (value: any, index: number, array: any[]): boolean
        • Parameters

          • value: any
          • index: number
          • array: any[]

          Returns boolean

    • Optional thisArg: any

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    Returns boolean

Static sort

  • sort(compareFn?: function): this
  • Sorts an array.

    Parameters

    • Optional compareFn: function

      The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.

        • (a: any, b: any): number
        • Parameters

          • a: any
          • b: any

          Returns number

    Returns this

Static splice

  • splice(start: number, deleteCount?: number): any[]
  • splice(start: number, deleteCount: number, ...items: any[]): any[]
  • Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.

    Parameters

    • start: number

      The zero-based location in the array from which to start removing elements.

    • Optional deleteCount: number

      The number of elements to remove.

    Returns any[]

  • Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.

    Parameters

    • start: number

      The zero-based location in the array from which to start removing elements.

    • deleteCount: number

      The number of elements to remove.

    • Rest ...items: any[]

      Elements to insert into the array in place of the deleted elements.

    Returns any[]

Static toLocaleString

  • toLocaleString(): string
  • Returns a string representation of an array. The elements are converted to string using thier toLocalString methods.

    Returns string

Static toString

  • toString(): string
  • Returns a string representation of an array.

    Returns string

Static unshift

  • unshift(...items: any[]): number
  • Inserts new elements at the start of an array.

    Parameters

    • Rest ...items: any[]

      Elements to insert at the start of the Array.

    Returns number

Static values

  • values(): IterableIterator<any>
  • Returns an iterable of values in the array

    Returns IterableIterator<any>

Generated using TypeDoc