ts-sort-heap
sync + callback + Promise + Async/Await style heapsort implementation in typescript
Install
npm install ts-sort-heap --save-devyarn add ts-sort-heap -D
commonjs use [sync + callback + Promise + Async/Await]
var heapSort = heapSort; var heapSortSync = heapSortSync;console// output: [2,3, 4, 27, 57,100,343] var heapSortAsync = heapSortAsync; var heapSortAsyncW = heapSortAsync; { var array4 = 3457210027343 var les = await console // output: [2,3, 4, 27, 57,100,343]}
es6 use [sync + callback + Promise + Async Await]
console { var array4 = 3457210027343 var les = await console // output: [2,3, 4, 27, 57,100,343]}
umd web browser use [sync + callback + Promise + Async Await]
<script src="https://unpkg.com/ts-sort-heap@1.0.1/umd/index.js"></script> tsSortHeap console tsSortHeap { var array4 = 3457210027343 var les = await tsSortHeap console // output: [2,3, 4, 27, 57,100,343]}
API
heapSortSync: (arr: number[]) => any;
heapSort: (arr: number[], callback: (data: number) => void) => any;
heapSortAsync: (arr: number[]) => any;
- arr - The array to sort in place
- callback - function to get sort array result