« get me outta code hell

fileExtension.js « wiki-properties « composite « data « src - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/wiki-properties/fileExtension.js
blob: c926fa8b44498973032c0e5bdf452e2f34c42977 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// A file extension! Or the default, if provided when calling this.

import {isFileExtension} from '#validators';

// TODO: Not templateCompositeFrom.

export default function(defaultFileExtension = null) {
  return {
    flags: {update: true, expose: true},
    update: {validate: isFileExtension},
    expose: {transform: (value) => value ?? defaultFileExtension},
  };
}