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

@tldraw/tlvalidate

Package Overview
Dependencies
Maintainers
4
Versions
319
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tldraw/tlvalidate - npm Package Compare versions

Comparing version 0.1.0-alpha.6 to 0.1.0-alpha.7

18

dist/cjs/lib/validation.js

@@ -34,4 +34,6 @@ "use strict";

dict: () => dict,
integer: () => integer,
literal: () => literal,
model: () => model,
nonZeroInteger: () => nonZeroInteger,
nonZeroNumber: () => nonZeroNumber,

@@ -41,2 +43,3 @@ number: () => number,

point: () => point,
positiveInteger: () => positiveInteger,
positiveNumber: () => positiveNumber,

@@ -210,2 +213,5 @@ setEnum: () => setEnum,

}
allowUnknownProperties() {
return new ObjectValidator(this.config, true);
}
extend(extension) {

@@ -286,2 +292,14 @@ return new ObjectValidator({ ...this.config, ...extension });

});
const integer = number.check((value) => {
if (!Number.isInteger(value))
throw new ValidationError(`Expected an integer, got ${value}`);
});
const positiveInteger = integer.check((value) => {
if (value < 0)
throw new ValidationError(`Expected a positive integer, got ${value}`);
});
const nonZeroInteger = integer.check((value) => {
if (value <= 0)
throw new ValidationError(`Expected a non-zero positive integer, got ${value}`);
});
const boolean = typeofValidator("boolean");

@@ -288,0 +306,0 @@ const bigint = typeofValidator("bigint");

@@ -161,2 +161,5 @@ import { exhaustiveSwitchError, getOwnProperty, hasOwnProperty } from "@tldraw/utils";

}
allowUnknownProperties() {
return new ObjectValidator(this.config, true);
}
extend(extension) {

@@ -237,2 +240,14 @@ return new ObjectValidator({ ...this.config, ...extension });

});
const integer = number.check((value) => {
if (!Number.isInteger(value))
throw new ValidationError(`Expected an integer, got ${value}`);
});
const positiveInteger = integer.check((value) => {
if (value < 0)
throw new ValidationError(`Expected a positive integer, got ${value}`);
});
const nonZeroInteger = integer.check((value) => {
if (value <= 0)
throw new ValidationError(`Expected a non-zero positive integer, got ${value}`);
});
const boolean = typeofValidator("boolean");

@@ -317,4 +332,6 @@ const bigint = typeofValidator("bigint");

dict,
integer,
literal,
model,
nonZeroInteger,
nonZeroNumber,

@@ -324,2 +341,3 @@ number,

point,
positiveInteger,
positiveNumber,

@@ -326,0 +344,0 @@ setEnum,

@@ -63,2 +63,8 @@ /**

/**
* Fails if number is not an integer
* @public
*/
declare const integer: Validator<number>;
/**
* Validates that a value matches another that was passed in.

@@ -86,2 +92,8 @@ *

/**
* Fails if value \<= 0 and is not an integer
* @public
*/
declare const nonZeroInteger: Validator<number>;
/**
* Fails if value \<= 0

@@ -115,2 +127,3 @@ * @public

}, shouldAllowUnknownProperties?: boolean);
allowUnknownProperties(): ObjectValidator<Shape>;
/**

@@ -142,2 +155,8 @@ * Extend an object validator by adding additional properties.

/**
* Fails if value \< 0 and is not an integer
* @public
*/
declare const positiveInteger: Validator<number>;
/**
* Fails if value \< 0

@@ -180,2 +199,5 @@ * @public

nonZeroNumber,
integer,
positiveInteger,
nonZeroInteger,
boolean,

@@ -182,0 +204,0 @@ bigint,

4

package.json

@@ -5,3 +5,3 @@ {

"description": "A tiny little drawing app (validation).",
"version": "0.1.0-alpha.6",
"version": "0.1.0-alpha.7",
"author": "tldraw GB Ltd.",

@@ -31,3 +31,3 @@ "homepage": "https://tldraw.dev",

"dependencies": {
"@tldraw/utils": "0.1.0-alpha.6"
"@tldraw/utils": "0.1.0-alpha.7"
},

@@ -34,0 +34,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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