mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-13 18:24:28 +02:00
refactor
This commit is contained in:
@@ -8,10 +8,11 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
function _str_to_int(t, i = 0, mapper = [["0", 0], ["1", 1], ["2", 2], ["3", 3], ["4", 4], ["5", 5], ["6", 6], ["7", 7], ["8", 8], ["9", 9]]) =
|
function _str_to_int(t) =
|
||||||
i == len(mapper) ? -1 : (
|
let(
|
||||||
mapper[i][0] == t ? mapper[i][1] : _str_to_int(t, i + 1)
|
dict = [["0", 0], ["1", 1], ["2", 2], ["3", 3], ["4", 4], ["5", 5], ["6", 6], ["7", 7], ["8", 8], ["9", 9]],
|
||||||
);
|
n = dict[search(t, dict)[0]][1]
|
||||||
|
) n;
|
||||||
|
|
||||||
function _parse_positive_int(t, value = 0, i = 0) =
|
function _parse_positive_int(t, value = 0, i = 0) =
|
||||||
i == len(t) ? value : _parse_positive_int(t, value * pow(10, i) + _str_to_int(t[i]), i + 1);
|
i == len(t) ? value : _parse_positive_int(t, value * pow(10, i) + _str_to_int(t[i]), i + 1);
|
||||||
|
Reference in New Issue
Block a user