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

js-mvc-framework

Package Overview
Dependencies
Maintainers
0
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-mvc-framework - npm Package Compare versions

Comparing version 1.3.8 to 1.3.9

demonstrament/documents/test/coutil/test/index.js

11

demonstrament/documents/test/coutil/logs/index.js

@@ -0,1 +1,11 @@

const testResultsLog = ($test) => {
console.log(
"\n", "-----",
"\n", `Group: ${$test.group}`,
"\n", `Name: ${$test.name}`,
"\n", `Descript: ${$test.descript}`,
"\n", `PASS: ${$test.results.pass}`,
"\n", 'detail:', $test.results.detail,
)
}
const validatorEventLog = ($event) => {

@@ -33,2 +43,3 @@ console.log(

export {
testResultsLog,
validatorEventLog,

@@ -35,0 +46,0 @@ contentEventLog,

4

demonstrament/documents/test/index.js

@@ -1,3 +0,3 @@

// import "./schema/index.js"
import "./content-handler-trap-methods/defineProperty/index.js"
import "./schema/index.js"
// import "./content-handler-trap-methods/defineProperty/index.js"
// import "./coutil-methods/pandTree/index.js"

@@ -4,0 +4,0 @@ // import { Model } from "/dependencies/mvc-framework.js"

@@ -0,68 +1,45 @@

import * as Logs from "../coutil/logs/index.js"
import * as Tests from "./tests/index.js"
import Test from "../coutil/test/index.js"
import { Schema, Coutil } from '/dependencies/mvc-framework.js'
const { expandTree } = Coutil
const schemaA = new Schema(expandTree([{
propertyA: {
propertyB: String
}
}], 'type'), {
validationType: 'primitive'
})
// const schemaB = new Schema(expandTree({
// propertyA: String
// }, "type", {
// minLength: 0,
// maxLength: 100,
// }))
// console.log("-----")
// const contentA = [{
// propertyA: {
// propertyB: "BBBBBB"
// }
// }]
// const contentAValidation = schemaA.validate(contentA)
// console.log("contentAValidation", contentAValidation)
/*
Validate Property: Literals
Property Value Type: Boolean
Property Value Type: Number
- Range Validator
Property Value Type: String
- Enum Validator
- Length Validator
Property Value Type: undefined
*/
const validation = {}
const tests = {}
for(const [$testName, $testSettings] of Object.entries(Tests)) {
tests[$testName] = new Test($testSettings).execute()
console.log($testName, tests[$testName])
// Logs.testResultsLog($test.execute())
}
// console.log("-----")
// const contentB = [{
// propertyC: {
// propertyD: "DDDDDD"
// }
// }]
// const contentBValidation = schemaA.validate(contentB)
// console.log("contentBValidation", contentBValidation)
/*
Validation: Monodimensional Properties
Validation Type: Object
Validation Type: Primitive
*/
console.log("-----")
const contentC = [{
propertyA: {
propertyB: "BBBBBB"
}
}, {
propertyC: {
propertyD: "DDDDDD"
}
}]
const contentCValidation = schemaA.validate(contentC)
console.log("contentCValidation", contentCValidation)
/*
Validation Multidimensional Properties
Validation Type: Object
Validation Type: Primitive
*/
// console.log("-----")
// const contentC = [{
// propertyC: {
// propertyD: 444444
// }
// }]
// const contentCValidation = schemaA.validate(contentC)
// console.log("contentCValidation", contentCValidation)
// const contentD1 = {
// propertyA: "AAAAAA"
// }
// const contentD2 = {
// propertyA: 111111
// }
// const contentD3 = {
// propertyB: true
// }
// console.log(`schemaB.validateProperty(${"propertyA"}, ${JSON.stringify(contentD1.propertyA)})`)
// console.log("propertyValidation", schemaB.validateProperty("propertyA", contentD1.propertyA))
/*
Validation: Property Validity
Defined Properties: Valid
Defined Properties: Nonvalid
Defined Properties: Unvalid
Defined Properties: Valid/Nonvalid/Unvalid
Defined Properties: Complete Properties
Defined Properties: Incomplete Properties
*/

@@ -15,2 +15,3 @@ import * as Coutil from './Coutil/index.js'

import Validation from './Model/Schema/Validation/index.js'
import Verification from './Model/Schema/Verification/index.js'

@@ -28,3 +29,3 @@ export {

// Tertiary Exports
Validator, Validation,
Validator, Validation, Verification
}

@@ -45,3 +45,3 @@ import { typeOf, typedObjectLiteral } from '../../Coutil/index.js'

let contextValue
// Context Val: Schema
// Context Value: Schema
if($contextValue instanceof Schema) {

@@ -51,3 +51,3 @@ this.#_context[$contextKey] = $contextValue

}
// Context Val: Object
// Context Value: Object
else if(typeof $contextValue.type === 'object') {

@@ -57,3 +57,3 @@ this.#_context[$contextKey] = new Schema($contextValue.type, this.options)

}
// Context Val: Primitive
// Context Value: Primitive
else {

@@ -124,3 +124,3 @@ this.#_context[$contextKey] = $contextValue

if(validation.advance.length) { validation.valid = true }
else if(validation.deadvance.length) { validation.valid = false }
else if(validation.deadvance.length) { validation.valid = true }
else if(validation.unadvance.length) { validation.valid = undefined }

@@ -140,3 +140,3 @@ }

})
// Context Val: Undefined
// Context Value: Undefined
if(contextValue === undefined) {

@@ -151,6 +151,4 @@ const verification = new Verification({

propertyValidation.unadvance.push(verification)
propertyValidation.valid = undefined
}
// Context Val: Object
// Context Value: Object
else if(contextValue instanceof Schema) {

@@ -161,5 +159,4 @@ const validation = contextValue.validate($key, $value)

else if(validation.valid === undefined) { propertyValidation.unadvance.push(validation) }
propertyValidation.valid = validation.valid
}
// Context Val: Primitive
// Context Value: Primitive
else {

@@ -173,3 +170,2 @@ iterateContextValueValidators:

else if(verification.pass === undefined) { $propertyValidation.unadvance.push(verification) }
if($propertyValidation.valid !== false) { $propertyValidation.valid = verification.pass }
return $propertyValidation

@@ -179,4 +175,7 @@ }, propertyValidation

}
if(propertyValidation.deadvance.length) { propertyValidation.valid = false }
else if(propertyValidation.advance.length) { propertyValidation.valid = true }
else if(propertyValidation.unadvance.length) { propertyValidation.valid = false }
return propertyValidation
}
}

