How to use the rulr/Intersection function in rulr

To help you get started, we’ve selected a few rulr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kube-js / kube-ts-server / src / presenter / express / utils / schemas / users / createItem / index.ts View on Github external
import Intersection from 'rulr/Intersection';
import Record from 'rulr/Record';
import { VARCHAR_LENGTH } from '../../../../../../constants';
import Email from '../../../../../../utils/validation/rules/Email';
import Password from '../../../../../../utils/validation/rules/Password';
import String from '../../../../../../utils/validation/rules/String';
import baseSchema from '../base/schema';

export const schema = {
  ...baseSchema,
  email: Intersection([String(0, VARCHAR_LENGTH), Email()]),
  password: Intersection([String(0, VARCHAR_LENGTH), Password()]),
};

const rules = Record(schema);

export default rules;
github kube-js / kube-ts-server / src / presenter / express / utils / schemas / auth / register / index.ts View on Github external
import Intersection from 'rulr/Intersection';
import Object from 'rulr/Object';
import Record from 'rulr/Record';
import { VARCHAR_LENGTH } from '../../../../../../constants';
import Email from '../../../../../../utils/validation/rules/Email';
import Match from '../../../../../../utils/validation/rules/Match';
import Password from '../../../../../../utils/validation/rules/Password';
import String from '../../../../../../utils/validation/rules/String';
import { schema as baseSchema } from '../../users/createItem';

export const schema = {
  ...baseSchema,
  email: Intersection([String(0, VARCHAR_LENGTH), Email()]),
  password: Intersection([String(0, VARCHAR_LENGTH), Password()]),
  password_confirmation: Intersection([String(0, VARCHAR_LENGTH), Password()]),
};

const rules = Intersection([
  Object,
  Record(schema),
  Match('password', 'password_confirmation'),
]);

export default rules;
github kube-js / kube-ts-server / src / presenter / express / utils / schemas / auth / register / index.ts View on Github external
import Intersection from 'rulr/Intersection';
import Object from 'rulr/Object';
import Record from 'rulr/Record';
import { VARCHAR_LENGTH } from '../../../../../../constants';
import Email from '../../../../../../utils/validation/rules/Email';
import Match from '../../../../../../utils/validation/rules/Match';
import Password from '../../../../../../utils/validation/rules/Password';
import String from '../../../../../../utils/validation/rules/String';
import { schema as baseSchema } from '../../users/createItem';

export const schema = {
  ...baseSchema,
  email: Intersection([String(0, VARCHAR_LENGTH), Email()]),
  password: Intersection([String(0, VARCHAR_LENGTH), Password()]),
  password_confirmation: Intersection([String(0, VARCHAR_LENGTH), Password()]),
};

const rules = Intersection([
  Object,
  Record(schema),
  Match('password', 'password_confirmation'),
]);

export default rules;
github kube-js / kube-ts-server / src / presenter / express / utils / schemas / auth / resetPassword / index.ts View on Github external
import Intersection from 'rulr/Intersection';
import Object from 'rulr/Object';
import Record from 'rulr/Record';
import { UUID_LENGTH, VARCHAR_LENGTH } from '../../../../../../constants';
import Match from '../../../../../../utils/validation/rules/Match';
import Password from '../../../../../../utils/validation/rules/Password';
import String from '../../../../../../utils/validation/rules/String';

export const schema = {
  password: Intersection([String(0, VARCHAR_LENGTH),Password()]),
  password_confirmation: Intersection([String(0, VARCHAR_LENGTH),Password()]),
  token: String(UUID_LENGTH, UUID_LENGTH),
};

const rules = Intersection([
  Object,
  Record(schema),
  Match('password', 'password_confirmation'),
]);

export default rules;
github kube-js / kube-ts-server / src / presenter / express / utils / schemas / auth / resetPassword / index.ts View on Github external
import Intersection from 'rulr/Intersection';
import Object from 'rulr/Object';
import Record from 'rulr/Record';
import { UUID_LENGTH, VARCHAR_LENGTH } from '../../../../../../constants';
import Match from '../../../../../../utils/validation/rules/Match';
import Password from '../../../../../../utils/validation/rules/Password';
import String from '../../../../../../utils/validation/rules/String';

