0.2.2 • Published 9 years ago

via-type v0.2.2

Weekly downloads
13
License
MIT
Repository
github
Last release
9 years ago

Via-Type

Description

Simple type interfaces.

Install

npm install
gulp build.node

API

String

new StringType(options: DocumentOptions);
export interface StringOptions {
  regex?: RegExp; // null
  lowerCase?: boolean; // false
  trimmed?: boolean; // false
  minLength?: number; // null
  maxLength?: number; // null
  
  looseTest?: boolean; // false
}

looseTest: The test returns true if the only errors found can be fixed with .normalize.

.test(options: StringOptions)

Tests whether a string is valid or not according to the options.

Document

new DocumentType(options: DocumentOptions);

Creates a new type to match against documents. This type ensures that the defined properties are set, enumerable and valid.

DocumentOptions:

  • properties: Dictionary<PropertyDescriptor>: Each key is used as the property name and the associated behaviour is determined by the associated PropertyDescriptor. If the value is null, then the property is deleted (ignored) - usefull when extending the DocumentOptions.

    PropertyDescriptor:

    • type: Type: the type of the property (soon: If the type is null -> allow any value, requires manual read/write)

    • optional: boolean: Allows the value to be null

  • additionalProperties: boolean: Allow (and ignore) additional properties when doing tests

.diff

interface DiffResult {
    $set: Dictionary<jsonValues>;
    $update: Dictionary<Diff>;
    $unset: Dictionary<jsonValues>;
}
0.2.2

9 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.9

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago