Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

  • Type

Hierarchy

  • Array<Type>
    • Yarra

Index

Constructors

constructor

  • new Yarra<Type>(args: Iterable<Type>): Yarra<Type>
  • new Yarra<Type>(...args: Type[]): Yarra<Type>
  • Takes values and creates a Yarra

    Type parameters

    • Type

    Parameters

    • args: Iterable<Type>

      Iterable or Items rested

    Returns Yarra<Type>

  • Type parameters

    • Type

    Parameters

    • Rest ...args: Type[]

    Returns Yarra<Type>

Properties

length

length: number

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

toCycleGenerator

toCycleGenerator: () => Generator<any, never, unknown>

Type declaration

    • (): Generator<any, never, unknown>
    • Returns Generator<any, never, unknown>

toGenerator

toGenerator: () => Generator<any, void, unknown>

Type declaration

    • (): Generator<any, void, unknown>
    • Returns Generator<any, void, unknown>

Static Readonly [Symbol.species]

[Symbol.species]: ArrayConstructor

Accessors

dimensions

  • get dimensions(): Yarra<number>

full

  • get full(): Yarra<[Type, number]>
  • Gets Yarra as entries with values then number tuple

    Returns Yarra<[Type, number]>

head

  • get head(): Type

last

  • get last(): Type

size

  • get size(): number

Methods

[Symbol.iterator]

  • [Symbol.iterator](): IterableIterator<Type>
  • Iterator

    Returns IterableIterator<Type>

[Symbol.unscopables]

  • [Symbol.unscopables](): { copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: boolean; values: boolean }
  • Returns an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.

    Returns { copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: boolean; values: boolean }

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

add

allIndexOf

  • allIndexOf(v: any, loose?: boolean): number[]
  • Parameters

    • v: any
    • loose: boolean = false

    Returns number[]

at

  • at(indices: number[]): Yarra<Type>
  • at(...indices: number[]): Yarra<Type>

average

  • average(): number

chunk

  • chunk(n: number): any[]
  • Generate array in chunks of size n

    Parameters

    • n: number

      Chunk size

    Returns any[]

clone

compact

  • compact(): Type[]
  • Get back truthy values (removes undefined and other falsy values)

    Returns Type[]

concat

  • concat(...args: any[]): Yarra<Type>

concatMutate

  • concatMutate(...args: any[]): Yarra<Type>

copyWithin

  • copyWithin(target: number, start: number, end?: number): Yarra<Type>
  • 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 Yarra<Type>

count

  • count(f?: BooleanConstructor): number
  • Get count of occurrences of truth results from function

    Parameters

    • f: BooleanConstructor = ...

    Returns number

cover

  • cover(n?: number): Yarra<any>
  • Wraps content in Yarra n times

    Parameters

    • n: number = 1

      Wrapping count

    Returns Yarra<any>

deepMap

  • deepMap(f: (x: Type, indices: number[]) => any): Yarra<any>
  • Parameters

    • f: (x: Type, indices: number[]) => any
        • (x: Type, indices: number[]): any
        • Parameters

          • x: Type
          • indices: number[]

          Returns any

    Returns Yarra<any>

dropWhile

  • dropWhile(f: (x: Type, i: number) => boolean): Yarra<Type>
  • Parameters

    • f: (x: Type, i: number) => boolean
        • (x: Type, i: number): boolean
        • Parameters

          • x: Type
          • i: number

          Returns boolean

    Returns Yarra<Type>

dropWhileRight

  • dropWhileRight(f: (x: Type, i: number) => boolean): Yarra<Type>
  • Parameters

    • f: (x: Type, i: number) => boolean
        • (x: Type, i: number): boolean
        • Parameters

          • x: Type
          • i: number

          Returns boolean

    Returns Yarra<Type>

elementWise

  • elementWise(arr: Yarra<any>, f: (a: Type, b: any, i: any) => any, singleDimension?: boolean): Yarra<any>
  • Similar to map, but with two arrays

    Parameters

    • arr: Yarra<any>
    • f: (a: Type, b: any, i: any) => any

      Mapping function

        • (a: Type, b: any, i: any): any
        • Parameters

          • a: Type
          • b: any
          • i: any

          Returns any

    • singleDimension: boolean = false

    Returns Yarra<any>

