An open API service indexing awesome lists of open source software.

https://github.com/chscript/algorithmlib

⚙️ Data Structure & Algorithm library written with Typescript
https://github.com/chscript/algorithmlib

algorithm commonjs data-structure esmodule javascript typescript

Last synced: 10 days ago
JSON representation

⚙️ Data Structure & Algorithm library written with Typescript

Awesome Lists containing this project

README

          

Algorithmlib









中文
English

## Overview

Algorithmlib is an algorithm library that supports Common. js and ES module syntax. It can be applied to Node.js projects or projects built through ES modules to reduce the time spent in handwriting data structures or algorithms in JavaScript or TypeScript projects.

## Quick Start Guide

### Install

```shell
npm install algorithmlib
```

### Demo

1. Import `Stack` through ES module syntax

```javascript
import { Stack } from 'algorithmlib'
let a = new Stack()
a.push('element')
a.pop()
```

2. Import `Stack` through Common.js syntax

```javascript
const { Stack } = require('algorithmlib')
let a = new Stack()
a.push('element')
a.pop()
```

3. Import `Stack` through `` tag

```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="./node_modules/algorithmlib/dist/index.iife.js">


const { Stack } = algorithmlib
let a = new Stack()
a.push('element')
a.pop()