@itrocks/sorted-array
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -53,3 +53,3 @@ { | ||
"types": "./sorted-array.d.ts", | ||
"version": "0.0.1" | ||
"version": "0.0.2" | ||
} |
@@ -0,1 +1,7 @@ | ||
 | ||
[](https://www.npmjs.org/package/@itrocks/sorted-array) | ||
[](https://www.npmjs.org/package/@itrocks/sorted-array) | ||
[](https://github.com/itrocks-ts/sorted-array/network/dependents?dependent_type=REPOSITORY) | ||
[](https://github.com/itrocks-ts/sorted-array/network/dependents?dependent_type=PACKAGE) | ||
# sorted-array | ||
@@ -152,17 +158,17 @@ | ||
- If `compareBy` is a number, it specifies the index of each inner array's element that will be used for comparison. | ||
Example: | ||
```js | ||
new SortedArrayBy(1, ['a', 'c', 'b'], ['r', 'd', 'a']) | ||
``` | ||
The array will be continuously sorted by the 2nd element of the array (index 1), comparing `'c'` and `'d'` in this example. | ||
<br/><br/> | ||
**Example**: | ||
```js | ||
new SortedArrayBy(1, ['a', 'c', 'b'], ['r', 'd', 'a']) | ||
``` | ||
The array will be continuously sorted by the 2nd element of the array (index 1), comparing `'c'` and `'d'` in this example. | ||
- If `compareBy` is a number or a string, it specifies the property name by which object elements will be compared. | ||
Example: | ||
```js | ||
new SortedArrayBy('name', { age: 30, name: 'Henry', age: 20, name: 'Johana' }) | ||
``` | ||
The array will be continuously sorted by the value of the property named `name` into the object element. | ||
<br/><br/> | ||
**Example**: | ||
```js | ||
new SortedArrayBy('name', { age: 30, name: 'Henry', age: 20, name: 'Johana' }) | ||
``` | ||
The array will be continuously sorted by the value of the property named `name` into the object element. | ||
- The `elements` and `arrayLength` parameters function the same as in the standard JavaScript | ||
@@ -169,0 +175,0 @@ [Array constructor](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/Array). |
25665
257