Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@blackglory/structures

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blackglory/structures

Common strctures.

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
403
decreased by-82.93%
Maintainers
1
Weekly downloads
 
Created
Source

strctures

Common strctures.

Install

npm install --save @blackglory/strctures
# or
yarn add @blackglory/strctures

API

Cons

convertConsToArray
function convertConsToArray<T>([value, next]: Cons<T>): T[]
convertArrayToCons
function convertArrayToCons<T>([value, ...next]: T[]): Cons<T>

Emitter

type Handler<T> = (vale: T) => void

class Emitter<T> {
  get [Symbol.toStringTag](): string

  on(event: string, handler: Handler<T>): void
  off(event: string, handler: Handler<T>): void
  emit(event: string, vale: T): void
}

HashSet

class HashSet<V, K = unknown> implements Iterable<V> {
  get [Symbol.toStringTag](): string
  get size(): number
  [Symbol.iterator](): IterableIterator<V>

  constructor(hash: (value: V) => K)

  add(value: V): this
  delete(value: V): boolean
  has(value: V): boolean
  clear(): void
  values(): Iterable<V>
}

LRUMap

class LRUMap<K, V> {
  get [Symbol.toStringTag](): string
  get size(): number

  constructor(limit: number)

  set(key: K, value: V): this
  has(key: K): boolean
  get(key: K): V | undefined
  delete(key: K): boolean
  clear(): void
}

Queue

class Queue<T> {
  get [Symbol.toStringTag](): string
  get size(): number

  empty(): void
  enqueue(...items: T[]): void
  dequeue(): T | undefined
  remove(item: T): void
}

TrieMap

class TrieMap<K extends Iterable<T>, V, T = UnpackedIterable<K>> {
  get [Symbol.toStringTag](): string

  set(key: K, value: V): this
  has(key: K): boolean
  get(key: K): V | undefined
  delete(key: K): boolean
}

FAQs

Package last updated on 16 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc