JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 15
  • Score
    100M100P100Q54491F
  • License Apache-2.0

A suite of circular data structures, including CircleStack, CircleQueue, and CircleDeque. Use circular buffers with ease and supported by a variety of operations.

Package Exports

  • circle-ds

Readme

Circle DS

A suite of circular data structures, including CircleStack, CircleQueue, and CircleDeque. Use circular buffers with ease and supported by a variety of operations.

Version Downloads Maintenance License codecov npm bundle size

Features

Install

Using npm:

npm install circle-ds

Using yarn:

yarn install circle-ds

API

Try it out on JSFiddle.

CircleStack

CircleStack is a LIFO (Last In, First Out) data structure with a fixed capacity.

Constructor

  • CircleStack<T>(): Constructs an empty circular stack a capacity of zero.
  • CircleStack<T>(capacity: number): Constructs an empty circular stack with the specified capacity.
  • CircleStack<T>(items: Iterable<T>): Constructs a full circular stack with the given items.
  • CircleStack<T>(...items: T[]): Constructs a full circular stack with the given items.

Static Methods

  • from<T>(iterable: Iterable<T> | ArrayLike<T>): CircleStack<T>: Creates a new stack from an iterable or array-like object.

  • of<T>(...elements: T[]): CircleStack<T>: Creates a new stack from a variable number of elements.

Properties

Methods

CircleQueue

CircleQueue is a FIFO (First In, First Out) data structure with a fixed size.

Constructor

  • CircleQueue<T>(): Constructs an empty circular queue a capacity of zero.
  • CircleQueue<T>(capacity: number): Constructs an empty circular queue with the specified capacity.
  • CircleQueue<T>(items: Iterable<T>): Constructs a full circular queue with the given items.
  • CircleQueue<T>(...items: T[]): Constructs a full circular queue with the given items.

Static Methods

  • from<T>(iterable: Iterable<T> | ArrayLike<T>): CircleQueue<T>: Creates a new queue from an iterable or array-like object.

  • of<T>(...elements: T[]): CircleQueue<T>: Creates a new queue from a variable number of elements.

Properties

Methods

CircleDeque

CircleDeque is a double-ended queue that combines the features of stacks and queues, allowing insertion and removal at both ends.

Constructor

  • CircleDeque<T>(): Constructs an empty circular deque a capacity of zero.
  • CircleDeque<T>(capacity: number): Constructs an empty circular deque with the specified capacity.
  • CircleDeque<T>(items: Iterable<T>): Constructs a full circular deque with the given items.
  • CircleDeque<T>(...items: T[]): Constructs a full circular deque with the given items.

Static Methods

  • from<T>(iterable: Iterable<T> | ArrayLike<T>): CircleDeque<T>: Creates a new deque from an iterable or array-like object.

  • of<T>(...elements: T[]): CircleDeque<T>: Creates a new deque from a variable number of elements.

Properties

Methods

License

Copyright (C) 2024-2024 Michael Rojas dev.michael.rojas@gmail.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


Made with ❤️ by Michael Rojas