entries

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

    Returns IterableIterator<[number, Type]>

equals

  • equals(rhs: any[], loose?: boolean): boolean
  • Parameters

    • rhs: any[]
    • loose: boolean = false

    Returns boolean

equalsWith

  • equalsWith(rhs: any[], f: (a: Type, b: any, i: number) => boolean): boolean
  • Parameters

    • rhs: any[]
    • f: (a: Type, b: any, i: number) => boolean
        • (a: Type, b: any, i: number): boolean
        • Parameters

          • a: Type
          • b: any
          • i: number

          Returns boolean

    Returns boolean

every

  • every<S>(predicate: (value: Type, index: number, array: Type[]) => value is S, thisArg?: any): this is S[]
  • every(predicate: (value: Type, index: number, array: Type[]) => unknown, thisArg?: any): boolean
  • Determines whether all the members of an array satisfy the specified test.

    Type parameters

    • S

    Parameters

    • predicate: (value: Type, index: number, array: Type[]) => value is S

      A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

        • (value: Type, index: number, array: Type[]): value is S
        • Parameters

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

          Returns value is S

    • Optional thisArg: any

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

    Returns this is S[]

  • Determines whether all the members of an array satisfy the specified test.

    Parameters

    • predicate: (value: Type, index: number, array: Type[]) => unknown

      A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

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

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

          Returns unknown

    • Optional thisArg: any

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

    Returns boolean

fill

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

    Parameters

    • value: Type

      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 Yarra<Type>

filter

  • filter<S>(predicate: (value: Type, index: number, array: Type[]) => value is S, thisArg?: any): S[]
  • filter(predicate: (value: Type, index: number, array: Type[]) => unknown, thisArg?: any): Type[]
  • Returns the elements of an array that meet the condition specified in a callback function.

    Type parameters

    • S

    Parameters

    • predicate: (value: Type, index: number, array: Type[]) => value is S

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

        • (value: Type, index: number, array: Type[]): value is S
        • Parameters

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

          Returns value is S

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate 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

    • predicate: (value: Type, index: number, array: Type[]) => unknown

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

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

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

          Returns unknown

    • Optional thisArg: any

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

    Returns Type[]

filterFull

  • filterFull(f: (value: Type, index: number, array: Type[]) => boolean, thisArg?: any): [Type, number][]
  • Parameters

    • f: (value: Type, index: number, array: Type[]) => boolean
        • (value: Type, index: number, array: Type[]): boolean
        • Parameters

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

          Returns boolean

    • Optional thisArg: any

    Returns [Type, number][]

filterMutate

  • filterMutate(f: (value: Type, index: number, array: Type[]) => boolean, thisArg?: any): any
  • Parameters

    • f: (value: Type, index: number, array: Type[]) => boolean
        • (value: Type, index: number, array: Type[]): boolean
        • Parameters

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

          Returns boolean

    • Optional thisArg: any

    Returns any

find

  • find<S>(predicate: (value: Type, index: number, obj: Type[]) => value is S, thisArg?: any): S
  • find(predicate: (value: Type, index: number, obj: Type[]) => unknown, thisArg?: any): Type
  • Returns the value of the first element in the array where predicate is true, and undefined otherwise.

    Type parameters

    • S

    Parameters

    • predicate: (value: Type, index: number, obj: Type[]) => value is S

      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.

        • (value: Type, index: number, obj: Type[]): value is S
        • Parameters

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

          Returns value is S

    • 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

  • Parameters

    • predicate: (value: Type, index: number, obj: Type[]) => unknown
        • (value: Type, index: number, obj: Type[]): unknown
        • Parameters

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

          Returns unknown

    • Optional thisArg: any

    Returns Type

findAllIndex

  • findAllIndex(f: (value: Type) => boolean): number[]
  • Parameters

    • f: (value: Type) => boolean
        • (value: Type): boolean
        • Parameters

          • value: Type

          Returns boolean

    Returns number[]

