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.2.9 to 1.2.10

172

demonstrament/documents/index.js

@@ -1,169 +0,8 @@

import { Content } from '/dependencies/mvc-framework.js'
const eventLog = ($event) => { console.log(
"\n", "$event.type", $event.type,
"\n", "$event.basename", $event.basename,
"\n", "$event.path", $event.path,
"\n", "$event.detail", $event.detail,
) }
// const object = new Content({ propertyA: { propertyB: "BBB" }}, null, {
// subpathError: true,
// recursive: true,
// })
const object = new Content({}, null, {
pathkey: true,
subpathError: false,
traps: { accessor: { set: { recursive: false } } },
import { Model } from '/dependencies/mvc-framework.js'
const model = new Model({
schema: { aaa: { type: String }},
content: { aaa: "aaa" },
})
object.set("propertyZ.propertyY", "YYY")
console.log(object.string)
// const array = new Content([
// []
// ])
// console.log(array.string)
// array.get('0').push(object)
// array.get("0").set("0", { propertyA: { propertyB: "BBB" } } )
// array.get("0.0").assign({ propertyA: { propertyB: "BBBBBB" } } )
// array.get("0").assign({
// "1": { propertyA: { propertyB: "BBB" } }
// })
// console.log(array.string)
// array.get("0.1.propertyA")
// .set("propertyB", "BBBBBB")
// console.log(array.string)
// array.get("0")
// .assign([
// { propertyA: { propertyB: "BBB" } },
// { propertyA: { propertyB: "BBBBBB" } }
// ])
// console.log(array.string)
// console.log(array.get("1"))
console.log(model.content)
/*
const object = new Content()
object.addEventListener('setProperty', eventLog)
object.addEventListener('set', eventLog)
object.set({
propertyA: {
propertyB: {
propertyC: 333,
propertyD: "DDD",
propertyE: false
} },
propertyF: {
propertyG: {
propertyH: 888,
propertyI: "III",
propertyJ: true
}
}
})
*/
/*
const object = new Content({
propertyA: {
propertyB: {
propertyC: 333,
propertyD: "DDD",
propertyE: false
}
},
propertyF: {
propertyG: {
propertyH: 888,
propertyI: "III",
propertyJ: true
}
}
})
object.addEventListener("assign", eventLog)
object.addEventListener("assignSource", eventLog)
object.addEventListener("assignSourceProperty", eventLog)
object.assign({
propertyA: {
propertyB: {
propertyC: 333333
}
}
})
*/
// , {
// propertyF: {
// propertyG: {
// propertyI: "IIIIII"
// }
// }
// })
/*
const array = new Content([{
id: 0, propertyA: true, propertyB: true
}, {
id: 1, propertyA: true, propertyB: false
}, {
id: 2, propertyA: false, propertyB: false
}, {
id: 3, propertyA: false, propertyB: true
}])
array.addEventListener("copyWithinIndex", eventLog)
array.addEventListener("copyWithin", eventLog)
array.length = 8
array.copyWithin(4, 0, 4)
*/
/*
const array = new Content([], new Schema([{ type: Number }]), {})
array.addEventListener('setProperty', eventLog)
array.addEventListener('set', eventLog)
array.addEventListener('validateProperty', eventLog)
array.set("0", 0)
array.set("0", "0")
*/
/*
const array = new Content([])
array.addEventListener("concatValue", eventLog)
array.addEventListener("concat", eventLog)
let concatArray = array.concat({
id: 0, propertyA: true, propertyB: true
}, {
id: 1, propertyA: true, propertyB: false
}, {
id: 2, propertyA: false, propertyB: false
}, {
id: 3, propertyA: false, propertyB: true
})
console.log("concatArray.string", concatArray.string)
concatArray.addEventListener("concatValue", eventLog)
concatArray.addEventListener("concat", eventLog)
concatArray = concatArray.concat([{
id: 4, propertyA: true, propertyB: true
}, {
id: 5, propertyA: true, propertyB: false
}, {
id: 6, propertyA: false, propertyB: false
}, {
id: 7, propertyA: false, propertyB: true
}])
console.log("concatArray.string", concatArray.string)
*/
/*
import { Core } from '/dependencies/mvc-framework.js'
const $eventTargetProperty = document.querySelector('body')
const $eventType = "click"
const $eventTargetPath = "eventTargetProperty"
const $eventListener = ($event) => {
console.log($event.type, $event.currentTarget)
}
const $events = {
[`${$eventTargetPath} ${$eventType}`]: $eventListener
}
const core = new Core({
eventTargetProperty: $eventTargetProperty,
events: $events,
}, { defineProperties: {
"eventTargetProperty": { enumerable: true, writable: true, configurable: true }
} })
core.enableEvents()
*/
// import './examples/color-control-view.js'
/*
import { Control, Model, Schema } from '/dependencies/mvc-framework.js'

@@ -203,2 +42,3 @@ import DefaultTemplate from './template.js'

start() {
console.log(this.models.default)
this.views.default.render(

@@ -205,0 +45,0 @@ this.models.default.parse()

5

development/Model/Content/Handler/Traps/Accessor/setProperty/setContentProperty/index.js

@@ -60,6 +60,7 @@ import { regularExpressions, recursiveAssign } from '../../../../../../../Coutil/index.js'

propertyValue.set(subpaths.join('.'), $value, ulteroptions)
console.log(ulteroptions)
console.log('propertyValue', propertyValue)
return propertyValue
}
else {
propertyValue = $value
}
// Validation

@@ -66,0 +67,0 @@ if(schema && enableValidation) {

@@ -46,3 +46,4 @@ import { recursiveAssign } from '../Coutil/index.js'

this.#_content = new Content(
recursiveAssign({}, content, localStorageContent),
// recursiveAssign({}, content, localStorageContent),
content,
this.schema,

@@ -49,0 +50,0 @@ this.options.content

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

import Options from './Options/index.js'
const Validators = [new TypeValidator()]
// const Validators = []
const ValidatorKeys = {

@@ -15,4 +15,4 @@ type: ['type'], range: ['min', 'max'], length: ['minLength', 'maxLength']

export default class Schema extends EventTarget{
properties
options
#properties
#_contextType

@@ -22,3 +22,3 @@ #_context

super()
this.properties = $properties
this.#properties = $properties
this.options = Object.assign({}, Options, $options)

@@ -30,4 +30,4 @@ this.context

if(this.#_contextType !== undefined) return this.#_contextType
if(Array.isArray(this.properties)) { this.#_contextType = 'array' }
else if(typeOf(this.properties) === 'object') { this.#_contextType = 'object' }
if(Array.isArray(this.#properties)) { this.#_contextType = 'array' }
else if(typeOf(this.#properties) === 'object') { this.#_contextType = 'object' }
return this.#_contextType

@@ -39,57 +39,47 @@ }

if(this.contextType === 'array') {
properties = this.properties.slice(0, 1)
properties = this.#properties.slice(0, 1)
this.#_context = []
}
else if(this.contextType === 'object') {
properties = this.properties
properties = this.#properties
this.#_context = {}
}
iterateProperties:
for(const [
$contextKey, $contextVal
] of Object.entries(properties)) {
// Context Validators: Transform
let contextVal
// Context Val: Schema
if($contextVal instanceof Schema) {
this.#_context[$contextKey] = $contextVal
continue iterateProperties
}
// Context Val: Object
else if(typeof $contextVal.type === 'object') {
this.#_context[$contextKey] = new Schema($contextVal.type, this.options)
continue iterateProperties
}
// Context Val: Primitive
else {
this.#_context[$contextKey] = $contextVal
}
// Context Validators
this.#_context[$contextKey].validators = [new TypeValidator()]
const addValidators = []
// Context Validator: Add Range
if(
typeof properties[$contextKey].min === 'number' ||
typeof properties[$contextKey].max === 'number'
) addValidators.push(new RangeValidator())
typeof this.#_context[$contextKey].min === 'number' ||
typeof this.#_context[$contextKey].max === 'number'
) { addValidators.push(new RangeValidator()) }
// Context Validator: Add Length
if(
typeof properties[$contextKey].minLength === 'number' ||
typeof properties[$contextKey].maxLength === 'number'
) addValidators.push(new LengthValidator())
typeof this.#_context[$contextKey].minLength === 'number' ||
typeof this.#_context[$contextKey].maxLength === 'number'
) { addValidators.push(new LengthValidator()) }
// Context Validator: Add Enum
if(
Array.isArray(properties[$contextKey].enum) &&
properties[$contextKey].enum.length > 0
) addValidators.push(new EnumValidator())
// Context Validators: Concat
properties[$contextKey].validators = Validators.concat(
addValidators, properties[$contextKey].validators || []
)
// Context Val Type: Schema Instance
if(properties[$contextKey].type instanceof Schema) {
this.#_context[$contextKey] = properties[$contextKey]
}
// Context Val Type: Primitive Prototype
else if(Object.values(Primitives).includes(properties[$contextKey].type)) {
this.#_context[$contextKey] = properties[$contextKey]
}
// Context Val Type: Object Prototype
else if(Object.values(Objects).includes(properties[$contextKey].type)) {
this.#_context[$contentKey] = new Schema(
new properties[$contentKey].type(), this.options
)
}
// Context Val Type: Object Literal
else if(Object.keys(Objects).includes(typeOf(properties[$contextKey].type))) {
this.#_context[$contextKey] = new Schema(
properties[$contextKey].type, this.options
)
}
// Context Val Type: Primitive Literal
else {
this.#_context[$contextKey] = properties[$contextKey]
}
Array.isArray(this.#_context[$contextKey].enum) &&
this.#_context[$contextKey].enum.length > 0
) { addValidators.push(new EnumValidator()) }
this.#_context[$contextKey].validators = addValidators.concat(this.#_context[$contextKey].validators)
}

@@ -99,2 +89,3 @@ return this.#_context

validate($content) {
if($content.classToString === Content.toString()) { $content = $content.object }
let validateProperties

@@ -101,0 +92,0 @@ if(this.contextType === 'array') { validateProperties = [] }

{
"name": "js-mvc-framework",
"author": "Thomas Patrick Welborn",
"version": "1.2.9",
"version": "1.2.10",
"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