New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

kryo

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kryo

Serialization for documents.

  • 0.5.0-alpha.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
167
increased by17.61%
Maintainers
1
Weekly downloads
 
Created
Source

Kryo

npm Build status GitHub repository

Documentation

Description

Expressive extensible schemas.

Install

npm install
gulp all:build

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>;
}

License

MIT License

FAQs

Package last updated on 10 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc