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

@vitrical/utils

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vitrical/utils - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

2

express.ts

@@ -53,4 +53,4 @@ import { Request, Response, NextFunction } from 'express'

} else {
next(`Errors present in the request body:\n${errors.reduce((a, b) => ` ${a}\n ${b}`)}`)
next(`Errors present in the request body:\n ${errors.reduce((a, b) => `${a}\n ${b}`)}`)
}
}
{
"name": "@vitrical/utils",
"version": "1.0.4",
"version": "1.0.5",
"description": "Collection of useful functions and typings",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -12,3 +12,3 @@ "use strict";

exports.__esModule = true;
exports.validateObject = exports.isValidationType = exports.getSeason = exports.capitalize = exports.isValidNAPhoneNumber = exports.formatPhoneNumber = exports.isValidEmail = exports.removeSpaces = exports.removeSpecialCharacters = exports.isApiError = exports.objectHasProperty = void 0;
exports.objectMatchesSchema = exports.validateObject = exports.isValidationType = exports.getSeason = exports.capitalize = exports.isValidNAPhoneNumber = exports.formatPhoneNumber = exports.isValidEmail = exports.removeSpaces = exports.removeSpecialCharacters = exports.isApiError = exports.objectHasProperty = void 0;
var objectHasProperty = function (obj, property) {

@@ -200,2 +200,10 @@ return !!obj && typeof obj === 'object' && property in obj;

exports.validateObject = validateObject;
function objectMatchesSchema(schema, data) {
var errors = validateObject(schema, data);
if (errors.length !== 0) {
throw new Error("Object does not match what is expected\n ".concat(errors.reduce(function (a, b) { return "".concat(a, "\n ").concat(b); })));
}
return true;
}
exports.objectMatchesSchema = objectMatchesSchema;
//# sourceMappingURL=validation.js.map

@@ -244,1 +244,11 @@ export const objectHasProperty = (

}
export function objectMatchesSchema<T>(schema: ValidateObjectOptions, data: unknown): data is T {
const errors = validateObject(schema, data)
if (errors.length !== 0) {
throw new Error(
`Object does not match what is expected\n ${errors.reduce((a, b) => `${a}\n ${b}`)}`
)
}
return true
}

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