@@ -11,3 +11,2 @@ import Validator from '../../Validator/index.js'

validate: ($context, $key, $value) => {
const { min, max } = $context
const verification = new Verification({

@@ -19,18 +18,19 @@ context: $context,

})
let pass = undefined
if(min !== undefined) {
verification.min = min
const validMin = ($value >= min)
if(pass !== false) pass = validMin
let pass
if(typeof $value !== 'number') { pass = false }
else {
const { min, max } = $context
let validMin, validMax
if(min !== undefined) { validMin = ($value >= min) }
else { validMin = true }
if(max !== undefined) { validMax = ($value <= max) }
else { validMax = true }
if(validMin && validMax) { pass = true }
else { pass = false}
}
if(max !== undefined) {
verification.max = max
const validMax = ($value <= max)
if(pass !== false) pass = validMax
}
verification.pass = pass
return verification
},
}
}))
}
}

@@ -13,2 +13,3 @@ export default class Verification extends EventTarget {

get value() { return this.#settings.value }
get messages() { return this.#settings.messages }
get message() {

@@ -20,3 +21,3 @@ if(this.#_message !== undefined) return this.#_message

) {
this.#_message = this.#settings.messages[this.valid](this)
this.#_message = this.messages[this.valid](this)
}

@@ -23,0 +24,0 @@ return this.#_message

{
"name": "js-mvc-framework",
"author": "Thomas Patrick Welborn",
"version": "1.3.8",
"version": "1.3.9",
"type": "module",

@@ -6,0 +6,0 @@ "scripts": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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