about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/util/js_helpers.js
diff options
context:
space:
mode:
authorkibigo! <marrus-sh@users.noreply.github.com>2018-01-05 18:23:06 -0800
committerkibigo! <marrus-sh@users.noreply.github.com>2018-01-05 21:16:43 -0800
commite4bc013d6f5e0fb8c6e612460182207a6c5d1c43 (patch)
tree467f470a0afa2149fcbec92b7678799371c4cc13 /app/javascript/flavours/glitch/util/js_helpers.js
parent6932b464e6952a9d29787a140a026dce724bfb59 (diff)
Threaded mode~
Diffstat (limited to 'app/javascript/flavours/glitch/util/js_helpers.js')
-rw-r--r--app/javascript/flavours/glitch/util/js_helpers.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/util/js_helpers.js b/app/javascript/flavours/glitch/util/js_helpers.js
new file mode 100644
index 000000000..2ebd5b6c5
--- /dev/null
+++ b/app/javascript/flavours/glitch/util/js_helpers.js
@@ -0,0 +1,5 @@
+//  This function returns the new value unless it is `null` or
+//  `undefined`, in which case it returns the old one.
+export function overwrite (oldVal, newVal) {
+  return newVal === null || typeof newVal === 'undefined' ? oldVal : newVal;
+}