Algorithms and data structures for JS/TS
  • Introduction
  • GETTING STARTED
    • TS
    • Node.js
    • ES Modules
    • Browsers
  • PUBLIC API
    • How to read
    • Linked lists
      • SinglyLinkedList
      • DoublyLinkedList
      • CircularlyLinkedList
    • Stacks and queues
      • LinkedStack
      • LinkedQueue
      • LinkedDeque
      • CircularQueue
      • CircularArrayBuffer
      • UnsortedPriorityQueue
      • SortedPriorityQueue
      • AdaptableHeapPriorityQueue
    • Maps
      • SortedMap
      • MaximaSet
      • AVLTreeMap
      • SplayTreeMap
      • RedBlackTreeMap
    • Trees
      • GeneralTree
      • LinkedBinaryTree
      • PreorderTreeTraversal
      • InorderTreeTraversal
      • PostorderTreeTraversal
      • EulerTourTreeTraversal
    • Searches
      • Binary search
      • Quick select
    • Text processing
      • Longest common subsequence
      • Boyer-Moore
      • Knuth-Morris-Pratt
    • Position
    • Locator
    • Comparators
  • CONTRIBUTION NOTES
    • How to contribute
    • Project structure
  • Changelog
Powered by GitBook
On this page

Was this helpful?

  1. GETTING STARTED

TS

Getting started with ADSJS in TypeScript.

PreviousIntroductionNextNode.js

Last updated 5 years ago

Was this helpful?

This guide explains how to use ADSJS in projects with TS support.

This library was designed strictly typed so you'll get many advantages when using it with TypeScript.

To add ADSJS into your project run the following command in terminal (from project directory):

npm install ads-js

Then give it a try in your source code:

import { SinglyLinkedList } from 'ads-js';
// or
import { SinglyLinkedList } from 'ads-js/lists';

const list = new SinglyLinkedList([1, 2, 3]);
const position = list.getLast();

console.log(position.element);

Importing from 'ads-js' may be redundant in case you tend to use limited functional of the ADSJS in your project. To reduce your build size consider importing from specific aliases instead, like 'ads-js/lists'.

Visit section to get further details about capabilities of this library.

PUBLIC API