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

@balena/sbvr-types

Package Overview
Dependencies
Maintainers
1
Versions
222
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@balena/sbvr-types - npm Package Compare versions

Comparing version 4.0.0-joshbwlng-json-validation-0ee9ab14744f36249a7d7bf46ad8501d7e8c29ef-1 to 4.0.0-joshbwlng-json-validation-ae0b834536e7d295bbd2dcc75c734a901fd6d352-1

2

CHANGELOG.md

@@ -8,3 +8,3 @@ # Change Log

# v4.0.0
## (2022-11-09)
## (2022-11-12)

@@ -11,0 +11,0 @@ * Assert that JSON input typeof is object [Josh Bowling]

@@ -5,3 +5,2 @@ "use strict";

const TypeUtils = require("../type-utils");
const assert_1 = require("assert");
exports.types = {

@@ -18,4 +17,6 @@ postgres: 'TEXT',

exports.validate = TypeUtils.validate.checkRequired((value) => {
if (typeof value !== 'object') {
throw new Error(`is not an object/array: ${typeof value}`);
}
try {
(0, assert_1.strict)(typeof value === 'object');
return JSON.stringify(value);

@@ -22,0 +23,0 @@ }

{
"name": "@balena/sbvr-types",
"version": "4.0.0-joshbwlng-json-validation-0ee9ab14744f36249a7d7bf46ad8501d7e8c29ef-1",
"version": "4.0.0-joshbwlng-json-validation-ae0b834536e7d295bbd2dcc75c734a901fd6d352-1",
"description": "SBVR type definitions.",

@@ -34,3 +34,2 @@ "main": "out",

"@types/mocha": "^9.1.0",
"@types/node": "^18.11.9",
"bluebird": "^3.7.2",

@@ -68,4 +67,4 @@ "chai": "^4.3.6",

"versionist": {
"publishedAt": "2022-11-09T10:48:26.013Z"
"publishedAt": "2022-11-12T12:31:12.948Z"
}
}
import * as TypeUtils from '../type-utils';
import { strict as assert } from 'assert';
export const types = {

@@ -17,6 +15,8 @@ postgres: 'TEXT',

export const validate = TypeUtils.validate.checkRequired((value) => {
// Disallow primitives
if (typeof value !== 'object') {
throw new Error(`is not an object/array: ${typeof value}`);
}
try {
// Disallow primitives
assert(typeof value === 'object');
return JSON.stringify(value);

@@ -23,0 +23,0 @@ } catch {

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