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

superstruct

Package Overview
Dependencies
Maintainers
2
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

superstruct - npm Package Compare versions

Comparing version 2.0.0-0 to 2.0.0

15

dist/struct.d.ts

@@ -38,3 +38,4 @@ import { StructSchema } from './utils.js';

* Mask a value, coercing and validating it, but returning only the subset of
* properties defined by the struct's schema.
* properties defined by the struct's schema. Masking applies recursively to
* props of `object` structs only.
*/

@@ -46,8 +47,10 @@ mask(value: unknown, message?: string): T;

*
* You may optionally pass `true` for the `withCoercion` argument to coerce
* You may optionally pass `true` for the `coerce` argument to coerce
* the value before attempting to validate it. If you do, the result will
* contain the coerced result when successful.
* contain the coerced result when successful. Also, `mask` will turn on
* masking of the unknown `object` props recursively if passed.
*/
validate(value: unknown, options?: {
coerce?: boolean;
mask?: boolean;
message?: string;

@@ -83,3 +86,6 @@ }): [StructError, undefined] | [undefined, T];

* A `Context` contains information about the current location of the
* validation inside the initial input value.
* validation inside the initial input value. It also carries `mask`
* since it's a run-time flag determining how the validation was invoked
* (via `mask()` or via `validate()`), plus it applies recursively
* to all of the nested structs.
*/

@@ -89,2 +95,3 @@ export type Context = {

path: Array<any>;
mask?: boolean;
};

@@ -91,0 +98,0 @@ /**

@@ -8,2 +8,6 @@ import { Struct, Infer, Result, Context, Describe } from './struct.js';

/**
* Check if a value is a non-array object.
*/
export declare function isNonArrayObject(x: unknown): x is object;
/**
* Check if a value is a plain object.

@@ -10,0 +14,0 @@ */

{
"name": "superstruct",
"description": "A simple and composable way to validate data in JavaScript (and TypeScript).",
"version": "2.0.0-0",
"version": "2.0.0",
"license": "MIT",

@@ -19,3 +19,3 @@ "repository": "git://github.com/ianstormtaylor/superstruct.git",

"engines": {
"node": ">=18.0.0"
"node": ">=14.0.0"
},

@@ -38,5 +38,2 @@ "devDependencies": {

"eslint-plugin-prettier": "^5.1.3",
"is-email": "^1.0.0",
"is-url": "^1.2.4",
"is-uuid": "^1.0.2",
"lodash": "^4.17.15",

@@ -43,0 +40,0 @@ "np": "^10.0.0",

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

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

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