소스 검색

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);
 }