Skip to content

Commit 5a6cba6

Browse files
committed
🐛 docs: update readme
1 parent a420cf0 commit 5a6cba6

File tree

6 files changed

+87
-92
lines changed

6 files changed

+87
-92
lines changed

README.md

Lines changed: 31 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,35 @@ An [array] is a collection of values, stored contiguously.<br>
55
📰 [Docs](https://nodef.github.io/extra-array/),
66
📘 [Wiki](https://github.com/nodef/extra-array/wiki/).
77

8-
This package includes common array functions related to querying **about**
9-
arrays, **generating** them, **comparing** one with another, finding their
10-
**length**, **getting** and **setting** elements, obtaining its **properties**,
11-
getting a **part** of it, **rearranging** elements in it, **finding** an element
12-
of a subset of elements in it, performing **functional** operations,
13-
**manipulating** it in various ways, **combining** together arrays or its
14-
elements, of performing **set operations** upon it.
8+
![](https://i.imgur.com/46wYtxW.png)
159

16-
All functions except `from*()` take array as 1st parameter. Methods like
17-
`swap()` are pure and do not modify the array itself, while methods like
18-
`swap$()` *do modify (update)* the array itself. Some methods accept a map
19-
function for *faster comparision* (like [unique]). I find the map-approach
20-
beautiful, which I learned from Haskell's `sortOn()`. You can notice that I have
21-
followed Javascript naming scheme as far as possible. Some names are borrowed
22-
from Haskell, Python, Java, Processing.
10+
<br>
11+
12+
13+
This package includes comprehensive set of array functions for **generating** an
14+
array, **cloning** them, querying **about** them, getting non-negative
15+
**indices**, managing its **length**, **getting/setting** elements, fully or
16+
partially **sorting** them, obtaining **minimum(s)/maximum(s)**, **comparing**
17+
one with another, getting a **part** of it, **searching a value**, obtaining all
18+
possible **arrangements** or **random arrangements**, **finding** an element,
19+
**taking/dropping** elements or **scanning** from the begining or end the of an
20+
array, **searching** the index of a part of the array, performing **functional**
21+
operations, **flattening** multi-level arrays, obtaining **prefix sum**,
22+
**manipulating** it in various ways, **counting/partitioning** elements,
23+
**splitting** it, **concatenating/joining** multiple arrays, **rearranging**
24+
elements withing it, or performing **set operations** upon it. You can use our
25+
package in a variety of ways to streamline your development process and simplify
26+
the implementation of complex algorithms.
27+
28+
We use a consistent naming scheme that helps you quickly identify the functions
29+
you need. All functions except `from*()` take array as 1st parameter. Some
30+
functions operate on a specified range in the array, and are called `ranged*()`.
31+
Functions like `swap()` are pure and do not modify the array itself, while
32+
functions like `swap$()` *do modify (update)* the array itself. Some functions
33+
accept a map function for *faster comparision*, such as `unique()`. Furher,
34+
functions which return an iterable instead of an array are prefixed with `i`,
35+
such as `isubsequences()`. We borrow some names from other programming languages
36+
such as *Haskell*, *Python*, *Java*, and *Processing*.
2337

2438
This package is available in *Node.js* and *Web* formats. To use it on the web,
2539
simply use the `extra_array` global variable after loading with a `<script>`
@@ -43,11 +57,11 @@ xarray.get(x, -1);
4357

4458
var x = [1, 2, 3, 4];
4559
xarray.swap(x, 0, 1);
46-
// → [2, 1, 3, 4]
60+
// → [ 2, 1, 3, 4 ]
4761

4862
var x = [1, 2, 3, 4];
4963
xarray.rotate(x, 1);
50-
// → [4, 1, 2, 3]
64+
// → [ 2, 3, 4, 1 ]
5165

5266
xarray.permutations([1, 2, 3]);
5367
// → [
@@ -66,6 +80,7 @@ xarray.permutations([1, 2, 3]);
6680
<br>
6781

6882

83+
6984
## Index
7085

7186
| Property | Description |
@@ -83,9 +98,6 @@ xarray.permutations([1, 2, 3]);
8398
| [keys] | Obtain all indices. |
8499
| [values] | Get all values. |
85100
| [entries] | Obtain all index-value pairs. |
86-
| [ikeys] | List all indices. |
87-
| [ivalues] | List all values. |
88-
| [ientries] | List all index-value pairs. |
89101
| | |
90102
| [index] | Get zero-based index for an element in array. |
91103
| [indexRange] | Get zero-based index range for part of array. |
@@ -115,12 +127,8 @@ xarray.permutations([1, 2, 3]);
115127
| [searchUnsortedValue] | Find first index of an unsorted value. |
116128
| [sort] | Arrange values in order. |
117129
| [sort$] | Arrange values in order! |
118-
| [sortRange] | Arrange a range of values in order. |
119-
| [sortRange$] | Arrange a range of values in order! |
120130
| [partialSort] | Partially arrange values in order. |
121131
| [partialSort$] | Partially arrange values in order! |
122-
| [partialSortRange] | Partially arrange a range of values in order. |
123-
| [partialSortRange$] | Partially arrange a range of values in order! |
124132
| | |
125133
| [minimum] | Find first smallest value. |
126134
| [minimumEntry] | Find first smallest entry. |
@@ -166,11 +174,6 @@ xarray.permutations([1, 2, 3]);
166174
| [infixes] | Obtain all possible infixes. |
167175
| [subsequences] | Obtain all possible subsequences. |
168176
| [permutations] | Obtain all possible permutations. |
169-
| [iprefixes] | List all possible prefixes. |
170-
| [isuffixes] | List all possible suffixes. |
171-
| [iinfixes] | List all possible infixes. |
172-
| [isubsequences] | List all possible subsequences. |
173-
| [ipermutations] | List all possible permutations. |
174177
| [searchInfix] | Find first index of an infix. |
175178
| [searchInfixRight] | Find last index of an infix. |
176179
| [searchInfixAll] | Find indices of an infix. |
@@ -325,9 +328,6 @@ xarray.permutations([1, 2, 3]);
325328
[keys]: https://github.com/nodef/extra-array/wiki/keys
326329
[values]: https://github.com/nodef/extra-array/wiki/values
327330
[entries]: https://github.com/nodef/extra-array/wiki/entries
328-
[ikeys]: https://github.com/nodef/extra-array/wiki/ikeys
329-
[ivalues]: https://github.com/nodef/extra-array/wiki/ivalues
330-
[ientries]: https://github.com/nodef/extra-array/wiki/ientries
331331
[index]: https://github.com/nodef/extra-array/wiki/index
332332
[indexRange]: https://github.com/nodef/extra-array/wiki/indexRange
333333
[isEmpty]: https://github.com/nodef/extra-array/wiki/isEmpty
@@ -353,12 +353,8 @@ xarray.permutations([1, 2, 3]);
353353
[searchUnsortedValue]: https://github.com/nodef/extra-array/wiki/searchUnsortedValue
354354
[sort]: https://github.com/nodef/extra-array/wiki/sort
355355
[sort$]: https://github.com/nodef/extra-array/wiki/sort$
356-
[sortRange]: https://github.com/nodef/extra-array/wiki/sortRange
357-
[sortRange$]: https://github.com/nodef/extra-array/wiki/sortRange$
358356
[partialSort]: https://github.com/nodef/extra-array/wiki/partialSort
359357
[partialSort$]: https://github.com/nodef/extra-array/wiki/partialSort$
360-
[partialSortRange]: https://github.com/nodef/extra-array/wiki/partialSortRange
361-
[partialSortRange$]: https://github.com/nodef/extra-array/wiki/partialSortRange$
362358
[minimum]: https://github.com/nodef/extra-array/wiki/minimum
363359
[minimumEntry]: https://github.com/nodef/extra-array/wiki/minimumEntry
364360
[maximum]: https://github.com/nodef/extra-array/wiki/maximum
@@ -399,11 +395,6 @@ xarray.permutations([1, 2, 3]);
399395
[infixes]: https://github.com/nodef/extra-array/wiki/infixes
400396
[subsequences]: https://github.com/nodef/extra-array/wiki/subsequences
401397
[permutations]: https://github.com/nodef/extra-array/wiki/permutations
402-
[iprefixes]: https://github.com/nodef/extra-array/wiki/iprefixes
403-
[isuffixes]: https://github.com/nodef/extra-array/wiki/isuffixes
404-
[iinfixes]: https://github.com/nodef/extra-array/wiki/iinfixes
405-
[isubsequences]: https://github.com/nodef/extra-array/wiki/isubsequences
406-
[ipermutations]: https://github.com/nodef/extra-array/wiki/ipermutations
407398
[searchInfix]: https://github.com/nodef/extra-array/wiki/searchInfix
408399
[searchInfixRight]: https://github.com/nodef/extra-array/wiki/searchInfixRight
409400
[searchInfixAll]: https://github.com/nodef/extra-array/wiki/searchInfixAll

TODO

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ PARSE, OTHERS
44

55
INDEX -VE
66
- moveWithin
7+
8+
9+
SOURCEMAP, UNIQUE DEPENDENCIES

package-lock.json

Lines changed: 8 additions & 8 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-array",
3-
"version": "4.1.1",
3+
"version": "4.1.2",
44
"description": "An array is a collection of values, stored contiguously.",
55
"main": "index.js",
66
"module": "index.mjs",

0 commit comments

Comments
 (0)