@arrows/array
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -11,1 +11,5 @@ # CHANGELOG | ||
- Added flatOne as a method of flat (flat.one). | ||
## 1.1.1 | ||
- Used `String.prototype.localeCompare` instead of manual comparison in sort methods. |
{ | ||
"name": "@arrows/array", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "license": "ISC", |
@@ -742,3 +742,3 @@ # Arrows - array | ||
Sorts numerical arrays in an ascending order | ||
Sorts numerical arrays in an ascending order. | ||
@@ -753,3 +753,3 @@ #### Parameters | ||
Sorts numerical arrays in a descending order | ||
Sorts numerical arrays in a descending order. | ||
@@ -764,4 +764,6 @@ #### Parameters | ||
Sorts string arrays in an ascending order | ||
Sorts string arrays in an ascending order. | ||
Uses `String.prototype.localeCompare`. | ||
#### Parameters | ||
@@ -775,4 +777,6 @@ | ||
Sorts string arrays in a descending order | ||
Sorts string arrays in a descending order. | ||
Uses `String.prototype.localeCompare`. | ||
#### Parameters | ||
@@ -801,3 +805,3 @@ | ||
Sorts numerical arrays in an ascending order | ||
Sorts numerical arrays in an ascending order. | ||
@@ -813,3 +817,3 @@ #### Parameters | ||
Sorts numerical arrays in a descending order | ||
Sorts numerical arrays in a descending order. | ||
@@ -825,4 +829,6 @@ #### Parameters | ||
Sorts string arrays in an ascending order | ||
Sorts string arrays in an ascending order. | ||
Uses `String.prototype.localeCompare`. | ||
#### Parameters | ||
@@ -837,4 +843,6 @@ | ||
Sorts string arrays in a descending order | ||
Sorts string arrays in a descending order. | ||
Uses `String.prototype.localeCompare`. | ||
#### Parameters | ||
@@ -841,0 +849,0 @@ |
@@ -37,15 +37,19 @@ "use strict"; | ||
* | ||
* Uses String.prototype.localeCompare | ||
* | ||
* @param arr Initial array | ||
* @returns New array | ||
*/ | ||
str: curriesSort((a, b) => (a > b ? 1 : -1)), | ||
str: curriesSort((a, b) => a.localeCompare(b)), | ||
/** | ||
* Sorts string arrays in a descending order | ||
* | ||
* Uses String.prototype.localeCompare | ||
* | ||
* @param arr Initial array | ||
* @returns New array | ||
*/ | ||
strDesc: curriesSort((a, b) => (b > a ? 1 : -1)), | ||
strDesc: curriesSort((a, b) => b.localeCompare(a)), | ||
}); | ||
exports.sort = sort; | ||
exports.default = sort; |
@@ -42,4 +42,6 @@ "use strict"; | ||
/** | ||
* Sorts string arrays in an ascending order | ||
* Sorts string arrays in an ascending order. | ||
* | ||
* Uses String.prototype.localeCompare | ||
* | ||
* @param mappingFn Mapping function | ||
@@ -49,6 +51,8 @@ * @param arr Initial array | ||
*/ | ||
str: curriedSortBy_((a, b) => (a > b ? 1 : -1)), | ||
str: curriedSortBy_((a, b) => a.localeCompare(b)), | ||
/** | ||
* Sorts string arrays in a descending order | ||
* | ||
* Uses String.prototype.localeCompare | ||
* | ||
* @param mappingFn Mapping function | ||
@@ -58,5 +62,5 @@ * @param arr Initial array | ||
*/ | ||
strDesc: curriedSortBy_((a, b) => (b > a ? 1 : -1)), | ||
strDesc: curriedSortBy_((a, b) => b.localeCompare(a)), | ||
}); | ||
exports.sortBy_ = sortBy_; | ||
exports.default = sortBy_; |
@@ -52,13 +52,17 @@ import curry from '@arrows/composition/curry' | ||
* | ||
* Uses String.prototype.localeCompare | ||
* | ||
* @param arr Initial array | ||
* @returns New array | ||
*/ | ||
str: curriesSort((a: string, b: string) => (a > b ? 1 : -1)), | ||
str: curriesSort((a: string, b: string) => a.localeCompare(b)), | ||
/** | ||
* Sorts string arrays in a descending order | ||
* | ||
* Uses String.prototype.localeCompare | ||
* | ||
* @param arr Initial array | ||
* @returns New array | ||
*/ | ||
strDesc: curriesSort((a: string, b: string) => (b > a ? 1 : -1)), | ||
strDesc: curriesSort((a: string, b: string) => b.localeCompare(a)), | ||
}) | ||
@@ -65,0 +69,0 @@ |
@@ -78,4 +78,6 @@ import curry from '@arrows/composition/curry' | ||
/** | ||
* Sorts string arrays in an ascending order | ||
* Sorts string arrays in an ascending order. | ||
* | ||
* Uses String.prototype.localeCompare | ||
* | ||
* @param mappingFn Mapping function | ||
@@ -85,6 +87,8 @@ * @param arr Initial array | ||
*/ | ||
str: curriedSortBy_((a: string, b: string) => (a > b ? 1 : -1)), | ||
str: curriedSortBy_((a: string, b: string) => a.localeCompare(b)), | ||
/** | ||
* Sorts string arrays in a descending order | ||
* | ||
* Uses String.prototype.localeCompare | ||
* | ||
* @param mappingFn Mapping function | ||
@@ -94,3 +98,3 @@ * @param arr Initial array | ||
*/ | ||
strDesc: curriedSortBy_((a: string, b: string) => (b > a ? 1 : -1)), | ||
strDesc: curriedSortBy_((a: string, b: string) => b.localeCompare(a)), | ||
}) | ||
@@ -97,0 +101,0 @@ |
196302
5183
952