You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
495 B
JavaScript
21 lines
495 B
JavaScript
'use strict';
|
|
|
|
const isString = require("@validatem/is-string");
|
|
const required = require("@validatem/required");
|
|
const dynamic = require("@validatem/dynamic");
|
|
const when = require("@validatem/when");
|
|
|
|
module.exports = dynamic((object) => ({
|
|
name: [ required, isString ],
|
|
description: [ isString ],
|
|
source: [ required, isString ],
|
|
url: [
|
|
isString,
|
|
when(() => object.source === "http", [ required ])
|
|
],
|
|
path: [
|
|
isString,
|
|
when(() => object.source === "local", [ required ])
|
|
]
|
|
}));
|