浏览代码

Add strToInt function

ApisNecros 3 月之前
父节点
当前提交
8774107de7
共有 1 个文件被更改,包括 13 次插入0 次删除
  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);
 }