findFull

  • findFull(f: (value: Type) => boolean): (number | Type)[]
  • Parameters

    • f: (value: Type) => boolean
        • (value: Type): boolean
        • Parameters

          • value: Type

          Returns boolean

    Returns (number | Type)[]

findIndex

  • findIndex(predicate: (value: Type, index: number, obj: Type[]) => unknown, thisArg?: any): number
  • Returns the index of the first element in the array where predicate is true, and -1 otherwise.

    Parameters

    • predicate: (value: Type, index: number, obj: Type[]) => unknown

      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: Type, index: number, obj: Type[]): unknown
        • Parameters

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

          Returns unknown

    • 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

findLast

  • findLast(f: (value: Type) => boolean): Type
  • Parameters

    • f: (value: Type) => boolean
        • (value: Type): boolean
        • Parameters

          • value: Type

          Returns boolean

    Returns Type

findLastFull

  • findLastFull(f: (value: Type) => boolean): (number | Type)[]
  • Parameters

    • f: (value: Type) => boolean
        • (value: Type): boolean
        • Parameters

          • value: Type

          Returns boolean

    Returns (number | Type)[]

findLastIndex

  • findLastIndex(f: (value: Type) => boolean): number
  • Parameters

    • f: (value: Type) => boolean
        • (value: Type): boolean
        • Parameters

          • value: Type

          Returns boolean

    Returns number

flat

  • flat<A, D>(depth?: D): FlatArray<A, D>[]
  • Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

    Type parameters

    • A

    • D: number = 1

    Parameters

    • Optional depth: D

      The maximum recursion depth

    Returns FlatArray<A, D>[]

flatMap

  • flatMap<U, This>(callback: (value: Type, index: number, array: Type[]) => U | readonly U[], thisArg?: This): U[]
  • Calls a defined callback function on each element of an array. Then, flattens the result into a new array. This is identical to a map followed by flat with depth 1.

    Type parameters

    • U

    • This = undefined

    Parameters

    • callback: (value: Type, index: number, array: Type[]) => U | readonly U[]

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

        • (value: Type, index: number, array: Type[]): U | readonly U[]
        • Parameters

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

          Returns U | readonly U[]

    • Optional thisArg: This

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

    Returns U[]

flattenDeep

  • flattenDeep(): any[]

forEach

  • forEach(callbackfn: (value: Type, index: number, array: Type[]) => void, thisArg?: any): void
  • Performs the specified action for each element in an array.

    Parameters

    • callbackfn: (value: Type, index: number, array: Type[]) => void

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

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

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

          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

get

  • get(...indices: number[]): any
  • Gets value at path of indices

    Parameters

    • Rest ...indices: number[]

    Returns any

getFrom

  • getFrom(template: any[]): Yarra<unknown>

includes

  • includes(searchElement: Type, fromIndex?: number): boolean
  • Determines whether an array includes a certain element, returning true or false as appropriate.

    Parameters

    • searchElement: Type

      The element to search for.

    • Optional fromIndex: number

      The position in this array at which to begin searching for searchElement.

    Returns boolean

indexOf

  • indexOf(searchElement: Type, fromIndex?: number): number
  • Returns the index of the first occurrence of a value in an array, or -1 if it is not present.

    Parameters

    • searchElement: Type

      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

initial

  • initial(n?: number): Type[]
  • Gets Yarra excluding last n elements

    Parameters

    • n: number = 1

      Amount to exclude

    Returns Type[]

insertItem

  • insertItem(x: Type, i?: number): Yarra<Type>

insertItemMutate

  • insertItemMutate(x: Type, i?: number): Yarra<Type>

insertList

  • insertList(list: Type[], i?: number): Yarra<Type>

insertListMutate

  • insertListMutate(list: Type[], i?: number): Yarra<Type>

isUnique

  • isUnique(loose?: boolean): boolean
  • Check if content is unique values

    Parameters

    • loose: boolean = false

      Choose to use == instead of ===

    Returns boolean

