Skip to content

Chainable

James edited this page Jun 24, 2017 · 4 revisions

common interface

these core functions call chain.store, when updating the store, this is returned, otherwise the value is returned

👍👎 the general rule of thumb is:

  • is it a list? use Set
  • otherwise... use Map

definition

class Chainable {
  public parent?: Chainable
  public compose: Composer

  constructor(parent: ParentType)

  public readonly length: number
  public end(): Chainable | any

  // when string, uses this.has(condition)
  public when(condition: truthy | string, trueBrancher?: Fn, falseBrancher?: Fn): Chainable

  // clears the store, resets to empty
  public clear(): Chainable
  public delete(key: Primitive): Chainable
  public has(value: Primitive): boolean

  public [Symbol.iterator](): void
  public [Symbol.toPrimitive](hint: string): string | number | any
  public [Symbol.hasInstance]: boolean
}
Clone this wiki locally