@tldraw/tlvalidate
Advanced tools
Comparing version 2.0.0-alpha.7 to 2.0.0-canary.97774cc01
@@ -21,2 +21,6 @@ "use strict"; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
@@ -23,0 +27,0 @@ mod |
@@ -121,2 +121,7 @@ "use strict"; | ||
} | ||
/** | ||
* Asserts that the passed value is of the correct type and returns it. The | ||
* returned value is guaranteed to be referentially equal to the passed | ||
* value. | ||
*/ | ||
validate(value) { | ||
@@ -129,2 +134,6 @@ const validated = this.validationFn(value); | ||
} | ||
/** | ||
* Returns a new validator that also accepts null or undefined. The | ||
* resulting value will always be null. | ||
*/ | ||
nullable() { | ||
@@ -137,2 +146,6 @@ return new Validator((value) => { | ||
} | ||
/** | ||
* Returns a new validator that also accepts null or undefined. The | ||
* resulting value will always be null. | ||
*/ | ||
optional() { | ||
@@ -145,2 +158,7 @@ return new Validator((value) => { | ||
} | ||
/** | ||
* Refine this validation to a new type. The passed-in validation function | ||
* should throw an error if the value can't be converted to the new type, or | ||
* return the new type otherwise. | ||
*/ | ||
refine(otherValidationFn) { | ||
@@ -218,2 +236,15 @@ return new Validator((value) => { | ||
} | ||
/** | ||
* Extend an object validator by adding additional properties. | ||
* | ||
* @example | ||
* ```ts | ||
* const animalValidator = T.object({ | ||
* name: T.string, | ||
* }) | ||
* const catValidator = animalValidator.extend({ | ||
* meowVolume: T.number, | ||
* }) | ||
* ``` | ||
*/ | ||
extend(extension) { | ||
@@ -220,0 +251,0 @@ return new ObjectValidator({ ...this.config, ...extension }); |
@@ -71,2 +71,7 @@ import { exhaustiveSwitchError, getOwnProperty, hasOwnProperty } from "@tldraw/utils"; | ||
} | ||
/** | ||
* Asserts that the passed value is of the correct type and returns it. The | ||
* returned value is guaranteed to be referentially equal to the passed | ||
* value. | ||
*/ | ||
validate(value) { | ||
@@ -79,2 +84,6 @@ const validated = this.validationFn(value); | ||
} | ||
/** | ||
* Returns a new validator that also accepts null or undefined. The | ||
* resulting value will always be null. | ||
*/ | ||
nullable() { | ||
@@ -87,2 +96,6 @@ return new Validator((value) => { | ||
} | ||
/** | ||
* Returns a new validator that also accepts null or undefined. The | ||
* resulting value will always be null. | ||
*/ | ||
optional() { | ||
@@ -95,2 +108,7 @@ return new Validator((value) => { | ||
} | ||
/** | ||
* Refine this validation to a new type. The passed-in validation function | ||
* should throw an error if the value can't be converted to the new type, or | ||
* return the new type otherwise. | ||
*/ | ||
refine(otherValidationFn) { | ||
@@ -168,2 +186,15 @@ return new Validator((value) => { | ||
} | ||
/** | ||
* Extend an object validator by adding additional properties. | ||
* | ||
* @example | ||
* ```ts | ||
* const animalValidator = T.object({ | ||
* name: T.string, | ||
* }) | ||
* const catValidator = animalValidator.extend({ | ||
* meowVolume: T.number, | ||
* }) | ||
* ``` | ||
*/ | ||
extend(extension) { | ||
@@ -170,0 +201,0 @@ return new ObjectValidator({ ...this.config, ...extension }); |
101
package.json
{ | ||
"name": "@tldraw/tlvalidate", | ||
"private": false, | ||
"description": "A tiny little drawing app (validation).", | ||
"version": "2.0.0-alpha.7", | ||
"author": "tldraw GB Ltd.", | ||
"homepage": "https://tldraw.dev", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/tldraw/tldraw" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/tldraw/tldraw/issues" | ||
}, | ||
"main": "dist/cjs/index.js", | ||
"types": "index.d.ts", | ||
"files": [ | ||
"dist/**/*", | ||
"index.d.ts" | ||
], | ||
"scripts": { | ||
"test": "jest", | ||
"test:coverage": "jest --coverage", | ||
"typecheck": "tsc --build", | ||
"build": "tsx ../../scripts/build-package.ts", | ||
"prepack": "tsx ../../scripts/prepack.ts", | ||
"postpack": "../../scripts/postpack.sh", | ||
"lint": "tsx ../../scripts/lint.ts" | ||
}, | ||
"dependencies": { | ||
"@tldraw/utils": "2.0.0-alpha.7" | ||
}, | ||
"devDependencies": { | ||
"@swc/core": "^1.2.204", | ||
"@swc/jest": "^0.2.21", | ||
"ts-node-dev": "^1.1.8" | ||
}, | ||
"jest": { | ||
"preset": "config/jest/node", | ||
"setupFiles": [ | ||
"raf/polyfill" | ||
], | ||
"moduleNameMapper": { | ||
"^~(.*)": "<rootDir>/src/$1" | ||
} | ||
}, | ||
"module": "dist/esm/index.js", | ||
"source": "src/index.ts" | ||
"name": "@tldraw/tlvalidate", | ||
"description": "A tiny little drawing app (validation).", | ||
"version": "2.0.0-canary.97774cc01", | ||
"author": { | ||
"name": "tldraw GB Ltd.", | ||
"email": "hello@tldraw.com" | ||
}, | ||
"homepage": "https://tldraw.dev", | ||
"license": "Apache-2.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/tldraw/tldraw" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/tldraw/tldraw/issues" | ||
}, | ||
"keywords": [ | ||
"tldraw", | ||
"drawing", | ||
"app", | ||
"development", | ||
"whiteboard", | ||
"canvas", | ||
"infinite" | ||
], | ||
"main": "dist/cjs/index.js", | ||
"types": "index.d.ts", | ||
"files": [ | ||
"dist/**/*", | ||
"index.d.ts" | ||
], | ||
"scripts": { | ||
"test": "yarn run -T jest", | ||
"test:coverage": "yarn run -T jest --coverage", | ||
"typecheck": "yarn run -T tsc --build", | ||
"build": "yarn run -T tsx ../../scripts/build-package.ts", | ||
"prepack": "yarn run -T tsx ../../scripts/prepack.ts", | ||
"postpack": "../../scripts/postpack.sh", | ||
"lint": "yarn run -T tsx ../../scripts/lint.ts" | ||
}, | ||
"dependencies": { | ||
"@tldraw/utils": "2.0.0-canary.97774cc01" | ||
}, | ||
"jest": { | ||
"preset": "config/jest/node", | ||
"setupFiles": [ | ||
"raf/polyfill" | ||
], | ||
"moduleNameMapper": { | ||
"^~(.*)": "<rootDir>/src/$1" | ||
} | ||
}, | ||
"module": "dist/esm/index.js", | ||
"source": "src/index.ts" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
94710
0
18
1111
1
+ Added@tldraw/utils@2.0.0-canary.97774cc01(transitive)
- Removed@tldraw/utils@2.0.0-alpha.7(transitive)