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.6 to 1.2.7

22

demonstrament/documents/index.js

@@ -12,11 +12,17 @@ import { Content } from '/dependencies/mvc-framework.js'

[]
]
], null, {
subpathError: false,
traps: { accessor: { get: { events: ['getProperty'] } } }
}
)
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.addEventListener('get', eventLog)
array.addEventListener('getProperty', eventLog)
console.log(array.get('1.1'))
// 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")

@@ -23,0 +29,0 @@ // .set("propertyB", "BBBBBB")

@@ -7,3 +7,6 @@ function recursiveAssign() {

for(const $source of $sources) {
if($source === null) { continue iterateSources }
if(
$source === null ||
$source === undefined
) { continue iterateSources }
iterateSourceEntries:

@@ -10,0 +13,0 @@ for(let [

@@ -17,3 +17,3 @@ import Content from '../../../../../index.js'

// Delete Property Event
if(contentEvents && events?.includes('delete')) {
if(contentEvents && events['delete']) {
$content.dispatchEvent(

@@ -20,0 +20,0 @@ new ContentEvent('delete', {

@@ -1,2 +0,2 @@

import { regularExpressions } from '../../../../../../../Coutil/index.js'
import { regularExpressions, recursiveAssign } from '../../../../../../../Coutil/index.js'
import Content from '../../../../../index.js'

@@ -12,4 +12,7 @@ import { ContentEvent } from '../../../../../Events/index.js'

const $path = arguments[0]
const ulteroptions = Object.assign({}, $options, arguments[1])
const { events, pathkey, keychaining } = ulteroptions
const ulteroptions = recursiveAssign({
pathkey: $content.options.pathkey,
subpathError: $content.options.subpathError,
}, $options, arguments[1])
const { events, pathkey, subpathError } = ulteroptions
// Path Key: true

@@ -21,2 +24,5 @@ if(pathkey === true) {

// Keychaining
if(subpathError === false && propertyValue === undefined) { return undefined }
// Return: Subproperty
if(subpaths.length) {

@@ -30,3 +36,3 @@ return propertyValue.delete(subpaths.join('.'), ulteroptions)

// Delete Property Event
if(contentEvents && events.includes('deleteProperty')) {
if(contentEvents && events['deleteProperty']) {
$content.dispatchEvent(

@@ -53,3 +59,3 @@ new ContentEvent('deleteProperty', {

// Delete Property Event
if(contentEvents && events.includes('deleteProperty')) {
if(contentEvents && events['deleteProperty']) {
$content.dispatchEvent(

@@ -56,0 +62,0 @@ new ContentEvent('deleteProperty', {

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

// Get Property Event
if(contentEvents && events.includes('get')) {
if(contentEvents && events['get']) {
$content.dispatchEvent(

@@ -14,0 +14,0 @@ new ContentEvent('get', {

@@ -1,2 +0,2 @@

import { regularExpressions } from '../../../../../../../Coutil/index.js'
import { regularExpressions, recursiveAssign } from '../../../../../../../Coutil/index.js'
import Content from '../../../../../index.js'

@@ -12,4 +12,7 @@ import { ContentEvent } from '../../../../../Events/index.js'

const $path = arguments[0]
const ulteroptions = Object.assign({}, $options, arguments[1])
const { events, pathkey, keychaining } = ulteroptions
const ulteroptions = recursiveAssign({
pathkey: $content.options.pathkey,
subpathError: $content.options.subpathError,
}, $options, arguments[1])
const { events, pathkey, subpathError } = ulteroptions
// Path Key: true

@@ -20,7 +23,10 @@ if(pathkey === true) {

let propertyValue = root[propertyKey]
// Keychaining
if(subpathError === false && propertyValue === undefined) { return undefined }
// Return: Subproperty
if(subpaths.length) {
return propertyValue.get(subpaths.join('.'), ulteroptions)
}
// Delete Property Event
if(contentEvents && events.includes('getProperty')) {
// Get Property Event
if(contentEvents && events['getProperty']) {
$content.dispatchEvent(

@@ -27,0 +33,0 @@ new ContentEvent('getProperty', {

@@ -25,3 +25,3 @@ import Content from '../../../../../index.js'

// Set Property Event
if(contentEvents && events.includes('set')) {
if(contentEvents && events['set']) {
$content.dispatchEvent(

@@ -28,0 +28,0 @@ new ContentEvent('set', {

@@ -1,2 +0,2 @@

import { regularExpressions } from '../../../../../../../Coutil/index.js'
import { regularExpressions, recursiveAssign } from '../../../../../../../Coutil/index.js'
import Content from '../../../../../index.js'

@@ -14,8 +14,9 @@ import { ContentEvent, ValidatorEvent } from '../../../../../Events/index.js'

// Options
const ulteroptions = Object.assign(
{}, $options, arguments[2]
)
const ulteroptions = recursiveAssign({
pathkey: $content.options.pathkey,
subpathError: $content.options.subpathError,
}, $options, arguments[2])
const contentOptions = $content.options
contentOptions.traps.accessor.set = ulteroptions
const { events, pathkey, keychaining, recursive } = ulteroptions
const { events, pathkey, subpathError, recursive } = ulteroptions
// Path Key: true

@@ -32,2 +33,4 @@ if(pathkey === true) {

: propertyKey
// Keychaining
if(subpathError === false && propertyValue === undefined) { return undefined }
// Return: Subproperty

@@ -93,3 +96,3 @@ if(subpaths.length) {

// Set Property Event
if(contentEvents && events.includes('setProperty')) {
if(contentEvents && events['setProperty']) {
$content.dispatchEvent(

@@ -138,3 +141,3 @@ new ContentEvent('setProperty', {

// Set Property Event
if(contentEvents && events.includes('setProperty')) {
if(contentEvents && events['setProperty']) {
$content.dispatchEvent(

@@ -141,0 +144,0 @@ new ContentEvent('setProperty', {

@@ -53,3 +53,3 @@ import Content from '../../../../index.js'

rootConcat = Array.prototype.concat.call(rootConcat, values[valueIndex])
if(contentEvents && events.includes('concatValue')) {
if(contentEvents && events['concatValue']) {
$content.dispatchEvent(

@@ -68,3 +68,3 @@ new ContentEvent('concatValue', {

proxyConcat = new Content(rootConcat, schema, $content.options)
if(contentEvents && events.includes('concat')) {
if(contentEvents && events['concat']) {
$content.dispatchEvent(

@@ -71,0 +71,0 @@ new ContentEvent('concat', {

@@ -38,3 +38,3 @@ import { ContentEvent } from '../../../../Events/index.js'

// Array Copy Within Index Event Data
if(contentEvents && events.includes('copyWithinIndex')) {
if(contentEvents && events['copyWithinIndex']) {
$content.dispatchEvent(

@@ -60,3 +60,3 @@ new ContentEvent(

// Array Copy Within Event
if(contentEvents && events.includes('copyWithin')) {
if(contentEvents && events['copyWithin']) {
$content.dispatchEvent(

@@ -63,0 +63,0 @@ new ContentEvent(

@@ -58,3 +58,3 @@ import Content from '../../../../index.js'

// Array Fill Index Event
if(contentEvents && events.includes('fillIndex')) {
if(contentEvents && events['fillIndex']) {
$content.dispatchEvent(

@@ -74,3 +74,3 @@ new ContentEvent('fillIndex', {

// Array Fill Event
if(contentEvents && events.includes('fill')) {
if(contentEvents && events['fill']) {
$content.dispatchEvent(

@@ -77,0 +77,0 @@ new ContentEvent('fill', {

@@ -10,3 +10,3 @@ import { ContentEvent } from '../../../../Events/index.js'

// Array Pop Event
if(contentEvents && events.includes('pop')) {
if(contentEvents && events['pop']) {
$content.dispatchEvent(

@@ -13,0 +13,0 @@ new ContentEvent(

@@ -43,3 +43,3 @@ import Content from '../../../../index.js'

}
if(contentEvents && events.includes('pushProp')) {
if(contentEvents && events['pushProp']) {
$content.dispatchEvent(

@@ -58,3 +58,3 @@ new ContentEvent('pushProp', {

// Push Event
if(contentEvents && events.includes('push')) {
if(contentEvents && events['push']) {
$content.dispatchEvent(

@@ -61,0 +61,0 @@ new ContentEvent('push', {

@@ -9,3 +9,3 @@ import { ContentEvent } from '../../../../Events/index.js'

Array.prototype.reverse.call(root, ...arguments)
if(contentEvents && events.includes('reverse')) {
if(contentEvents && events['reverse']) {
$content.dispatchEvent(

@@ -12,0 +12,0 @@ new ContentEvent(

@@ -10,3 +10,3 @@ import { ContentEvent } from '../../../../Events/index.js'

// Array Shift Event
if(contentEvents && events.includes('shift')) {
if(contentEvents && events['shift']) {
$content.dispatchEvent(

@@ -13,0 +13,0 @@ new ContentEvent(

@@ -29,3 +29,3 @@ import Content from '../../../../index.js'

// Array Splice Delete Event
if(contentEvents && events.includes('spliceDelete')) {
if(contentEvents && events['spliceDelete']) {
$content.dispatchEvent(

@@ -84,3 +84,3 @@ new ContentEvent('spliceDelete', {

// Array Splice Add Event
if(contentEvents && events.includes('spliceAdd')) {
if(contentEvents && events['spliceAdd']) {
$content.dispatchEvent(

@@ -100,3 +100,3 @@ new ContentEvent('spliceAdd', {

// Array Splice Event
if(contentEvents && events.includes('splice')) {
if(contentEvents && events['splice']) {
$content.dispatchEvent(

@@ -103,0 +103,0 @@ new ContentEvent('splice', {

@@ -49,3 +49,3 @@ import Content from '../../../../index.js'

// Array Unshift Prop Event
if(contentEvents && events.includes('unshiftProp')) {
if(contentEvents && events['unshiftProp']) {
$content.dispatchEvent(

@@ -64,3 +64,3 @@ new ContentEvent('unshiftProp', {

// Array Unshift Event
if(contentEvents && events.includes('unshift') && elements.length) {
if(contentEvents && events['unshift'] && elements.length) {
$content.dispatchEvent(

@@ -67,0 +67,0 @@ new ContentEvent('unshift', {

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

// Content Event: Assign Source Property
if(contentEvents && events.includes('assignSourceProperty')) {
if(contentEvents && events['assignSourceProperty']) {
$content.dispatchEvent(

@@ -102,3 +102,3 @@ new ContentEvent('assignSourceProperty', {

// Content Event: Assign Source
if(contentEvents && events.includes('assignSource')) {
if(contentEvents && events['assignSource']) {
$content.dispatchEvent(

@@ -115,3 +115,3 @@ new ContentEvent('assignSource', {

// Content Event: Assign
if(contentEvents && events.includes('assign')) {
if(contentEvents && events['assign']) {
$content.dispatchEvent(

@@ -118,0 +118,0 @@ new ContentEvent('assign', {

@@ -25,3 +25,3 @@ import Content from '../../../../index.js'

// Define Properties Event
if(contentEvents && events.includes('defineProperties')) {
if(contentEvents && events['defineProperties']) {
$content.dispatchEvent(

@@ -28,0 +28,0 @@ new ContentEvent(

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

// Define Property Event
if(contentEvents && events.includes('defineProperty')) {
if(contentEvents && events['defineProperty']) {
$content.dispatchEvent(

@@ -80,0 +80,0 @@ new ContentEvent('defineProperty', {

@@ -18,3 +18,3 @@ import Content from '../../../../index.js'

else { Object.freeze($propertyValue) }
if(contentEvents && events.includes('freeze')) {
if(contentEvents && events['freeze']) {
$content.dispatchEvent(

@@ -21,0 +21,0 @@ new ContentEvent(

@@ -18,3 +18,3 @@ import Content from '../../../../index.js'

else { Object.seal($propertyValue) }
if(contentEvents && events.includes('seal')) {
if(contentEvents && events['seal']) {
$content.dispatchEvent(

@@ -21,0 +21,0 @@ new ContentEvent(

@@ -8,28 +8,24 @@ export default {

enableEvents: true,
pathkey: true,
subpathError: false,
traps: {
accessor: {
get: {
pathkey: true,
keychaining: true,
events: [
'get',
'getProperty'
],
events: {
'get': true,
'getProperty': true,
},
},
set: {
pathkey: true,
keychaining: true,
recursive: true,
events: [
'set',
'setProperty'
],
events: {
'set': true,
'setProperty': true,
},
},
delete: {
pathkey: true,
keychaining: true,
events: [
'delete',
'deleteProperty'
],
events: {
'delete': true,
'deleteProperty': true,
},
},

@@ -40,23 +36,23 @@ },

sourceTree: true,
events: [
'assignSourceProperty',
'assignSource',
'assign'
],
events: {
'assignSourceProperty': true,
'assignSource': true,
'assign': true,
},
},
defineProperties: {
descriptorTree: true,
events: ['defineProperties'],
events: { 'defineProperties': true },
},
defineProperty: {
descriptorTree: true,
events: ['defineProperty'],
events: { 'defineProperty': true },
},
freeze: {
recursive: true,
events: ['freeze']
events: { 'freeze': true },
},
seal: {
recursive: true,
events: ['seal']
events: { 'seal': true },
},

@@ -66,46 +62,46 @@ },

concat: {
events: [
'concatValue',
'concat'
]
events: {
'concatValue': true,
'concat': true,
}
},
copyWithin: {
events: [
'copyWithinIndex',
'copyWithin'
]
events: {
'copyWithinIndex': true,
'copyWithin': true,
}
},
fill: {
events: [
'fillIndex',
'fill'
]
events: {
'fillIndex': true,
'fill': true,
}
},
pop: {
events: ['pop']
events: { 'pop': true },
},
push: {
events: [
'pushProp',
'push'
]
events: {
'pushProp': true,
'push': true,
}
},
reverse: {
events: ['reverse']
events: { 'reverse': true },
},
shift: {
events: ['shift']
events: { 'shift': true },
},
splice: {
events: [
'spliceDelete',
'spliceAdd',
'splice'
]
events: {
'spliceDelete': true,
'spliceAdd': true,
'splice': true,
}
},
unshift: {
events: [
'unshiftProp',
'unshift'
]
events: {
'unshiftProp': true,
'unshift': true,
}
},

@@ -112,0 +108,0 @@ }

@@ -10,3 +10,6 @@ # Content `delete` Method

recursive: true,
events: ['deleteProperty', 'delete'],
events: {
'deleteProperty': true,
'delete': true,
},
}

@@ -13,0 +16,0 @@ }

@@ -9,3 +9,6 @@ # Content `get` Method

get: {
events: ['getProperty', 'get'],
events: {
'getProperty': true,
'get': true
},
}

@@ -12,0 +15,0 @@ }

@@ -19,2 +19,4 @@ # Accessor Traps

const $contentOptions = {
pathkey: true,
subpathError: true,
traps: {

@@ -24,21 +26,24 @@ accessor: {

pathkey: true,
events: [
'get',
'getProperty'
],
subpathError: true,
events: {
'get': true,
'getProperty': true,
},
},
set: {
pathkey: true,
subpathError: true,
recursive: true,
events: [
'set',
'setProperty'
],
events: {
'set': true,
'setProperty': true,
},
},
delete: {
pathkey: true,
events: [
'delete',
'deleteProperty'
],
subpathError: true,
events: {
'delete': true,
'deleteProperty': true,
},
},

@@ -51,2 +56,20 @@ }

### `get`, `set`, `delete` Shared Options
- Shared Accessor Options may be set as `content` options or overriden as `content.traps.accessor.get`, `content.traps.accessor.set`, and `content.traps.accessor.delete`.
**All Accessor Methods**:
```
const content = new Content({}, null, {
pathkey: false,
subpathError: false,
})
```
**Individual Accessor Methods**:
```
const content = new Content({}, null, {
traps: { accessor: {
get: { pathkey: false, subpathError: false },
set: { pathkey: false, subpathError: false },
delete: { pathkey: false, subpathError: false },
} }
})
```
#### `pathkey` Option

@@ -58,3 +81,3 @@ **Type**: `Boolean`

- When `false`, properties accessed through key.
##### `pathKey`: `true`
##### `pathkey`: `true`
```

@@ -73,3 +96,3 @@ const content = new Content({

```
##### `pathKey`: `false`
##### `pathkey`: `false`
Path accessor notation disabled, returns `undefined`.

@@ -89,3 +112,3 @@ ```

```
##### `pathKey` Escape
##### `pathkey` Escape
Quotation enclosures escape path accessor notation.

@@ -110,7 +133,28 @@ ```

```
#### `keychaining` Option
#### `subpathError` Option
**Type**: `Boolean`
**Default**: `true`
**Default**: `false`
**Descript**:
- When `true` and `pathkey` is also `true`,
- When `true` and `pathkey` is `true`, throws error when no subpath exists.
- When `false` and `pathkey` is `true`, returns `undefined` when no subpath exists.
##### `subpathError`: `true`
```
const content = new Content({
propertyA: {}
})
console.log(
content.get("propertyA.propertyB.propertyC")
)
// LOG: Uncaught TypeError: Cannot read properties of undefined
```
##### `subpathError`: `false`
```
const content = new Content({
propertyA: {}
})
console.log(
content.get("propertyA.propertyB.propertyC")
)
// LOG: undefined
```

@@ -142,9 +186,9 @@ ### `get` Options

### `get` Method
Accepts zero or one arguments:
Accepts zero, one, or two arguments:
```
content.get()
content.get($contentOptions)
content.get($propertyPath)
content.get($propertyPath, $contentOptions)
```
- **Zero Arguments**: Gets all properties (gets `content`, or self)
- **One Argument**: Gets property value at `$propertyPath`.
#### `get` Arguments

@@ -158,9 +202,9 @@ ##### `$propertyPath` Argument

### `set` Method
Accepts one or two arguments:
Accepts one, two, or three arguments:
```
content.set($propertyTree)
content.set($propertyTree, $contentOptions)
content.set($propertyPath, $propertyValue)
content.set($propertyPath, $propertyValue, $contentOptions)
```
- **One Argument**: Sets all properties from `$propertyTree` to `content`.
- **Two Arguments**: Sets `$propertyValue` at `$propertyPath`
#### `set` Arguments

@@ -181,6 +225,8 @@ ##### `$propertyTree` Argument

### `delete` Method
Accepts zero or one arguments:
Accepts zero, one, or two arguments:
```
content.delete()
content.delete($contentOptions)
content.delete($propertyPath)
content.delete($propertyPath, $contentOptions)
```

@@ -187,0 +233,0 @@ - **Zero Arguments**: Deletes all properties from `content`.

@@ -14,3 +14,6 @@ # `Content` `set` Method

recursive: true,
events: ['setProperty', 'set'],
events: {
'setProperty': true,
'set': true
},
}

@@ -17,0 +20,0 @@ }

@@ -51,21 +51,23 @@ # Array Traps

concat: {
events: [
'concatValue',
'concat'
events: {
'concatValue': true,
'concat': true
]
},
copyWithin: {
events: [
'copyWithinIndex',
'copyWithin'
events: {
'copyWithinIndex': true,
'copyWithin': true
]
},
fill: {
events: [
'fillIndex',
'fill'
events: {
'fillIndex': true,
'fill': true
]
},
pop: {
events: ['pop']
events: {
'pop': true
}
},

@@ -79,19 +81,23 @@ push: {

reverse: {
events: ['reverse']
events: {
'reverse': true
}
},
shift: {
events: ['shift']
events: {
'shift': true
}
},
splice: {
events: [
'spliceDelete',
'spliceAdd',
'splice'
]
events: {
'spliceDelete': true,
'spliceAdd': true,
'splice': true
}
},
unshift: {
events: [
'unshiftProp',
'unshift'
]
events: {
'unshiftProp': true,
'unshift': true
}
},

@@ -98,0 +104,0 @@ }

@@ -37,23 +37,31 @@ # Object Traps

sourceTree: true,
events: [
'assignSourceProperty',
'assignSource',
'assign'
],
events: {
'assignSourceProperty': true,
'assignSource': true,
'assign': true,
},
},
defineProperties: {
descriptorTree: true,
events: ['defineProperties'],
events: {
'defineProperties': true
},
},
defineProperty: {
descriptorTree: true,
events: ['defineProperty'],
events: {
'defineProperty': true
},
},
freeze: {
recursive: true,
events: ['freeze']
events: {
'freeze': true
}
},
seal: {
recursive: true,
events: ['seal']
events: {
'seal': true
}
},

@@ -60,0 +68,0 @@ }

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