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

runtypes

Package Overview
Dependencies
Maintainers
2
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

runtypes - npm Package Compare versions

Comparing version 6.6.0 to 6.7.0

4

lib/types/brand.d.ts
import { Runtype, RuntypeBase, Static } from '../runtype';
export declare const RuntypeName: unique symbol;
export interface RuntypeBrand<B extends string> {
[RuntypeName]: B;
[RuntypeName]: {
[k in B]: B;
};
}

@@ -6,0 +8,0 @@ export interface Brand<B extends string, A extends RuntypeBase> extends Runtype<Static<A> & RuntypeBrand<B>> {

{
"name": "runtypes",
"version": "6.6.0",
"version": "6.7.0",
"description": "Runtime validation for static types",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -356,2 +356,12 @@ # Runtypes [![Build Status](https://travis-ci.org/pelotom/runtypes.svg?branch=master)](https://travis-ci.org/pelotom/runtypes) [![Coverage Status](https://coveralls.io/repos/github/pelotom/runtypes/badge.svg?branch=master)](https://coveralls.io/github/pelotom/runtypes?branch=master)

## `instanceof` wrapper
If you have access to the class that you want to test values with the `instanceof` operator, then the `InstanceOf` runtype is exactly what you're looking for. Usage is straightforward:
```ts
class ObjectId { ... };
const ObjectIdChecker = InstanceOf(ObjectId);
ObjectIdChecker.check(value);
```
## Function contracts

@@ -547,3 +557,3 @@

- [generate-runtypes](https://github.com/cobraz/generate-runtypes#readme) Generates runtypes from structured data. Useful for code generators
- [generate-runtypes](https://github.com/simenandre/generate-runtypes#readme) Generates runtypes from structured data. Useful for code generators
- [json-to-runtypes](https://github.com/runeh/json-to-runtypes#readme) Generates runtypes by parsing example JSON data

@@ -550,0 +560,0 @@ - [rest.ts](https://github.com/hmil/rest.ts) Allows building type safe and runtime-checked APIs

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