isUniqueWith

  • isUniqueWith(f: (x: Type, y: Type) => boolean): boolean
  • Check if content is unique values based on function comparison

    Parameters

    • f: (x: Type, y: Type) => boolean

      Comparing function

        • (x: Type, y: Type): boolean
        • Parameters

          • x: Type
          • y: Type

          Returns boolean

    Returns boolean

join

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

    Parameters

    • Optional separator: string

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

    Returns string

keys

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

    Returns IterableIterator<number>

lastIndexOf

  • lastIndexOf(searchElement: Type, fromIndex?: number): number
  • Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present.

    Parameters

    • searchElement: Type

      The value to locate in the array.

    • Optional fromIndex: number

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

    Returns number

map

  • map<U>(callbackfn: (value: Type, index: number, array: Type[]) => U, 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: (value: Type, index: number, array: Type[]) => U

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

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

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

          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[]

mapMutate

  • mapMutate(f: (value: Type, index: number, array: Type[]) => any, thisArg?: any): any
  • Parameters

    • f: (value: Type, index: number, array: Type[]) => any
        • (value: Type, index: number, array: Type[]): any
        • Parameters

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

          Returns any

    • Optional thisArg: any

    Returns any

matrixMult

max

  • max(): number

min

  • min(): number

mult

mutate

  • mutate(newValue: any): any
  • Sets value of content to newValue

    Parameters

    • newValue: any

    Returns any

none

  • none(f: (value: Type, index: number, array: Type[]) => unknown): boolean
  • Inverse of some function

    Parameters

    • f: (value: Type, index: number, array: Type[]) => unknown
        • (value: Type, index: number, array: Type[]): unknown
        • Parameters

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

          Returns unknown

    Returns boolean

occurrences

  • occurrences(f?: (x: Type, i: number, array: Type[]) => any): {}
  • Get object of occurrence count with f mapping

    Parameters

    • f: (x: Type, i: number, array: Type[]) => any = ...

      Mapping function

        • (x: Type, i: number, array: Type[]): any
        • Parameters

          • x: Type
          • i: number
          • array: Type[]

          Returns any

    Returns {}

    • [key: string]: number

pop

  • pop(): Type
  • Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

    Returns Type

product

  • product(): any

pullAt

  • pullAt(indices: number[]): Yarra<Type>
  • pullAt(...indices: number[]): Yarra<Type>

push

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

    Parameters

    • Rest ...items: Type[]

      New elements to add to the array.

    Returns number

reduce

  • reduce(callbackfn: (previousValue: Type, currentValue: Type, currentIndex: number, array: Type[]) => Type): Type
  • reduce(callbackfn: (previousValue: Type, currentValue: Type, currentIndex: number, array: Type[]) => Type, initialValue: Type): Type
  • reduce<U>(callbackfn: (previousValue: U, currentValue: Type, currentIndex: number, array: Type[]) => U, 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: (previousValue: Type, currentValue: Type, currentIndex: number, array: Type[]) => Type

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

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

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

          Returns Type

    Returns Type

  • Parameters

    • callbackfn: (previousValue: Type, currentValue: Type, currentIndex: number, array: Type[]) => Type
        • (previousValue: Type, currentValue: Type, currentIndex: number, array: Type[]): Type
        • Parameters

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

          Returns Type

    • initialValue: Type

    Returns Type

  • 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: (previousValue: U, currentValue: Type, currentIndex: number, array: Type[]) => U

      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: Type, currentIndex: number, array: Type[]): U
        • Parameters

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

          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

reduceRight

  • reduceRight(callbackfn: (previousValue: Type, currentValue: Type, currentIndex: number, array: Type[]) => Type): Type
  • reduceRight(callbackfn: (previousValue: Type, currentValue: Type, currentIndex: number, array: Type[]) => Type, initialValue: Type): Type
  • reduceRight<U>(callbackfn: (previousValue: U, currentValue: Type, currentIndex: number, array: Type[]) => U, 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: (previousValue: Type, currentValue: Type, currentIndex: number, array: Type[]) => Type

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

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

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

          Returns Type

    Returns Type

  • Parameters

    • callbackfn: (previousValue: Type, currentValue: Type, currentIndex: number, array: Type[]) => Type
        • (previousValue: Type, currentValue: Type, currentIndex: number, array: Type[]): Type
        • Parameters

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

          Returns Type

    • initialValue: Type

    Returns Type

  • 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: (previousValue: U, currentValue: Type, currentIndex: number, array: Type[]) => U

      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: Type, currentIndex: number, array: Type[]): U
        • Parameters

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

          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

reject

  • reject(f: (value: Type, index: number, array: Type[]) => boolean, thisArg?: any): Type[]
  • Parameters

    • f: (value: Type, index: number, array: Type[]) => boolean
        • (value: Type, index: number, array: Type[]): boolean
        • Parameters

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

          Returns boolean

    • Optional thisArg: any

    Returns Type[]

rejectFull

  • rejectFull(f: (value: Type, index: number, array: Type[]) => boolean, thisArg?: any): [Type, number][]
  • Parameters

    • f: (value: Type, index: number, array: Type[]) => boolean
        • (value: Type, index: number, array: Type[]): boolean
        • Parameters

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

          Returns boolean

    • Optional thisArg: any

    Returns [Type, number][]

rejectMutate

  • rejectMutate(f: (value: Type, index: number, array: Type[]) => boolean, thisArg?: any): any
  • Parameters

    • f: (value: Type, index: number, array: Type[]) => boolean
        • (value: Type, index: number, array: Type[]): boolean
        • Parameters

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

          Returns boolean

    • Optional thisArg: any

    Returns any

reverse

  • reverse(): Type[]
  • Reverses the elements in an array in place. This method mutates the array and returns a reference to the same array.

    Returns Type[]

sample

  • sample(): Type
  • Get a single random value from content

    Returns Type

set

  • set(indices: number[]): (newValue: any) => any
  • set(...indices: number[]): (newValue: any) => any
  • Sets value at path of indices with returned function Pass value with currying

    Parameters

    • indices: number[]

    Returns (newValue: any) => any

      • (newValue: any): any
      • Parameters

        • newValue: any

        Returns any

  • Parameters

    • Rest ...indices: number[]

    Returns (newValue: any) => any

      • (newValue: any): any
      • Parameters

        • newValue: any

        Returns any

setAllFrom

  • setAllFrom(template: any[], value: any): Yarra<Type>

setFrom

  • setFrom(template: any[], values: any[]): Yarra<Type>

shift

  • shift(): Type
  • Removes the first element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

    Returns Type

shuffle

slice

  • slice(start?: number, end?: number): Type[]
  • Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array. For example, -2 refers to the second to last element of the array.

    Parameters

    • Optional start: number

      The beginning index of the specified portion of the array. If start is undefined, then the slice begins at index 0.

    • Optional end: number

      The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. If end is undefined, then the slice extends to the end of the array.

    Returns Type[]

some

  • some(predicate: (value: Type, index: number, array: Type[]) => unknown, thisArg?: any): boolean
  • Determines whether the specified callback function returns true for any element of an array.

    Parameters

    • predicate: (value: Type, index: number, array: Type[]) => unknown

      A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.

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

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

          Returns unknown

    • Optional thisArg: any

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

    Returns boolean

sort

  • sort(compareFn?: (a: Type, b: Type) => number): Yarra<Type>
  • Sorts an array in place. This method mutates the array and returns a reference to the same array.

    Parameters

    • Optional compareFn: (a: Type, b: Type) => number

      Function used to determine the order of the elements. It is expected to return a negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.

      [11,2,22,1].sort((a, b) => a - b)
      
        • (a: Type, b: Type): number
        • Parameters

          • a: Type
          • b: Type

          Returns number

    Returns Yarra<Type>

splice

  • splice(start: number, deleteCount?: number): Type[]
  • splice(start: number, deleteCount: number, ...items: Type[]): Type[]
  • 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 Type[]

    An array containing the elements that were deleted.

  • 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: Type[]

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

    Returns Type[]

    An array containing the elements that were deleted.

split

  • split(f: (value: Type, index: number, array: Type[]) => boolean): Yarra<Yarra<unknown>>
  • Parameters

    • f: (value: Type, index: number, array: Type[]) => boolean
        • (value: Type, index: number, array: Type[]): boolean
        • Parameters

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

          Returns boolean

    Returns Yarra<Yarra<unknown>>

splitAt

  • splitAt(indices: number[]): Yarra<Type>
  • splitAt(...indices: number[]): Yarra<Type>

splitFull

  • splitFull(f: (value: Type, index: number, array: Type[]) => boolean): Yarra<Yarra<unknown>>
  • Parameters

    • f: (value: Type, index: number, array: Type[]) => boolean
        • (value: Type, index: number, array: Type[]): boolean
        • Parameters

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

          Returns boolean

    Returns Yarra<Yarra<unknown>>

sum

  • sum(): any

tail

  • tail(n?: number): Type[]
  • Get Yarra excluding first n elements

    Parameters

    • n: number = 1

      Amount to exclude

    Returns Type[]

takeWhile

  • takeWhile(f: (x: Type, i: number) => boolean): Yarra<Type>
  • Parameters

    • f: (x: Type, i: number) => boolean
        • (x: Type, i: number): boolean
        • Parameters

          • x: Type
          • i: number

          Returns boolean

    Returns Yarra<Type>

takeWhileRight

  • takeWhileRight(f: (x: Type, i: number) => boolean): Yarra<Type>
  • Parameters

    • f: (x: Type, i: number) => boolean
        • (x: Type, i: number): boolean
        • Parameters

          • x: Type
          • i: number

          Returns boolean

    Returns Yarra<Type>

toArray

  • toArray(): Type[]

toLocaleString

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

    Returns string

toString

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

    Returns string

transpose

transposeMutate

  • transposeMutate(): any

uncover

  • uncover(n?: number): any[]
  • Alias to flatten

    Parameters

    • n: number = 1

      flatten levels

    Returns any[]

unique

  • unique(loose?: boolean): Type[]
  • Get content with unique values only

    Parameters

    • loose: boolean = false

      Choose to use == instead of ===

    Returns Type[]

uniqueWith

  • uniqueWith(f: (x: Type, y: Type) => boolean): Type[]
  • Get content with unique values only based on function comparison

    Parameters

    • f: (x: Type, y: Type) => boolean

      Comparing function

        • (x: Type, y: Type): boolean
        • Parameters

          • x: Type
          • y: Type

          Returns boolean

    Returns Type[]

unshift

  • unshift(...items: Type[]): number
  • Inserts new elements at the start of an array, and returns the new length of the array.

    Parameters

    • Rest ...items: Type[]

      Elements to insert at the start of the array.

    Returns number

values

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

    Returns IterableIterator<Type>

written

  • written(oxfordComma?: boolean): string | Type
  • Get in string format following English grammar

    Parameters

    • oxfordComma: boolean = true

      To include oxford comma or not

    Returns string | Type

Static allocate

  • allocate(n: number[]): Yarra<any>
  • allocate(...n: number[]): Yarra<any>
  • Create new Yarra with n shape spaces preallocated

    Parameters

    • n: number[]

      Shape of Yarra to allocate

    Returns Yarra<any>

  • Parameters

    • Rest ...n: number[]

    Returns Yarra<any>

Static entries

  • entries(x: Object): Yarra<[string, any]>
  • Get entries of object as Yarra

    Parameters

    • x: Object

      Object to convert

    Returns Yarra<[string, any]>

    Yarra version of Object

Static from

  • from<T>(arrayLike: ArrayLike<T>): T[]
  • from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]
  • from<T>(iterable: Iterable<T> | ArrayLike<T>): T[]
  • from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]
  • Creates an array from an array-like object.

    Type parameters

    • T

    Parameters

    • arrayLike: ArrayLike<T>

      An array-like object to convert to an array.

    Returns T[]

  • Creates an array from an iterable object.

    Type parameters

    • T

    • U

    Parameters

    • arrayLike: ArrayLike<T>

      An array-like object to convert to an array.

    • mapfn: (v: T, k: number) => U

      A mapping function to call on every element of the array.

        • (v: T, k: number): U
        • Parameters

          • v: T
          • k: number

          Returns U

    • Optional thisArg: any

      Value of 'this' used to invoke the mapfn.

    Returns U[]

  • Creates an array from an iterable object.

    Type parameters

    • T

    Parameters

    • iterable: Iterable<T> | ArrayLike<T>

      An iterable object to convert to an array.

    Returns T[]

  • Creates an array from an iterable object.

    Type parameters

    • T

    • U

    Parameters

    • iterable: Iterable<T> | ArrayLike<T>

      An iterable object to convert to an array.

    • mapfn: (v: T, k: number) => U

      A mapping function to call on every element of the array.

        • (v: T, k: number): U
        • Parameters

          • v: T
          • k: number

          Returns U

    • Optional thisArg: any

      Value of 'this' used to invoke the mapfn.

    Returns U[]

