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

typescript-is

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-is - npm Package Compare versions

Comparing version 0.6.5 to 0.6.6

12

index.d.ts

@@ -57,5 +57,5 @@ /**

/**
* Options for the `AssertParameter` decorator.
* Options for the `AssertType` decorator.
*/
export interface AssertParameterOptions {
export interface AssertTypeOptions {
/**

@@ -72,3 +72,3 @@ * Message that will be passed to the error constructor, in case type assertion fails.

* @param options options for the decorator.
* Check `AssertParameterOptions` documentation for more.
* Check `AssertTypeOptions` documentation for more.
*

@@ -78,3 +78,3 @@ * @example

@ValidateClass
class A { method(@AssertParameter value: number) { value can safely be used a number } }
class A { method(@AssertType value: number) { value can safely be used a number } }
new A().method(0); // nothing happens

@@ -84,3 +84,3 @@ new A().method('0' as any); // will throw an error

*/
export function AssertParameter(options?: AssertParameterOptions): (target: object, propertyKey: string | symbol, parameterIndex: number) => void;
export function AssertType(options?: AssertTypeOptions): (target: object, propertyKey: string | symbol, parameterIndex: number) => void;

@@ -95,3 +95,3 @@ /**

@ValidateClass
class A { method(@AssertParameter value: number) { value can safely be used a number } }
class A { method(@AssertType value: number) { value can safely be used a number } }
new A().method(0); // nothing happens

@@ -98,0 +98,0 @@ new A().method('0' as any); // will throw an error

@@ -9,3 +9,3 @@ require('reflect-metadata');

function AssertParameter(assertion, options = {}) {
function AssertType(assertion, options = {}) {
return function (target, propertyKey, parameterIndex) {

@@ -37,2 +37,2 @@ const assertions = Reflect.getOwnMetadata(assertionsMetadataKey, target, propertyKey) || [];

module.exports = { is: warn, assertType: warn, createIs: warn, createAssertType: warn, AssertParameter, ValidateClass };
module.exports = { is: warn, assertType: warn, createIs: warn, createAssertType: warn, AssertType, ValidateClass };
{
"name": "typescript-is",
"version": "0.6.5",
"version": "0.6.6",
"engines": {

@@ -5,0 +5,0 @@ "node": ">=6.14.4"

@@ -145,3 +145,3 @@ # typescript-is

## Decorators (`ValidateClass` and `AssertParameter`)
## Decorators (`ValidateClass` and `AssertType`)

@@ -168,7 +168,7 @@ You can also use the **decorators** to automate validation in class methods.

```typescript
import { ValidateClass, AssertParameter } from 'typescript-is';
import { ValidateClass, AssertType } from 'typescript-is';
@ValidateClass()
class A {
method(@AssertParameter() value: number) {
method(@AssertType() value: number) {
// You can safely use value as a number

@@ -175,0 +175,0 @@ return value;

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