Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

find_if

  • Parameters

    Returns number

is_sorted

  • is_sorted(array: any[]): number
  • name

    check if array is sorted

    example

    is_sorted([0, 1, 2, 2]); // 1 is_sorted([4, 3, 2]); // -1 is_sorted([4, 3, 5]); // 0

    Parameters

    • array: any[]

    Returns number

max_element

  • max_element(a: number[]): number
  • Parameters

    • a: number[]

    Returns number

min_element

  • min_element(a: number[]): number
  • Parameters

    • a: number[]

    Returns number

partial_sort

  • partial_sort(a: any[], first: number, middle: number, last: number, comp: BinaryFunction<any, any, number>): void
  • Parameters

    • a: any[]
    • first: number
    • middle: number
    • last: number
    • comp: BinaryFunction<any, any, number>

    Returns void

random_shuffle

  • random_shuffle(array: any[]): void

remove

  • remove(a: any[], v: any): any[]
  • Parameters

    • a: any[]
    • v: any

    Returns any[]

reverse

  • reverse(array: number[], start?: number, stop?: number): void
  • Example

    let data = [0, 1, 2, 3, 4];
    std.reverse(data, 1, 3);  // [0, 3, 2, 1, 4]
    std.reverse(data, 3);     // [0, 3, 2, 4, 1]
    std.reverse(data);        // [1, 4, 2, 3, 0]

    Parameters

    • array: number[]
    • Default value start: number = 0
    • Default value stop: number = -1

    Returns void

swap

  • swap(a: any, b: any): void
  • Parameters

    • a: any
    • b: any

    Returns void

unique

  • unique(a: number[]): number[]
  • ES6 version of unique array, without order

    Parameters

    • a: number[]

    Returns number[]

unique1

  • Parameters

    Returns any[]