Skip to content

mieszko4/m-sorted-array

Repository files navigation

m-sorted-array NPM version Build Status Dependency Status Coverage percentage

Implementation of insert, find and remove of sorted array

Install

$ npm install --save m-sorted-array

Usage

var SortedArray = require('m-sorted-array');

var SortedArray = require('./lib');
var sortedArray = SortedArray([8, 3, 2, 9, 1]);
console.log(sortedArray.array); // [1, 2, 3, 8, 9]

sortedArray.insert(5);
console.log(sortedArray.array); // [1, 2, 3, 5, 8, 9]

console.log(sortedArray.find(4)); // -1

var strict = false;
console.log(sortedArray.find(4, strict)); // 3

sortedArray.remove(2); // true
sortedArray.remove(2); // false
console.log(sortedArray.array); // [1, 3, 5, 8, 9]

License

Apache-2.0 © Mieszko4

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published