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

sorted-array-functions

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

sorted-array-functions

Maintain and search through a sorted array using some low level functions

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.3M
decreased by-16.04%
Maintainers
1
Weekly downloads
 
Created

What is sorted-array-functions?

The sorted-array-functions npm package provides utility functions for manipulating and querying sorted arrays. It ensures that the arrays remain sorted after operations such as insertion, deletion, and searching.

What are sorted-array-functions's main functionalities?

Insertion

This feature allows you to insert an element into a sorted array while maintaining the order.

const sortedArrayFunctions = require('sorted-array-functions');
let arr = [1, 3, 5, 7];
sortedArrayFunctions.add(arr, 4); // arr is now [1, 3, 4, 5, 7]

Deletion

This feature allows you to remove an element from a sorted array while maintaining the order.

const sortedArrayFunctions = require('sorted-array-functions');
let arr = [1, 3, 4, 5, 7];
sortedArrayFunctions.remove(arr, 4); // arr is now [1, 3, 5, 7]

Binary Search

This feature allows you to perform a binary search on a sorted array to find the index of a given element.

const sortedArrayFunctions = require('sorted-array-functions');
let arr = [1, 3, 5, 7];
let index = sortedArrayFunctions.search(arr, 5); // index is 2

Merge

This feature allows you to merge two sorted arrays into one sorted array.

const sortedArrayFunctions = require('sorted-array-functions');
let arr1 = [1, 3, 5];
let arr2 = [2, 4, 6];
let merged = sortedArrayFunctions.merge(arr1, arr2); // merged is [1, 2, 3, 4, 5, 6]

Other packages similar to sorted-array-functions

FAQs

Package last updated on 24 Aug 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