Quellcode durchsuchen

utility functions

Jason Gorst vor 1 Monat
Ursprung
Commit
9743340a6d
4 geänderte Dateien mit 26 neuen und 0 gelöschten Zeilen
  1. 4 0
      app/utils/callAfterDelay.js
  2. 1 0
      app/utils/emptyCharacter.js
  3. 3 0
      app/utils/findUpdated.js
  4. 18 0
      app/utils/ptViewMerge.js

+ 4 - 0
app/utils/callAfterDelay.js

@@ -0,0 +1,4 @@
+export default async function callAfterDelay(callback, delay) {
+  await sleep(delay)
+  await callback()
+}

+ 1 - 0
app/utils/emptyCharacter.js

@@ -0,0 +1 @@
+export default _mapValues(characterFields, "initialValue")

+ 3 - 0
app/utils/findUpdated.js

@@ -0,0 +1,3 @@
+export default function findUpdated(source, target) {
+  return _pickBy(target, (value, key) => !_isEqual(value, source?.[key]))
+}

+ 18 - 0
app/utils/ptViewMerge.js

@@ -0,0 +1,18 @@
+import { twMerge } from "tailwind-merge"
+import { mergeProps } from "vue"
+
+export default function ptViewMerge(
+  globalPTProps = {},
+  selfPTProps = {},
+  datasets
+) {
+  const { class: globalClass, ...globalRest } = globalPTProps
+  const { class: selfClass, ...selfRest } = selfPTProps
+
+  return mergeProps(
+    { class: twMerge(globalClass, selfClass) },
+    globalRest,
+    selfRest,
+    datasets
+  )
+}