Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CheckedString

A string primitive that will always stay within a certain range

example

Create with a milliseconds instance

const string = new CheckedString('hey', { regex: /hey/ });
string = 'whut';  // throw StringRangeError

Hierarchy

Implements

Index

Constructors

constructor

Properties

regex

regex: RegExp

Accessors

value

  • get value(): string
  • set value(value: string): void

Methods

__@iterator

  • __@iterator(): IterableIterator<string>

__@toPrimitive

  • __@toPrimitive(hint: "string" | "number" | "default"): string | number

__@toStringTag

  • __@toStringTag(): string

get

  • get(): string

set

toJSON

  • toJSON(_?: string): any | number | string | boolean | null
  • Converts the primitive into it's JSON representation

    Parameters

    • Default value _: string = ""

    Returns any | number | string | boolean | null

    the object to serialize with JSON.stringify

toString

  • toString(): string

valueOf

  • valueOf(): string