« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/wiki-properties/canonicalBase.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/composite/wiki-properties/canonicalBase.js')
-rw-r--r--src/data/composite/wiki-properties/canonicalBase.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/data/composite/wiki-properties/canonicalBase.js b/src/data/composite/wiki-properties/canonicalBase.js
new file mode 100644
index 00000000..81740d6c
--- /dev/null
+++ b/src/data/composite/wiki-properties/canonicalBase.js
@@ -0,0 +1,16 @@
+import {isURL} from '#validators';
+
+export default function() {
+  return {
+    flags: {update: true, expose: true},
+    update: {validate: isURL},
+    expose: {
+      transform: (value) =>
+        (value === null
+          ? null
+       : value.endsWith('/')
+          ? value
+          : value + '/'),
+    },
+  };
+}