Options
All
  • Public
  • Public/Protected
  • All
Menu

Module generate

Generate Functions

generateBoolean

  • generateBoolean(): boolean
  • name

    generateBoolean

    description

    Generate random boolean value

    since

    0.1.32

    Returns boolean

    True or false

generateColor

  • generateColor(): string
  • name

    generateColor

    description

    Generate random Hex color.

    summary

    import { generateColor } from "@corefunc/corefunc/generate/color";

    since

    0.3.27

    example

    generateColor(); ➜ '#d7bd4d'

    Returns string

    Hex color.

generateFromArray

  • generateFromArray<Type>(arrayFrom: Type[]): Type
  • name

    generateFromArray

    description

    Gets the random value from array.

    summary

    import { generateFromArray } from "@corefunc/corefunc/generate/from-array";

    since

    0.1.58

    Type parameters

    • Type

    Parameters

    • arrayFrom: Type[]

    Returns Type

    Value from array.

generateInteger

  • generateInteger(min?: number, max?: number): number
  • name

    generateInteger

    description

    Generate random integer.

    summary

    import { generateInteger } from '@corefunc/corefunc/generate/integer';

    throws

    {RangeError}

    since

    0.3.67

    Parameters

    • min: number = 0
    • max: number = ...

    Returns number

generatePinCode

  • generatePinCode(size?: number, blockList?: string[]): string
  • description

    Generate random PIN code string.

    Parameters

    • size: number = 4
    • Optional blockList: string[]

    Returns string

    Random PIN code string.

generateRange

  • generateRange(from?: number | BigInt, to?: number | BigInt, step?: number | BigInt, type?: "number" | "bigint"): any[]
  • name

    generateRange

    description

    Number.range & BigInt.range

    summary

    import { generateRange } from "@corefunc/corefunc/generate/range";

    Parameters

    • from: number | BigInt = 0

      Number from

    • to: number | BigInt = ...

      Number to

    • step: number | BigInt = 1

      Number step

    • type: "number" | "bigint" = "number"

      Number type

    Returns any[]

generateString

  • generateString(size: number, possible?: string): string
  • description

    Generate random string from latin characters and numbers

    Parameters

    • size: number
    • possible: string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"

    Returns string

generateToken

  • generateToken(size?: number): string
  • name

    generateToken

    description

    Generate random string from latin characters and numbers.

    Parameters

    • size: number = 16

    Returns string

generateUuid

  • generateUuid(): string
  • name

    generateUuid

    Returns string

generateUuid4

  • generateUuid4(): string
  • name

    generateUuid4

    description

    RFC4122 compliant UUID v4 generator.

    Returns string

Generated using TypeDoc