Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tiva

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiva

Expensive plain object type validator leverages TypeScript language service.

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.7K
increased by257.55%
Maintainers
1
Weekly downloads
 
Created
Source

NPM Package Build Status

Tiva

⏱️ EXPENSIVE plain object type validator leverages TypeScript language service.

Usage

yarn add tiva
import {Tiva} from 'tiva';

let tiva = new Tiva();

tiva.validate('string[]', ['foo', 'bar']).then(console.info, console.error);

tiva
  .validate(
    {module: 'module-specifier', type: 'AwesomeType'},
    {foo: 'abc', bar: 123},
  )
  .then(console.info, console.error);

Extensions

Tiva can validate with extended validator functions that matches by @tag in JSDoc comments:

interface Foo {
  /** @uuid */
  id: string;
}

There are a few built-in extensions:

  • @pattern <pattern> Validate by regular expression pattern.
  • @uuid [version] UUID.
  • @unique [group] Validate that there's no more than one occurrence.

Checkout @built-in-extensions.ts for implementation details.

Custom extensions can be provided by options.extensions of Tiva constructor.

License

MIT License.

FAQs

Package last updated on 10 Nov 2019

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