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

@domql/state

Package Overview
Dependencies
Maintainers
3
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@domql/state - npm Package Compare versions

Comparing version 2.3.123 to 2.3.125

3

createState.js

@@ -6,3 +6,3 @@ 'use strict'

import { IGNORE_STATE_PARAMS } from './ignore'
import { add, apply, clean, destroy, parse, remove, rootUpdate, toggle } from './methods'
import { add, apply, clean, destroy, parse, remove, rootUpdate, set, toggle } from './methods'
import { updateState } from './updateState'

@@ -88,2 +88,3 @@ import { checkIfInherits, createInheritedState } from './inherit'

state.parent = element.parent.state
state.set = set
state.__element = element

@@ -90,0 +91,0 @@ state.__children = {}

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

state.parent = element.parent.state;
state.set = import_methods.set;
state.__element = element;

@@ -98,0 +99,0 @@ state.__children = {};

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

"apply",
"set",
"rootUpdate",

@@ -36,0 +37,0 @@ "parent",

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

rootUpdate: () => rootUpdate,
set: () => set,
toggle: () => toggle

@@ -55,3 +56,5 @@ });

}
state.update(state, { skipOverwrite: true, options });
if (!options.preventStateUpdate) {
state.update(state, { replace: true, skipOverwrite: true, options });
}
return state;

@@ -82,2 +85,3 @@ };

return;
console.log(options);
const rootState = state.__element.__ref.__root.state;

@@ -102,2 +106,3 @@ return rootState.update(obj, options);

const state = this;
console.log(state);
if ((0, import_utils.isArray)(state))

@@ -109,2 +114,7 @@ (0, import_utils.removeFromArray)(state, key);

};
const set = function(value, options = {}) {
const state = this;
state.clean({ preventStateUpdate: true });
return state.update(value, { replace: true, ...options });
};
const apply = function(func, options = {}) {

@@ -111,0 +121,0 @@ const state = this;

@@ -30,3 +30,4 @@ "use strict";

const STATE_UPDATE_OPTIONS = {
preventHoistElementUpdate: true
preventHoistElementUpdate: false,
updateByState: true
};

@@ -38,2 +39,6 @@ const updateState = function(obj, options = STATE_UPDATE_OPTIONS) {

(0, import_report.report)("ElementOnStateIsNotDefined");
if (options.preventInheritAtCurrentState === true) {
options.preventInheritAtCurrentState = state;
} else if (options.preventInheritAtCurrentState)
return;
if (!options.preventInitStateUpdateListener) {

@@ -45,3 +50,5 @@ const initStateUpdateReturns = (0, import_event.triggerEventOn)("initStateUpdated", element, obj);

applyOverwrite(state, obj, options);
hoistStateUpdate(state, obj, options);
const updateIsHousted = hoistStateUpdate(state, obj, options);
if (updateIsHousted)
return state;
updateDependentState(state, obj, options);

@@ -89,2 +96,3 @@ applyElementUpdate(state, obj, options);

});
return true;
};

@@ -104,4 +112,3 @@ const updateDependentState = (state, obj, options) => {

...options,
updateByState: true,
preventUpdateTriggerStateUpdate: true
updateByState: true
});

@@ -111,3 +118,2 @@ } else if (options.preventUpdate === "recursive") {

...options,
preventUpdateTriggerStateUpdate: true,
updateByState: true,

@@ -114,0 +120,0 @@ preventUpdate: true

'use strict'
export const IGNORE_STATE_PARAMS = [
'update', 'parse', 'clean', 'create', 'destroy', 'add', 'toggle', 'remove', 'apply',
'update', 'parse', 'clean', 'create', 'destroy', 'add', 'toggle', 'remove', 'apply', 'set',
'rootUpdate', 'parent', '__element', '__depends', '__ref', '__children', '__root'
]

@@ -29,3 +29,5 @@ 'use strict'

}
state.update(state, { skipOverwrite: true, options })
if (!options.preventStateUpdate) {
state.update(state, { replace: true, skipOverwrite: true, options })
}
return state

@@ -60,2 +62,3 @@ }

if (!state) return
console.log(options)
const rootState = (state.__element.__ref.__root).state

@@ -70,4 +73,3 @@ return rootState.update(obj, options)

state.update(state.parse(), { replace: true, ...options })
}
else if (isObject(state)) {
} else if (isObject(state)) {
const key = Object.keys(state).length

@@ -85,2 +87,3 @@ state.update({ [key]: value }, options)

const state = this
console.log(state)
if (isArray(state)) removeFromArray(state, key)

@@ -91,2 +94,8 @@ if (isObject(state)) removeFromObject(state, key)

export const set = function (value, options = {}) {
const state = this
state.clean({ preventStateUpdate: true })
return state.update(value, { replace: true, ...options })
}
export const apply = function (func, options = {}) {

@@ -93,0 +102,0 @@ const state = this

{
"name": "@domql/state",
"version": "2.3.123",
"version": "2.3.125",
"license": "MIT",

@@ -29,3 +29,3 @@ "type": "module",

},
"gitHead": "feb0d24eb5924f0f9ebea660a93afffc7d6a2059"
"gitHead": "c62e01157f488334d07a8bbd67f892d617d48f06"
}

@@ -10,3 +10,4 @@ 'use strict'

const STATE_UPDATE_OPTIONS = {
preventHoistElementUpdate: true
preventHoistElementUpdate: false,
updateByState: true
}

@@ -19,2 +20,5 @@

if (!state.__element) report('ElementOnStateIsNotDefined')
if (options.preventInheritAtCurrentState === true) {
options.preventInheritAtCurrentState = state
} else if (options.preventInheritAtCurrentState) return

@@ -28,3 +32,4 @@ if (!options.preventInitStateUpdateListener) {

hoistStateUpdate(state, obj, options)
const updateIsHousted = hoistStateUpdate(state, obj, options)
if (updateIsHousted) return state

@@ -50,2 +55,7 @@ updateDependentState(state, obj, options)

// if (skipOverwrite === 'skipOverwrite') {
// deepMerge(state, obj, IGNORE_STATE_PARAMS)
// return
// }
if (!skipOverwrite) {

@@ -81,2 +91,3 @@ const overwriteFunc = shallow ? overwriteShallow : overwriteDeep

})
return true
}

@@ -97,4 +108,3 @@

...options,
updateByState: true,
preventUpdateTriggerStateUpdate: true
updateByState: true
})

@@ -104,3 +114,2 @@ } else if (options.preventUpdate === 'recursive') {

...options,
preventUpdateTriggerStateUpdate: true,
updateByState: true,

@@ -107,0 +116,0 @@ preventUpdate: true

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