refactor(es modules): modulize utils

This commit is contained in:
Azgaar 2022-06-26 20:44:29 +03:00
parent 12e1c9f334
commit 7ccebec048
54 changed files with 168 additions and 134 deletions

View file

@ -1,5 +1,7 @@
import {findCell} from "/src/utils/graphUtils";
import {rn} from "/src/utils/numberUtils";
import {rand, P, rw} from "@/utils/probabilityUtils";
import {parseTransform} from "@/utils/stringUtils";
// update old .map version to the current one
export function resolveVersionConflicts(version) {

View file

@ -3,6 +3,7 @@ import {findAll, findCell, getPackPolygon, isLand} from "/src/utils/graphUtils";
import {tip, showMainTip, clearMainTip} from "/src/scripts/tooltips";
import {byId} from "/src/utils/shorthands";
import {rn} from "/src/utils/numberUtils";
import {capitalize} from "@/utils/stringUtils";
const $body = insertEditorHtml();
addListeners();

View file

@ -4,6 +4,7 @@ import {byId} from "/src/utils/shorthands";
import {tip, showMainTip, clearMainTip} from "/src/scripts/tooltips";
import {getRandomColor, getMixedColor} from "/src/utils/colorUtils";
import {rn} from "/src/utils/numberUtils";
import {rand, P} from "@/utils/probabilityUtils";
const $body = insertEditorHtml();
addListeners();

View file

@ -1,5 +1,6 @@
import {shouldRegenerateGrid, generateGrid} from "/src/utils/graphUtils";
import {byId} from "/src/utils/shorthands";
import {generateSeed} from "@/utils/probabilityUtils";
const initialSeed = generateSeed();
let graph = getGraph(grid);

View file

@ -1,5 +1,6 @@
import {byId} from "/src/utils/shorthands";
import {tip} from "/src/scripts/tooltips";
import {capitalize} from "@/utils/stringUtils";
appendStyleSheet();
insertHtml();

View file

@ -3,6 +3,7 @@ import {isWater} from "/src/utils/graphUtils";
import {tip} from "/src/scripts/tooltips";
import {byId} from "/src/utils/shorthands";
import {rn} from "/src/utils/numberUtils";
import {capitalize} from "@/utils/stringUtils";
const entitiesMap = {
states: {

View file

@ -1,3 +1,5 @@
import {capitalize} from "@/utils/stringUtils";
const capitalize = text => text.charAt(0).toUpperCase() + text.slice(1);
const format = rawList =>