@cardsgame/utils
Advanced tools
Comparing version 0.14.0 to 0.14.1
@@ -47,3 +47,10 @@ "use strict"; | ||
var sortAlphabetically = function (a, b) { | ||
return a < b ? -1 : a > b ? 1 : 0; | ||
if (a < b) { | ||
return -1; | ||
} | ||
else if (a > b) { | ||
return 1; | ||
} | ||
else | ||
return 0; | ||
}; | ||
@@ -60,3 +67,10 @@ exports.sortAlphabetically = sortAlphabetically; | ||
} | ||
return a < b ? -1 : a > b ? 1 : 0; | ||
if (a < b) { | ||
return -1; | ||
} | ||
else if (a > b) { | ||
return 1; | ||
} | ||
else | ||
return 0; | ||
}; | ||
@@ -101,5 +115,5 @@ exports.sortAlphaNumerically = sortAlphaNumerically; | ||
var mostCommonProp = [undefined, 0]; | ||
map.forEach(function (count, propKey) { | ||
map.forEach(function (count, key) { | ||
if (count > mostCommonProp[1]) { | ||
mostCommonProp[0] = propKey; | ||
mostCommonProp[0] = key; | ||
mostCommonProp[1] = count; | ||
@@ -106,0 +120,0 @@ } |
/** | ||
* Trim long string with nice ell… | ||
* Works only on string, don't put numbers in it. | ||
*/ | ||
@@ -4,0 +5,0 @@ export declare const trim: (string?: string, maxLength?: number) => string; |
@@ -6,2 +6,3 @@ "use strict"; | ||
* Trim long string with nice ell… | ||
* Works only on string, don't put numbers in it. | ||
*/ | ||
@@ -12,3 +13,3 @@ var trim = function (string, maxLength) { | ||
if (typeof string !== "string") { | ||
return; | ||
return ""; | ||
} | ||
@@ -18,3 +19,3 @@ else { | ||
? string | ||
: string.substr(0, maxLength - 1) + "…"; | ||
: string.substring(0, maxLength - 1) + "…"; | ||
} | ||
@@ -21,0 +22,0 @@ }; |
{ | ||
"name": "@cardsgame/utils", | ||
"version": "0.14.0", | ||
"version": "0.14.1", | ||
"description": "", | ||
@@ -32,3 +32,3 @@ "author": "Darek Greenly (https://darekgreenly.com)", | ||
}, | ||
"gitHead": "dfcebe35394bce6faf4278b60a15a3f47a23575e" | ||
"gitHead": "163da2c501b9792a565fa16fde1277cdd624fc34" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
61973
1064