Ver Fonte

Add strToInt function

ApisNecros há 3 meses atrás
pai
commit
8774107de7
1 ficheiros alterados com 13 adições e 0 exclusões
  1. 13 0
      common.js

+ 13 - 0
common.js

@@ -26,4 +26,17 @@ export function loadInput(dayNumber, parsingFunction, literalPath = false) {
  */
 export function numericAscSort(a, b) {
     return a - b;
+}
+
+/**
+ * Convert a string to an integer
+ *
+ * Does no checks to make sure the value is actually a number-like value
+ *
+ * @param {string} string
+ *
+ * @returns {number}
+ */
+export function strToInt(string) {
+    return parseInt(string, 10);
 }