« get me outta code hell

data: dimensions utility - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/thing.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-09-08 16:22:10 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-08 16:22:10 -0300
commite01b73d286fbb11ac8ded59b4c23738dff195171 (patch)
tree0e512aa948de3e9cf55aec3507a2c7d68356b1c4 /src/data/things/thing.js
parentf39164ed44fe5c86f1f1911514d38a5549e51f92 (diff)
data: dimensions utility
Diffstat (limited to 'src/data/things/thing.js')
-rw-r--r--src/data/things/thing.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/data/things/thing.js b/src/data/things/thing.js
index 9e7f940f..0484b589 100644
--- a/src/data/things/thing.js
+++ b/src/data/things/thing.js
@@ -25,6 +25,7 @@ import {
   isColor,
   isContributionList,
   isDate,
+  isDimensions,
   isDirectory,
   isFileExtension,
   isName,
@@ -122,6 +123,15 @@ export function fileExtension(defaultFileExtension = null) {
   };
 }
 
+// Plain ol' image dimensions. This is a two-item array of positive integers,
+// corresponding to width and height respectively.
+export function dimensions() {
+  return {
+    flags: {update: true, expose: true},
+    update: {validate: isDimensions},
+  };
+}
+
 // Straightforward flag descriptor for a variety of property purposes.
 // Provide a default value, true or false!
 export function flag(defaultValue = false) {