New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ts-sort-shell

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-sort-shell

shell sort an array in typescript

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

ts-sort-shell

sync + callback + Promise + Async/Await style shellsort implementation in typescript

Install

npm install ts-sort-shell --save-dev
yarn add  ts-sort-shell -D

commonjs use [sync + callback + Promise + Async/Await]


var shellSort = require("ts-sort-shell").shellSort;
shellSort([3,4,57,2,100,27,343],function(data){
    console.log("shellSort cb",data.join('-'))// output: 2-3-4-27-57-100-343
})


var shellSortSync = require("ts-sort-shell").shellSortSync;
console.log('shellSortSync sync',shellSortSync([3,4,57,2,100,27,343]))// output: [2,3, 4, 27, 57,100,343]



var shellSortAsync = require("ts-sort-shell").shellSortAsync;
shellSortAsync([3,4,57,2,100,27,343]).then((res) => {
  console.log('shellSortASync promise',res) // output: [2,3, 4, 27, 57,100,343]
}).catch((error) => {
  console.log('err',error)
})


var shellSortAsyncW = require("ts-sort-shell").shellSortAsync;
(async function () {
  var array4 = [3,4,57,2,100,27,343]
  var les = await shellSortAsyncW(array4)
  console.log('shellSortAsync await',les) // output: [2,3, 4, 27, 57,100,343]
})()




es6 use [sync + callback + Promise + Async Await]


import { shellSort, shellSortSync, shellSortAsync } from 'ts-sort-shell'

shellSort([3,4,57,2,100,27,343],function(data){
    console.log("shellSort cb",data.join('-'))// output: 2-3-4-27-57-100-343
})

console.log('shellSortSync sync',shellSortSync([3,4,57,2,100,27,343]))

shellSortAsync([3,4,57,2,100,27,343]).then((res) => {
  console.log('shellSortASync promise',res) // output: [2,3, 4, 27, 57,100,343]
}).catch((error) => {
  console.log('err',error)
})

(async function () {
  var array4 = [3,4,57,2,100,27,343]
  var les = await shellSortAsync(array4)
  console.log('shellSortAsyncAwait await',les) // output: [2,3, 4, 27, 57,100,343]
})()


umd web browser use [sync + callback + Promise + Async Await]


<script src="https://unpkg.com/ts-sort-shell@1.0.1/umd/index.js"></script>


tsSortShell.shellSort([3,4,57,2,100,27,343],function(data){
    console.log("shellSort cb",data.join('-'))// output: 2-3-4-27-57-100-343
})

console.log('shellSortSync sync',tsSortShell.shellSortSync([3,4,57,2,100,27,343]))

tsSortShell.shellSortAsync([3,4,57,2,100,27,343]).then((res) => {
  console.log('shellSortASync promise',res) // output: [2,3, 4, 27, 57,100,343]
}).catch((error) => {
  console.log('err',error)
})

(async function () {
  var array4 = [3,4,57,2,100,27,343]
  var les = await tsSortShell.shellSortAsync(array4)
  console.log('shellSortAsyncAwait await',les) // output: [2,3, 4, 27, 57,100,343]
})()


API

shellSortSync: (arr: number[]) => any;

shellSort: (arr: number[], callback: (data: number) => void) => any;

shellSortAsync: (arr: number[]) => any;

  • arr - The array to sort in place
  • callback - function to get sort array result

Keywords

shellSort

FAQs

Package last updated on 04 Nov 2020

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