Static generateTemplate

  • generateTemplate(input: number[][]): Yarra<unknown>
  • Generates indexing template

    Parameters

    • input: number[][]

      Indices of each dimension

    Returns Yarra<unknown>

    Full template of N Cube based on input

Static isArray

  • isArray(arg: any): arg is any[]
  • Parameters

    • arg: any

    Returns arg is any[]

Static linSpace

  • linSpace(start?: number, end?: number, n?: number): Yarra<number>
  • Creates linearly spaced values as Yarra

    Parameters

    • start: number = 0
    • end: number = 1
    • n: number = 2

    Returns Yarra<number>

    Linearly spaced Yarra

Static linSpaceMap

  • linSpaceMap(start?: number, end?: number, n?: number, f: (x: number) => any): Yarra<unknown>
  • Creates linearly spaced mapped values as Yarra

    Parameters

    • start: number = 0
    • end: number = 1
    • n: number = 2
    • f: (x: number) => any
        • (x: number): any
        • Parameters

          • x: number

          Returns any

    Returns Yarra<unknown>

Static of

  • of<T>(...items: T[]): T[]
  • Returns a new array from a set of elements.

    Type parameters

    • T

    Parameters

    • Rest ...items: T[]

      A set of elements to include in the new array object.

    Returns T[]

