Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function validateConfig(
config: SaberConfig,
{ dev }: { dev: boolean }
): ValidatedSaberConfig {
const siteConfig = struct.interface(
{
title: 'string?',
description: 'string?'
},
{}
)
// Type of Saber plugins
const plugins = struct.union(
[
['string'],
[
{
resolve: 'string',
options: 'object?'
}
const markdown = struct(
{
slugify: 'string?',
options: 'object?',
headings: 'object?',
highlighter: 'string?',
lineNumbers: 'boolean?',
// Same as the type of Saber plugins
plugins
},
{
plugins: []
}
)
const themeConfig = struct.interface({}, {})
const permalinks = struct.union(['object', 'function'], {})
const server = struct(
{
host: 'string?',
port: 'number?'
},
{
host: '0.0.0.0',
port: 3000
}
)
const build = struct(
{
const { struct } = require('superstruct');
const names = require('./names');
const options = require('./options');
const {
cookies:
{
keys,
long,
short,
thirdPartyCheckUrl,
},
} = require('../../../lib/helpers/defaults');
module.exports = struct.interface({
names,
thirdPartyCheckUrl: 'string & webUri',
long: options(long),
short: options(short),
keys: ['string'],
}, {
names: {},
short: {},
long: {},
keys,
thirdPartyCheckUrl,
});