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

typescanner

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescanner - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

2

package.json
{
"name": "typescanner",
"version": "0.5.0",
"version": "0.5.1",
"description": "A simple library for implementing type guard in TypeScript.",

@@ -5,0 +5,0 @@ "author": "yona3",

@@ -157,2 +157,21 @@ # typescanner

### Debugging with scannar
If you want to see which field has the problem, set `outputLog` to `true`.
> **WARNING**: If the scanner is nested, it may not output logs as expected.
```ts
const isBar = scanner<Bar>({
a: string,
b: number,
}, { outputLog: true })
// throw error
if (!isBar(data)) throw new Error("data is invalid")
// Error: value.${key} does not meet the condition.
```
### scan

@@ -167,3 +186,3 @@ `scan` is used with the first argument being the value you want to validate and the second argument being the `Condition`.

// Error!
const data = scan(bar as unknown, isFoo); // Error: value.key does not meet the condition.
const data = scan(bar as unknown, isFoo); // Error: type assertion is failed.
```

@@ -193,2 +212,6 @@

// isUnion
isUnion<string | number>(1, isString, isNumber)
// isObject

@@ -195,0 +218,0 @@

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