Static range

  • range(__namedParameters: { end: number; inclusive?: boolean; start?: number; step?: number }): Yarra<number>
  • Creates range values as Yarra

    Parameters

    • __namedParameters: { end: number; inclusive?: boolean; start?: number; step?: number }
      • end: number
      • Optional inclusive?: boolean
      • Optional start?: number
      • Optional step?: number

    Returns Yarra<number>

Static rangeMap

  • rangeMap(__namedParameters: { end: number; f?: (x: number) => any; inclusive?: boolean; start?: number; step?: number }): Yarra<unknown>
  • Creates range with mapped values as Yarra

    Parameters

    • __namedParameters: { end: number; f?: (x: number) => any; inclusive?: boolean; start?: number; step?: number }
      • end: number
      • Optional f?: (x: number) => any
          • (x: number): any
          • Parameters

            • x: number

            Returns any

      • Optional inclusive?: boolean
      • Optional start?: number
      • Optional step?: number

    Returns Yarra<unknown>

Static toIndices

  • toIndices(input: string, shape: number[]): Yarra<unknown>
  • using : will range ":3" -> [[0],[1],[2]] ":" -> everything "3:" -> from 3 to end "1:3" -> [[1],[2]] adding space or , will add "1:3 6:8" -> [[1],[2],[6],[7],[8]] using negative will index backwards "-3:-1" -> [[3],[4]] (ex. length = 6) using # will range with end inclusive "1#3" -> [[1],[2],[3]] using > will range with end being start + next value "2>2" -> [[2],[3]] using ; will go to next dimension "0:3 ; 2#4" -> take first 3 rows and take 3rd to 5th column

    Parameters

    • input: string

      input indexing template

    • shape: number[]

      shape of array

    Returns Yarra<unknown>

    template of indices

Legend

  • Property
  • Method
  • Static method

Generated using TypeDoc