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.
22 lines
423 B
JavaScript
22 lines
423 B
JavaScript
6 years ago
|
'use strict';
|
||
|
|
||
|
const checkit = require("checkit");
|
||
|
const oneOf = require("../../validators/one-of");
|
||
|
|
||
|
module.exports = checkit({
|
||
|
name: "string",
|
||
|
description: "string",
|
||
|
source: ["required", "string", oneOf([
|
||
|
"local",
|
||
|
"http"
|
||
|
])]
|
||
|
}).maybe({
|
||
|
url: ["required", "string"]
|
||
|
}, (input) => {
|
||
|
return (input.source === "http");
|
||
|
}).maybe({
|
||
|
path: ["required", "string"]
|
||
|
}, (input) => {
|
||
|
return (input.source === "local");
|
||
|
});
|