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

sarray

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sarray

Sorted Array - uses binary search for fast insertion / reading

latest
Source
npmnpm
Version
1.0.16
Version published
Maintainers
1
Created
Source

sarray - Sorted array in javascript

Features:

  • Uses binary-sort to insert and search in array.

Usage:

import { SortedArray } from 'sarray'

const arr = new SortedArray<number>()
arr.push(...[5, 4, 2, 1, 4])

// arr will now contain 1, 2, 4, 4, 5

Custom comparator

const arr = new SortedArray<{ val: number }>(({ number: a }, { number: b }) => a - b)

arr.push(...[{ val: 5 }, { val: 3 }])

// arr now contains [{val: 3}, {val: 5}];

Installation

yarn add sarray
# or
npm install sarray

License

MIT

Keywords

sort

FAQs

Package last updated on 11 Mar 2022

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