Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

array-timsort

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-timsort

Fast JavaScript array sorting by implementing Python's Timsort algorithm

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.3M
decreased by-0.87%
Maintainers
1
Weekly downloads
 
Created

What is array-timsort?

The array-timsort npm package provides an implementation of the Timsort algorithm, which is a hybrid sorting algorithm derived from merge sort and insertion sort. It is designed to perform well on many kinds of real-world data and is used in Python's built-in sort and Java's Arrays.sort. This package allows you to efficiently sort arrays in JavaScript using the Timsort algorithm.

What are array-timsort's main functionalities?

Sort an array of numbers

This feature allows you to sort an array of numbers in ascending order using the Timsort algorithm.

const timsort = require('array-timsort');
let arr = [5, 3, 8, 4, 2];
timsort.sort(arr);
console.log(arr); // Output: [2, 3, 4, 5, 8]

Sort an array of objects by a key

This feature allows you to sort an array of objects based on a specific key. In this example, the array is sorted by the 'age' property of the objects.

const timsort = require('array-timsort');
let arr = [{age: 30}, {age: 20}, {age: 40}];
timsort.sort(arr, (a, b) => a.age - b.age);
console.log(arr); // Output: [{age: 20}, {age: 30}, {age: 40}]

Other packages similar to array-timsort

Keywords

FAQs

Package last updated on 01 Oct 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc