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

@frui.ts/dirtycheck

Package Overview
Dependencies
Maintainers
5
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frui.ts/dirtycheck - npm Package Compare versions

Comparing version 1.0.0-beta.6 to 1.0.0-rc.1

11

dist/fruits-dirtycheck.es.js

@@ -45,3 +45,3 @@ var W = Object.defineProperty;

function f(s) {
if (!!s)
if (s)
return s[_.dirtyWatcherAttachedProperty];

@@ -69,3 +69,3 @@ }

*getDirtyProperties() {
if (!!this.isEnabled)
if (this.isEnabled)
for (const e of this._watchedProperties)

@@ -79,3 +79,4 @@ this._results[e] && (yield e);

const t = i;
if ((!this._includedProperties || this._includedProperties.includes(t)) && (!this._excludedProperties || !this._excludedProperties.includes(t))) {
if ((!this._includedProperties || this._includedProperties.includes(t)) && // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
(!this._excludedProperties || !this._excludedProperties.includes(t))) {
this._watchedProperties.push(t);

@@ -122,3 +123,3 @@ const c = this.target, n = h(c, t);

for (const o of t.values())
if (!c.has(o) || ((n = f(o)) == null ? void 0 : n.isDirty))
if (!c.has(o) || (n = f(o)) != null && n.isDirty)
return !0;

@@ -139,3 +140,3 @@ return !1;

const a = c.get(o);
if (l !== a || ((n = f(l)) == null ? void 0 : n.isDirty))
if (l !== a || (n = f(l)) != null && n.isDirty)
return !0;

@@ -142,0 +143,0 @@ }

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

(function(u,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("@frui.ts/helpers"),require("mobx")):typeof define=="function"&&define.amd?define(["exports","@frui.ts/helpers","mobx"],h):(u=typeof globalThis<"u"?globalThis:u||self,h(u["fruits-dirtycheck"]={},u.helpers,u.mobx))})(this,function(u,h,o){"use strict";var C=Object.defineProperty;var k=(u,h,o)=>h in u?C(u,h,{enumerable:!0,configurable:!0,writable:!0,value:o}):u[h]=o;var l=(u,h,o)=>(k(u,typeof h!="symbol"?h+"":h,o),o);var O=Object.defineProperty,j=Object.getOwnPropertyDescriptor,P=(c,s,e,r)=>{for(var t=r>1?void 0:r?j(s,e):s,n=c.length-1,i;n>=0;n--)(i=c[n])&&(t=(r?i(s,e,t):i(t))||t);return r&&t&&O(s,e,t),t};const D=[];Object.freeze(D);class y{constructor(s=!0){l(this,"isEnabled",!0);l(this,"isVisible",!1);o.makeObservable(this),this.isVisible=s}get isDirty(){return this.checkDirty()}checkDirtyVisible(s){return!this.isEnabled||!this.isVisible?!1:this.checkDirty(s)}getDirtyVisibleProperties(){return this.isEnabled&&this.isVisible?this.getDirtyProperties():D}}P([o.observable],y.prototype,"isEnabled",2),P([o.observable],y.prototype,"isVisible",2),P([o.computed],y.prototype,"isDirty",1);const _={dirtyWatcherAttachedProperty:Symbol("DirtyWatch")};function g(c,s){c[_.dirtyWatcherAttachedProperty]=s}function a(c){if(!!c)return c[_.dirtyWatcherAttachedProperty]}class v extends y{constructor(e,r){super(r==null?void 0:r.isVisible);l(this,"_includedProperties");l(this,"_excludedProperties");l(this,"_results");l(this,"_watchedProperties",[]);this.target=e,typeof r=="object"&&(this._includedProperties=r.includedProperties,this._excludedProperties=r.excludedProperties),this.reset()}checkDirty(e){if(!this.isEnabled)return!1;if(e)return!!this._results[e];for(const r of this._watchedProperties)if(this._results[r])return!0;return!1}*getDirtyProperties(){if(!!this.isEnabled)for(const e of this._watchedProperties)this._results[e]&&(yield e)}reset(){const e={};this._watchedProperties.length=0;for(const r of Object.keys(this.target)){const t=r;if((!this._includedProperties||this._includedProperties.includes(t))&&(!this._excludedProperties||!this._excludedProperties.includes(t))){this._watchedProperties.push(t);const n=this.target,i=o.get(n,t);h.isArrayLike(i)?V(e,i,t,n):h.isSet(i)?w(e,i,t,n):h.isMap(i)?A(e,i,t,n):typeof i=="object"?S(e,i,t,n):Object.defineProperty(e,t,{get:()=>{const f=o.get(n,t);return i!==f}})}}this._results=o.observable(e)}}function V(c,s,e,r){const t=s.slice();!!a(t[0])?Object.defineProperty(c,e,{get:()=>{const i=o.get(r,e);return!i||i.length!==t.length||t.some((f,d)=>{var p;return f!==i[d]||((p=a(f))==null?void 0:p.isDirty)===!0})}}):Object.defineProperty(c,e,{get:()=>{const i=o.get(r,e);return!i||i.length!==t.length||t.some((f,d)=>f!==i[d])}})}function w(c,s,e,r){const t=new Set(s);Object.defineProperty(c,e,{get:()=>{var i;const n=o.get(r,e);if(!n||n.size!==t.size)return!0;for(const f of t.values())if(!n.has(f)||((i=a(f))==null?void 0:i.isDirty))return!0;return!1}})}function A(c,s,e,r){const t=new Map(s);Object.defineProperty(c,e,{get:()=>{var i;const n=o.get(r,e);if(!n||n.size!==t.size)return!0;for(const[f,d]of t.entries()){const p=n.get(f);if(d!==p||((i=a(d))==null?void 0:i.isDirty))return!0}return!1}})}function S(c,s,e,r){a(s)?Object.defineProperty(c,e,{get:()=>{var n;return((n=a(o.get(r,e)))==null?void 0:n.isDirty)===!0}}):Object.defineProperty(c,e,{get:()=>{const n=o.get(r,e);return s!==n}})}function E(c,s){const e=typeof s=="boolean"?{isVisible:s}:s,r=new v(c,e);return g(c,r),r}var M=Object.defineProperty,z=Object.getOwnPropertyDescriptor,W=(c,s,e,r)=>{for(var t=r>1?void 0:r?z(s,e):s,n=c.length-1,i;n>=0;n--)(i=c[n])&&(t=(r?i(s,e,t):i(t))||t);return r&&t&&M(s,e,t),t};class b extends y{constructor(e=!0){super(e);l(this,"_dirtyProperties",o.observable.set());o.makeObservable(this)}checkDirty(e){return this.isEnabled?e?this._dirtyProperties.has(e):this._dirtyProperties.size>0:!1}getDirtyProperties(){return this.isEnabled?this._dirtyProperties:D}setDirty(e,r=!0){r?this._dirtyProperties.add(e):this._dirtyProperties.delete(e)}reset(){this._dirtyProperties.clear()}}W([o.action],b.prototype,"setDirty",1),W([o.action],b.prototype,"reset",1),u.AutomaticDirtyWatcher=v,u.Configuration=_,u.ManualDirtyWatcher=b,u.attachAutomaticDirtyWatcher=E,u.attachDirtyWatcher=g,u.getDirtyWatcher=a,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
(function(u,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("@frui.ts/helpers"),require("mobx")):typeof define=="function"&&define.amd?define(["exports","@frui.ts/helpers","mobx"],h):(u=typeof globalThis<"u"?globalThis:u||self,h(u["fruits-dirtycheck"]={},u.helpers,u.mobx))})(this,function(u,h,o){"use strict";var C=Object.defineProperty;var k=(u,h,o)=>h in u?C(u,h,{enumerable:!0,configurable:!0,writable:!0,value:o}):u[h]=o;var l=(u,h,o)=>(k(u,typeof h!="symbol"?h+"":h,o),o);var O=Object.defineProperty,j=Object.getOwnPropertyDescriptor,P=(c,s,e,r)=>{for(var t=r>1?void 0:r?j(s,e):s,n=c.length-1,i;n>=0;n--)(i=c[n])&&(t=(r?i(s,e,t):i(t))||t);return r&&t&&O(s,e,t),t};const D=[];Object.freeze(D);class y{constructor(s=!0){l(this,"isEnabled",!0);l(this,"isVisible",!1);o.makeObservable(this),this.isVisible=s}get isDirty(){return this.checkDirty()}checkDirtyVisible(s){return!this.isEnabled||!this.isVisible?!1:this.checkDirty(s)}getDirtyVisibleProperties(){return this.isEnabled&&this.isVisible?this.getDirtyProperties():D}}P([o.observable],y.prototype,"isEnabled",2),P([o.observable],y.prototype,"isVisible",2),P([o.computed],y.prototype,"isDirty",1);const _={dirtyWatcherAttachedProperty:Symbol("DirtyWatch")};function g(c,s){c[_.dirtyWatcherAttachedProperty]=s}function a(c){if(c)return c[_.dirtyWatcherAttachedProperty]}class W extends y{constructor(e,r){super(r==null?void 0:r.isVisible);l(this,"_includedProperties");l(this,"_excludedProperties");l(this,"_results");l(this,"_watchedProperties",[]);this.target=e,typeof r=="object"&&(this._includedProperties=r.includedProperties,this._excludedProperties=r.excludedProperties),this.reset()}checkDirty(e){if(!this.isEnabled)return!1;if(e)return!!this._results[e];for(const r of this._watchedProperties)if(this._results[r])return!0;return!1}*getDirtyProperties(){if(this.isEnabled)for(const e of this._watchedProperties)this._results[e]&&(yield e)}reset(){const e={};this._watchedProperties.length=0;for(const r of Object.keys(this.target)){const t=r;if((!this._includedProperties||this._includedProperties.includes(t))&&(!this._excludedProperties||!this._excludedProperties.includes(t))){this._watchedProperties.push(t);const n=this.target,i=o.get(n,t);h.isArrayLike(i)?V(e,i,t,n):h.isSet(i)?w(e,i,t,n):h.isMap(i)?A(e,i,t,n):typeof i=="object"?S(e,i,t,n):Object.defineProperty(e,t,{get:()=>{const f=o.get(n,t);return i!==f}})}}this._results=o.observable(e)}}function V(c,s,e,r){const t=s.slice();!!a(t[0])?Object.defineProperty(c,e,{get:()=>{const i=o.get(r,e);return!i||i.length!==t.length||t.some((f,d)=>{var p;return f!==i[d]||((p=a(f))==null?void 0:p.isDirty)===!0})}}):Object.defineProperty(c,e,{get:()=>{const i=o.get(r,e);return!i||i.length!==t.length||t.some((f,d)=>f!==i[d])}})}function w(c,s,e,r){const t=new Set(s);Object.defineProperty(c,e,{get:()=>{var i;const n=o.get(r,e);if(!n||n.size!==t.size)return!0;for(const f of t.values())if(!n.has(f)||(i=a(f))!=null&&i.isDirty)return!0;return!1}})}function A(c,s,e,r){const t=new Map(s);Object.defineProperty(c,e,{get:()=>{var i;const n=o.get(r,e);if(!n||n.size!==t.size)return!0;for(const[f,d]of t.entries()){const p=n.get(f);if(d!==p||(i=a(d))!=null&&i.isDirty)return!0}return!1}})}function S(c,s,e,r){a(s)?Object.defineProperty(c,e,{get:()=>{var n;return((n=a(o.get(r,e)))==null?void 0:n.isDirty)===!0}}):Object.defineProperty(c,e,{get:()=>{const n=o.get(r,e);return s!==n}})}function E(c,s){const e=typeof s=="boolean"?{isVisible:s}:s,r=new W(c,e);return g(c,r),r}var z=Object.defineProperty,M=Object.getOwnPropertyDescriptor,v=(c,s,e,r)=>{for(var t=r>1?void 0:r?M(s,e):s,n=c.length-1,i;n>=0;n--)(i=c[n])&&(t=(r?i(s,e,t):i(t))||t);return r&&t&&z(s,e,t),t};class b extends y{constructor(e=!0){super(e);l(this,"_dirtyProperties",o.observable.set());o.makeObservable(this)}checkDirty(e){return this.isEnabled?e?this._dirtyProperties.has(e):this._dirtyProperties.size>0:!1}getDirtyProperties(){return this.isEnabled?this._dirtyProperties:D}setDirty(e,r=!0){r?this._dirtyProperties.add(e):this._dirtyProperties.delete(e)}reset(){this._dirtyProperties.clear()}}v([o.action],b.prototype,"setDirty",1),v([o.action],b.prototype,"reset",1),u.AutomaticDirtyWatcher=W,u.Configuration=_,u.ManualDirtyWatcher=b,u.attachAutomaticDirtyWatcher=E,u.attachDirtyWatcher=g,u.getDirtyWatcher=a,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
//# sourceMappingURL=fruits-dirtycheck.umd.js.map
import type { PropertyName } from "@frui.ts/helpers";
import DirtyWatcherBase from "./dirtyWatcherBase";
export default class ManualDirtyWatcher<TEntity = any> extends DirtyWatcherBase<TEntity> {
protected _dirtyProperties: import("mobx").ObservableSet<PropertyName<TEntity, any>>;
protected _dirtyProperties: import("mobx").ObservableSet<PropertyName<TEntity>>;
constructor(isVisible?: boolean);

@@ -6,0 +6,0 @@ checkDirty(): boolean;

@@ -6,3 +6,3 @@ {

},
"version": "1.0.0-beta.6",
"version": "1.0.0-rc.1",
"description": "Observable dirty checking",

@@ -47,3 +47,3 @@ "keywords": [

"dependencies": {
"@frui.ts/helpers": "^1.0.0-beta.6"
"@frui.ts/helpers": "^1.0.0-rc.1"
},

@@ -53,3 +53,3 @@ "peerDependencies": {

},
"gitHead": "adf52b1d60660fc686182547cca34af079bdecf4"
"gitHead": "c17e77c7246207827d09d34cadbb54b07ebbd82e"
}

Sorry, the diff of this file is not supported yet

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