Skip to content

Commit f93e10e

Browse files
committed
🐛 with readme
1 parent 77e946d commit f93e10e

File tree

3 files changed

+139
-4
lines changed

3 files changed

+139
-4
lines changed

README.md

Lines changed: 136 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,139 @@
1-
A sorted array is a collection of values, arranged in an order.
1+
A [sorted array] is a collection of values, arranged in an order.<br>
2+
📦 [Node.js](https://www.npmjs.com/package/extra-sorted-array),
3+
🌐 [Web](https://www.npmjs.com/package/extra-sorted-array.web),
4+
📜 [Files](https://unpkg.com/extra-sorted-array/),
5+
📰 [Docs](https://nodef.github.io/extra-sorted-array/),
6+
📘 [Wiki](https://github.com/nodef/extra-sorted-array/wiki/).
27

8+
![](https://i.imgur.com/46wYtxW.png)
39

10+
<br>
11+
12+
13+
This package includes comprehensive set of functions that operate on a sorted
14+
array with which you can **search a value** using binary search, **merge**
15+
multiple sorted arrays, or perform **set operations** upon it.
16+
17+
We use a consistent naming scheme that helps you quickly identify the functions
18+
you need. All functions except `from*()` take array as 1st parameter. Some
19+
functions operate on a specified range in the array and are called `ranged*()`,
20+
such as `rangedMerge()`. Functions like `slice()` are pure and do not modify the
21+
array itself, while functions like `slice$()` *do modify (update)* the array
22+
itself. Some functions accept a map function in addition to a compare function.
23+
Further, functions which return an iterable instead of an array are prefixed
24+
with `i`, such as `isubsequences()`. We borrow some names from other programming
25+
languages such as *Haskell*, *Python*, *Java*, and *Processing*.
26+
27+
With this package, you can simplify the implementation of complex algorithms,
28+
and be able to achieve your goals faster, regardless of your level of expertise.
29+
Try it out today and discover how it can transform your development experience!
30+
This package is available in *Node.js* and *Web* formats. To use it on the web,
31+
simply use the `extra_sorted_array` global variable after loading with a
32+
`<script>` tag from the [jsDelivr CDN].
33+
34+
> Stability: [Experimental](https://www.youtube.com/watch?v=L1j93RnIxEo).
35+
36+
[sorted array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
37+
[jsDelivr CDN]: https://cdn.jsdelivr.net/npm/extra-sorted-array.web/index.js
38+
39+
<br>
40+
41+
```javascript
42+
const xsortedArray = require('extra-sorted-array');
43+
// import * as xsortedArray from "extra-sorted-array";
44+
// import * as xsortedArray from "https://unpkg.com/extra-sorted-array/index.mjs"; (deno)
45+
46+
var x = [10, 20, 20, 40, 40, 80];
47+
xsortedArray.searchValue(x, 40);
48+
// → 3
49+
50+
var x = [10, 20, 20, 40, 40, 80];
51+
var y = [20, 50, 70];
52+
xsortedArray.merge(x, y);
53+
// → [ 10, 20, 20, 20, 40, 40, 50, 70, 80 ]
54+
55+
var x = [10, 20, 20, 40, 40, 80];
56+
var y = [20, 50, 70];
57+
var z = [30, 60, 90];
58+
xsortedArray.mergeAll([x, y, z]);
59+
// → [ 10, 20, 20, 20, 30, 40, 40, 50, 60, 70, 80, 90 ]
60+
61+
var x = [10, 20, 20, 40, 40, 80];
62+
var y = [20, 50, 70];
63+
xsortedArray.isDisjoint(x, y);
64+
// → false
65+
66+
var x = [10, 20, 20, 40, 40, 80];
67+
var y = [20, 50, 80];
68+
xsortedArray.intersection(x, y);
69+
// → [ 20, 80 ]
70+
```
71+
72+
<br>
73+
<br>
74+
75+
76+
## Index
77+
78+
| Property | Description |
79+
| ---- | ---- |
80+
| [includes] | Check if sorted array has a value using binary search. |
81+
| [hasValue] | Check if sorted array has a value using binary search. |
82+
| [indexOf] | Find first index of value using binary search. |
83+
| [lastIndexOf] | Find last index of value using binary search. |
84+
| [searchValue] | Find first index of value using binary search. |
85+
| [searchValueRight] | Find last index of a value using binary search. |
86+
| [searchValueAny] | Find any index of a value using binary search. |
87+
| [searchClosestValue] | Find index of closest value using binary search. |
88+
| | |
89+
| [merge] | Merge values from two sorted arrays. |
90+
| [rangedMerge] | Merge ranges of values from two sorted arrays. |
91+
| [mergeAll] | Merge values from sorted arrays. |
92+
| | |
93+
| [isUnique] | Examine if there are no duplicate values. |
94+
| [isDisjoint] | Examine if arrays have no value in common. |
95+
| [unique] | Remove duplicate values. |
96+
| [union] | Obtain values present in any sorted array. |
97+
| [intersection] | Obtain values present in both sorted arrays. |
98+
| [difference] | Obtain values not present in another sorted array. |
99+
| [symmetricDifference] | Obtain values present in either sorted array but not both. |
100+
101+
102+
<br>
103+
<br>
104+
105+
106+
## References
107+
108+
- [binary-sorted-array - npm : Michal Iwanow](https://www.npmjs.com/package/binary-sorted-array)
109+
- [How to add region in java script file, visual studio](https://stackoverflow.com/a/51550649/1413259)
110+
111+
<br>
112+
<br>
113+
114+
115+
[![](https://img.youtube.com/vi/VYOOiIJeBOA/maxresdefault.jpg)](https://www.youtube.com/watch?v=VYOOiIJeBOA)<br>
116+
[![ORG](https://img.shields.io/badge/org-nodef-green?logo=Org)](https://nodef.github.io)
117+
[![Coverage Status](https://coveralls.io/repos/github/nodef/extra-sorted-array/badge.svg?branch=master)](https://coveralls.io/github/nodef/extra-sorted-array?branch=master)
4118
[![Test Coverage](https://api.codeclimate.com/v1/badges/31b3e3f490532d3bd3d3/test_coverage)](https://codeclimate.com/github/nodef/extra-sorted-array/test_coverage)
119+
<!-- [![DOI](https://zenodo.org/badge/133759104.svg)](https://zenodo.org/badge/latestdoi/133759104) -->
120+
121+
122+
[includes]: https://github.com/nodef/extra-sorted-array/wiki/includes
123+
[hasValue]: https://github.com/nodef/extra-sorted-array/wiki/hasValue
124+
[indexOf]: https://github.com/nodef/extra-sorted-array/wiki/indexOf
125+
[lastIndexOf]: https://github.com/nodef/extra-sorted-array/wiki/lastIndexOf
126+
[searchValue]: https://github.com/nodef/extra-sorted-array/wiki/searchValue
127+
[searchValueRight]: https://github.com/nodef/extra-sorted-array/wiki/searchValueRight
128+
[searchValueAny]: https://github.com/nodef/extra-sorted-array/wiki/searchValueAny
129+
[searchClosestValue]: https://github.com/nodef/extra-sorted-array/wiki/searchClosestValue
130+
[merge]: https://github.com/nodef/extra-sorted-array/wiki/merge
131+
[rangedMerge]: https://github.com/nodef/extra-sorted-array/wiki/rangedMerge
132+
[mergeAll]: https://github.com/nodef/extra-sorted-array/wiki/mergeAll
133+
[isUnique]: https://github.com/nodef/extra-sorted-array/wiki/isUnique
134+
[isDisjoint]: https://github.com/nodef/extra-sorted-array/wiki/isDisjoint
135+
[unique]: https://github.com/nodef/extra-sorted-array/wiki/unique
136+
[union]: https://github.com/nodef/extra-sorted-array/wiki/union
137+
[intersection]: https://github.com/nodef/extra-sorted-array/wiki/intersection
138+
[difference]: https://github.com/nodef/extra-sorted-array/wiki/difference
139+
[symmetricDifference]: https://github.com/nodef/extra-sorted-array/wiki/symmetricDifference

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "extra-sorted-array",
3-
"version": "0.0.13",
3+
"version": "0.0.14",
44
"description": "A sorted array is a collection of values, arranged in an order.",
55
"main": "index.js",
66
"module": "index.mjs",

0 commit comments

Comments
 (0)