export const schema = {
  password: Intersection([String(0, VARCHAR_LENGTH),Password()]),
  password_confirmation: Intersection([String(0, VARCHAR_LENGTH),Password()]),
  token: String(UUID_LENGTH, UUID_LENGTH),
};

const rules = Intersection([
  Object,
  Record(schema),
  Match('password', 'password_confirmation'),
]);

export default rules;
github kube-js / kube-ts-server / src / presenter / express / utils / schemas / auth / register / index.ts View on Github external
import Record from 'rulr/Record';
import { VARCHAR_LENGTH } from '../../../../../../constants';
import Email from '../../../../../../utils/validation/rules/Email';
import Match from '../../../../../../utils/validation/rules/Match';
import Password from '../../../../../../utils/validation/rules/Password';
import String from '../../../../../../utils/validation/rules/String';
import { schema as baseSchema } from '../../users/createItem';

export const schema = {
  ...baseSchema,
  email: Intersection([String(0, VARCHAR_LENGTH), Email()]),
  password: Intersection([String(0, VARCHAR_LENGTH), Password()]),
  password_confirmation: Intersection([String(0, VARCHAR_LENGTH), Password()]),
};

const rules = Intersection([
  Object,
  Record(schema),
  Match('password', 'password_confirmation'),
]);

export default rules;
github kube-js / kube-ts-server / src / presenter / express / utils / schemas / auth / resetPassword / index.ts View on Github external
import Intersection from 'rulr/Intersection';
import Object from 'rulr/Object';
import Record from 'rulr/Record';
import { UUID_LENGTH, VARCHAR_LENGTH } from '../../../../../../constants';
import Match from '../../../../../../utils/validation/rules/Match';
import Password from '../../../../../../utils/validation/rules/Password';
import String from '../../../../../../utils/validation/rules/String';

export const schema = {
  password: Intersection([String(0, VARCHAR_LENGTH),Password()]),
  password_confirmation: Intersection([String(0, VARCHAR_LENGTH),Password()]),
  token: String(UUID_LENGTH, UUID_LENGTH),
};

const rules = Intersection([
  Object,
  Record(schema),
  Match('password', 'password_confirmation'),
]);

export default rules;
github kube-js / kube-ts-server / src / presenter / express / utils / schemas / auth / register / index.ts View on Github external
import Intersection from 'rulr/Intersection';
import Object from 'rulr/Object';
import Record from 'rulr/Record';
import { VARCHAR_LENGTH } from '../../../../../../constants';
import Email from '../../../../../../utils/validation/rules/Email';
import Match from '../../../../../../utils/validation/rules/Match';
import Password from '../../../../../../utils/validation/rules/Password';
import String from '../../../../../../utils/validation/rules/String';
import { schema as baseSchema } from '../../users/createItem';

export const schema = {
  ...baseSchema,
  email: Intersection([String(0, VARCHAR_LENGTH), Email()]),
  password: Intersection([String(0, VARCHAR_LENGTH), Password()]),
  password_confirmation: Intersection([String(0, VARCHAR_LENGTH), Password()]),
};

const rules = Intersection([
  Object,
  Record(schema),
  Match('password', 'password_confirmation'),
]);

export default rules;
github kube-js / kube-ts-server / src / presenter / express / utils / schemas / users / createItem / index.ts View on Github external
import Intersection from 'rulr/Intersection';
import Record from 'rulr/Record';
import { VARCHAR_LENGTH } from '../../../../../../constants';
import Email from '../../../../../../utils/validation/rules/Email';
import Password from '../../../../../../utils/validation/rules/Password';
import String from '../../../../../../utils/validation/rules/String';
import baseSchema from '../base/schema';

export const schema = {
  ...baseSchema,
  email: Intersection([String(0, VARCHAR_LENGTH), Email()]),
  password: Intersection([String(0, VARCHAR_LENGTH), Password()]),
};

const rules = Record(schema);

export default rules;

rulr

Validation and unit conversion errors in TypeScript at compile-time. Started in 2016.

MIT
Latest version published 4 days ago

Package Health Score

72 / 100
Full package analysis