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

timsort

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timsort

TimSort: Fast Sorting for Node.js

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.8M
decreased by-15.82%
Maintainers
1
Weekly downloads
 
Created

What is timsort?

The timsort npm package is an implementation of the Timsort sorting algorithm for Node.js. Timsort is a hybrid stable sorting algorithm, derived from merge sort and insertion sort, designed to perform well on many kinds of real-world data. It has been Python's standard sorting algorithm since version 2.3. The npm package allows developers to use this efficient sorting algorithm in their JavaScript projects.

What are timsort's main functionalities?

Sorting an array of numbers

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

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

Sorting an array of objects based on a property

This feature allows you to sort an array of objects based on a specific property, in this case by the 'age' property.

const timSort = require('timsort');
let people = [
  { name: 'John', age: 24 },
  { name: 'Alice', age: 30 },
  { name: 'Bob', age: 22 }
];
timSort.sort(people, (a, b) => a.age - b.age);
console.log(people); // Output: [{ name: 'Bob', age: 22 }, { name: 'John', age: 24 }, { name: 'Alice', age: 30 }]

Other packages similar to timsort

Keywords

FAQs

Package last updated on 24 Jul 2016

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