<|start_filename|>docs/.vuepress/config.js<|end_filename|>
module.exports = {
  base: '/v8n/',
  title: 'v8n',
  description: 'The ultimate JavaScript validation library',
  themeConfig: {
    nav: [
      { text: 'Guide', link: '/' },
      { text: 'API', link: '/api/' },
    ],
    sidebar: {
      '/': ['', '/Installation.md', '/Validation.md', '/Extending.md'],
      '/api/': [''],
    },
    sidebarDepth: 2,
    displayAllHeaders: true,
    lastUpdated: 'Last Updated',
    repo: 'imbrn/v8n',
    repoLabel: 'GitHub',
    docsRepo: 'imbrn/v8n',
    docsDir: 'docs',
    docsBranch: 'master',
    editLinks: false,
    editLinkText: 'Edit on GitHub',
  },
};


<|start_filename|>rollup.config.js<|end_filename|>
import project from './package.json';
import buble from '@rollup/plugin-buble';
import { terser } from 'rollup-plugin-terser';

function buildConfig({ filename, format, transpile = true }) {
  // Enforces the '.min.js' naming standard
  const minify = filename.endsWith('.min.js');

  const plugins = [];
  if (transpile) plugins.push(buble());
  if (minify) plugins.push(terser());

  return {
    input: './src/v8n.js',
    output: {
      name: project.name,
      format,
      file: './dist/' + filename,
      sourcemap: minify,
      exports: 'default',
    },
    plugins,
  };
}

const configs = [
  // AMD″
  buildConfig({ filename: 'v8n.amd.js', format: 'amd' }),

  // CJS
  buildConfig({ filename: 'v8n.cjs.js', format: 'cjs' }),

  // UMD
  buildConfig({ filename: 'v8n.umd.js', format: 'umd' }),
  buildConfig({ filename: 'v8n.min.js', format: 'umd' }),

  // IIFE
  buildConfig({ filename: 'v8n.browser.js', format: 'iife' }),
  buildConfig({ filename: 'v8n.browser.min.js', format: 'iife' }),

  // ESM
  buildConfig({ filename: 'v8n.esm.js', format: 'es' }),
  buildConfig({
    filename: 'v8n.esm.browser.js',
    format: 'es',
    transpile: false,
  }),
  buildConfig({
    filename: 'v8n.esm.browser.min.js',
    format: 'es',
    transpile: false,
  }),

  // System
  buildConfig({ filename: 'v8n.system.js', format: 'system' }),
];

export default configs;


<|start_filename|>src/ValidationError.js<|end_filename|>
class ValidationError extends Error {
  constructor(rule, value, cause, target, ...remaining) {
    super(remaining);
    if (Error.captureStackTrace) {
      Error.captureStackTrace(this, ValidationError);
    }
    this.rule = rule;
    this.value = value;
    this.cause = cause;
    this.target = target;
  }
}

export default ValidationError;


<|start_filename|>src/Modifier.js<|end_filename|>
class Modifier {
  constructor(name, perform, performAsync) {
    this.name = name;
    this.perform = perform;
    this.performAsync = performAsync;
  }
}

export default Modifier;
