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

schema-llama

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

schema-llama - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

19

dist/index.js

@@ -35,2 +35,5 @@ 'use strict';

}
//TODO: implement check for required fields.
const toJSON = function () {

@@ -77,2 +80,9 @@ const object = {};

switch (key) {
case 'required':
{
if (options[key].constructor !== Array) {
throw new _errors.TypeError(`Required field list must be an array of strings or numbers.`);
}
break;
}
case 'attemptCast':

@@ -118,2 +128,11 @@ {

function primitiveHelper(value, schemaItem, options, key, schema) {
if (value == null || value == undefined) {
if (options.required) {
if (options.required.find(requiredKey => requiredKey == key)) {
throw new _errors.TypeError(`If you set ${key}, it cannot be null or undefined. value = ${value}`);
}
}
return value;
}
const primitives = [Boolean, String, Date, Number, Symbol];

@@ -120,0 +139,0 @@ const Primitive = primitives.find(primitive => schemaItem === primitive);

2

package.json
{
"name": "schema-llama",
"version": "0.0.5",
"version": "0.0.6",
"description": "A more purely javascript es6 class generator. Takes the work out of validation, type checking, and more.",

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

@@ -27,2 +27,5 @@ import { TypeError, ValidationError, Error } from './errors';

}
//TODO: implement check for required fields.
const toJSON = (function () {

@@ -70,2 +73,8 @@ const object = {};

switch(key) {
case 'required': {
if(options[key].constructor !== Array) {
throw new TypeError(`Required field list must be an array of strings or numbers.`);
}
break;
}
case 'attemptCast': {

@@ -106,2 +115,11 @@ if(options[key].constructor !== Boolean) {

function primitiveHelper(value, schemaItem, options, key, schema) {
if(value == null || value == undefined) {
if(options.required) {
if(options.required.find(requiredKey => requiredKey == key)) {
throw new TypeError(`If you set ${key}, it cannot be null or undefined. value = ${value}`);
}
}
return value;
}
const primitives = [ Boolean, String, Date, Number, Symbol ];

@@ -108,0 +126,0 @@ const Primitive = primitives.find(primitive => schemaItem === primitive);

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