Răsfoiți Sursa

utility functions

Jason Gorst 1 lună în urmă
părinte
comite
9743340a6d

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