Browse Source

Add strToInt function

ApisNecros 3 months ago
parent
commit
8774107de7
1 changed files with 13 additions and 0 deletions
  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);
 }