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

nemo-observable-util

Package Overview
Dependencies
Maintainers
3
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nemo-observable-util - npm Package Compare versions

Comparing version 5.1.1 to 5.1.2

40

dist/cjs.es5.js

@@ -109,2 +109,7 @@ 'use strict';

var _extends = Object.assign || function (target) {
var arguments$1 = arguments;
for (var i = 1; i < arguments.length; i++) { var source = arguments$1[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var NemoObservableInfo = Symbol('nemo-observable-info');
function decoratorFactory(wrapperFn) {

@@ -126,7 +131,12 @@ return function (target, propertyKey, descriptor) {

if ('get' in v) {
target[NemoObservableInfo] = _extends({}, target[NemoObservableInfo], ( obj = {}, obj[propertyKey] = true, obj ));
var obj;
v.get = wrapperFn(v.get);
}
if ('set' in v) {
target[NemoObservableInfo] = _extends({}, target[NemoObservableInfo], ( obj$1 = {}, obj$1[propertyKey] = true, obj$1 ));
var obj$1;
v.set = wrapperFn(v.set);
}
return v;
} else {

@@ -359,9 +369,19 @@ // 2.3 use as class normal attribute decorator

function canWrite() {
return !InternalConfig.onlyAllowChangeInAction || actionManager.duringStack;
function canWrite(target, key) {
if (!InternalConfig.onlyAllowChangeInAction) {
return true;
}
if (actionManager.duringStack) {
return true;
}
var proto = Object.getPrototypeOf(target);
if (proto && proto[NemoObservableInfo] && proto[NemoObservableInfo][key]) {
return true;
}
return false;
}
var DISABLE_WRITE_ERR = '[nemo-observable-util] can not modify data outside @action';
function writeAbleCheck() {
if (!canWrite()) {
function writeAbleCheck(target, key) {
if (!canWrite(target, key)) {
throw new Error(DISABLE_WRITE_ERR);

@@ -475,4 +495,4 @@ }

add: function add(key) {
writeAbleCheck();
var target = proxyToRaw.get(this);
writeAbleCheck(target, key);
var proto = Reflect.getPrototypeOf(this);

@@ -488,4 +508,4 @@ var hadKey = proto.has.call(target, key);

set: function set(key, value) {
writeAbleCheck();
var target = proxyToRaw.get(this);
writeAbleCheck(target, key);
var proto = Reflect.getPrototypeOf(this);

@@ -504,4 +524,4 @@ var hadKey = proto.has.call(target, key);

delete: function delete$1(key) {
writeAbleCheck();
var target = proxyToRaw.get(this);
writeAbleCheck(target, key);
var proto = Reflect.getPrototypeOf(this);

@@ -518,4 +538,4 @@ var hadKey = proto.has.call(target, key);

clear: function clear() {
writeAbleCheck();
var target = proxyToRaw.get(this);
writeAbleCheck(target);
var proto = Reflect.getPrototypeOf(this);

@@ -658,3 +678,3 @@ var hadItems = target.size !== 0;

function set(target, key, value, receiver) {
writeAbleCheck();
writeAbleCheck(target, key);
// make sure to do not pollute the raw object with observables

@@ -692,3 +712,3 @@ if (typeof value === 'object' && value !== null) {

function deleteProperty(target, key) {
writeAbleCheck();
writeAbleCheck(target, key);
// save if the object had the key

@@ -695,0 +715,0 @@ var hadKey = hasOwnProperty$1.call(target, key);

@@ -99,2 +99,5 @@ 'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
const NemoObservableInfo = Symbol('nemo-observable-info');
function decoratorFactory(wrapperFn) {

@@ -116,7 +119,14 @@ return function (target, propertyKey, descriptor) {

if ('get' in v) {
target[NemoObservableInfo] = _extends({}, target[NemoObservableInfo], {
[propertyKey]: true
});
v.get = wrapperFn(v.get);
}
if ('set' in v) {
target[NemoObservableInfo] = _extends({}, target[NemoObservableInfo], {
[propertyKey]: true
});
v.set = wrapperFn(v.set);
}
return v;
} else {

@@ -338,9 +348,19 @@ // 2.3 use as class normal attribute decorator

function canWrite() {
return !InternalConfig.onlyAllowChangeInAction || actionManager.duringStack;
function canWrite(target, key) {
if (!InternalConfig.onlyAllowChangeInAction) {
return true;
}
if (actionManager.duringStack) {
return true;
}
const proto = Object.getPrototypeOf(target);
if (proto && proto[NemoObservableInfo] && proto[NemoObservableInfo][key]) {
return true;
}
return false;
}
const DISABLE_WRITE_ERR = '[nemo-observable-util] can not modify data outside @action';
function writeAbleCheck() {
if (!canWrite()) {
function writeAbleCheck(target, key) {
if (!canWrite(target, key)) {
throw new Error(DISABLE_WRITE_ERR);

@@ -446,4 +466,4 @@ }

add(key) {
writeAbleCheck();
const target = proxyToRaw.get(this);
writeAbleCheck(target, key);
const proto = Reflect.getPrototypeOf(this);

@@ -459,4 +479,4 @@ const hadKey = proto.has.call(target, key);

set(key, value) {
writeAbleCheck();
const target = proxyToRaw.get(this);
writeAbleCheck(target, key);
const proto = Reflect.getPrototypeOf(this);

@@ -475,4 +495,4 @@ const hadKey = proto.has.call(target, key);

delete(key) {
writeAbleCheck();
const target = proxyToRaw.get(this);
writeAbleCheck(target, key);
const proto = Reflect.getPrototypeOf(this);

@@ -489,4 +509,4 @@ const hadKey = proto.has.call(target, key);

clear() {
writeAbleCheck();
const target = proxyToRaw.get(this);
writeAbleCheck(target);
const proto = Reflect.getPrototypeOf(this);

@@ -618,3 +638,3 @@ const hadItems = target.size !== 0;

function set(target, key, value, receiver) {
writeAbleCheck();
writeAbleCheck(target, key);
// make sure to do not pollute the raw object with observables

@@ -652,3 +672,3 @@ if (typeof value === 'object' && value !== null) {

function deleteProperty(target, key) {
writeAbleCheck();
writeAbleCheck(target, key);
// save if the object had the key

@@ -655,0 +675,0 @@ const hadKey = hasOwnProperty$1.call(target, key);

@@ -105,2 +105,7 @@ var connectionStore = new WeakMap();

var _extends = Object.assign || function (target) {
var arguments$1 = arguments;
for (var i = 1; i < arguments.length; i++) { var source = arguments$1[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var NemoObservableInfo = Symbol('nemo-observable-info');
function decoratorFactory(wrapperFn) {

@@ -122,7 +127,12 @@ return function (target, propertyKey, descriptor) {

if ('get' in v) {
target[NemoObservableInfo] = _extends({}, target[NemoObservableInfo], ( obj = {}, obj[propertyKey] = true, obj ));
var obj;
v.get = wrapperFn(v.get);
}
if ('set' in v) {
target[NemoObservableInfo] = _extends({}, target[NemoObservableInfo], ( obj$1 = {}, obj$1[propertyKey] = true, obj$1 ));
var obj$1;
v.set = wrapperFn(v.set);
}
return v;
} else {

@@ -355,9 +365,19 @@ // 2.3 use as class normal attribute decorator

function canWrite() {
return !InternalConfig.onlyAllowChangeInAction || actionManager.duringStack;
function canWrite(target, key) {
if (!InternalConfig.onlyAllowChangeInAction) {
return true;
}
if (actionManager.duringStack) {
return true;
}
var proto = Object.getPrototypeOf(target);
if (proto && proto[NemoObservableInfo] && proto[NemoObservableInfo][key]) {
return true;
}
return false;
}
var DISABLE_WRITE_ERR = '[nemo-observable-util] can not modify data outside @action';
function writeAbleCheck() {
if (!canWrite()) {
function writeAbleCheck(target, key) {
if (!canWrite(target, key)) {
throw new Error(DISABLE_WRITE_ERR);

@@ -471,4 +491,4 @@ }

add: function add(key) {
writeAbleCheck();
var target = proxyToRaw.get(this);
writeAbleCheck(target, key);
var proto = Reflect.getPrototypeOf(this);

@@ -484,4 +504,4 @@ var hadKey = proto.has.call(target, key);

set: function set(key, value) {
writeAbleCheck();
var target = proxyToRaw.get(this);
writeAbleCheck(target, key);
var proto = Reflect.getPrototypeOf(this);

@@ -500,4 +520,4 @@ var hadKey = proto.has.call(target, key);

delete: function delete$1(key) {
writeAbleCheck();
var target = proxyToRaw.get(this);
writeAbleCheck(target, key);
var proto = Reflect.getPrototypeOf(this);

@@ -514,4 +534,4 @@ var hadKey = proto.has.call(target, key);

clear: function clear() {
writeAbleCheck();
var target = proxyToRaw.get(this);
writeAbleCheck(target);
var proto = Reflect.getPrototypeOf(this);

@@ -654,3 +674,3 @@ var hadItems = target.size !== 0;

function set(target, key, value, receiver) {
writeAbleCheck();
writeAbleCheck(target, key);
// make sure to do not pollute the raw object with observables

@@ -688,3 +708,3 @@ if (typeof value === 'object' && value !== null) {

function deleteProperty(target, key) {
writeAbleCheck();
writeAbleCheck(target, key);
// save if the object had the key

@@ -691,0 +711,0 @@ var hadKey = hasOwnProperty$1.call(target, key);

@@ -95,2 +95,5 @@ const connectionStore = new WeakMap();

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
const NemoObservableInfo = Symbol('nemo-observable-info');
function decoratorFactory(wrapperFn) {

@@ -112,7 +115,14 @@ return function (target, propertyKey, descriptor) {

if ('get' in v) {
target[NemoObservableInfo] = _extends({}, target[NemoObservableInfo], {
[propertyKey]: true
});
v.get = wrapperFn(v.get);
}
if ('set' in v) {
target[NemoObservableInfo] = _extends({}, target[NemoObservableInfo], {
[propertyKey]: true
});
v.set = wrapperFn(v.set);
}
return v;
} else {

@@ -334,9 +344,19 @@ // 2.3 use as class normal attribute decorator

function canWrite() {
return !InternalConfig.onlyAllowChangeInAction || actionManager.duringStack;
function canWrite(target, key) {
if (!InternalConfig.onlyAllowChangeInAction) {
return true;
}
if (actionManager.duringStack) {
return true;
}
const proto = Object.getPrototypeOf(target);
if (proto && proto[NemoObservableInfo] && proto[NemoObservableInfo][key]) {
return true;
}
return false;
}
const DISABLE_WRITE_ERR = '[nemo-observable-util] can not modify data outside @action';
function writeAbleCheck() {
if (!canWrite()) {
function writeAbleCheck(target, key) {
if (!canWrite(target, key)) {
throw new Error(DISABLE_WRITE_ERR);

@@ -442,4 +462,4 @@ }

add(key) {
writeAbleCheck();
const target = proxyToRaw.get(this);
writeAbleCheck(target, key);
const proto = Reflect.getPrototypeOf(this);

@@ -455,4 +475,4 @@ const hadKey = proto.has.call(target, key);

set(key, value) {
writeAbleCheck();
const target = proxyToRaw.get(this);
writeAbleCheck(target, key);
const proto = Reflect.getPrototypeOf(this);

@@ -471,4 +491,4 @@ const hadKey = proto.has.call(target, key);

delete(key) {
writeAbleCheck();
const target = proxyToRaw.get(this);
writeAbleCheck(target, key);
const proto = Reflect.getPrototypeOf(this);

@@ -485,4 +505,4 @@ const hadKey = proto.has.call(target, key);

clear() {
writeAbleCheck();
const target = proxyToRaw.get(this);
writeAbleCheck(target);
const proto = Reflect.getPrototypeOf(this);

@@ -614,3 +634,3 @@ const hadItems = target.size !== 0;

function set(target, key, value, receiver) {
writeAbleCheck();
writeAbleCheck(target, key);
// make sure to do not pollute the raw object with observables

@@ -648,3 +668,3 @@ if (typeof value === 'object' && value !== null) {

function deleteProperty(target, key) {
writeAbleCheck();
writeAbleCheck(target, key);
// save if the object had the key

@@ -651,0 +671,0 @@ const hadKey = hasOwnProperty$1.call(target, key);

{
"name": "nemo-observable-util",
"version": "5.1.1",
"version": "5.1.2",
"description": "Simple transparent reactivity with 100% language coverage. Made with ES6 Proxies.",

@@ -5,0 +5,0 @@ "main": "dist/cjs.es5.js",

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