New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

on-change

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

on-change - npm Package Compare versions

Comparing version 1.6.2 to 1.6.3

44

index.js

@@ -13,2 +13,10 @@ 'use strict';

const isSameDescriptor = (a, b) => {
return a !== undefined && b !== undefined &&
Object.is(a.value, b.value) &&
(a.writable || false) === (b.writable || false) &&
(a.enumerable || false) === (b.enumerable || false) &&
(a.configurable || false) === (b.configurable || false);
};
const concatPath = (path, property) => {

@@ -91,5 +99,9 @@ if (property && property.toString) {

const getOwnPropertyDescriptor = (target, property) => {
let props = propCache ? propCache.get(target) : undefined;
let props = propCache !== null && propCache.get(target);
if (props) {
props = props.get(property);
}
if (props) {
return props;

@@ -102,2 +114,3 @@ }

let prop = props.get(property);
if (!prop) {

@@ -155,3 +168,5 @@ prop = Reflect.getOwnPropertyDescriptor(target, property);

if (property === UNSUBSCRIBE && pathCache.get(target) === '') {
if (property === UNSUBSCRIBE &&
pathCache !== null &&
pathCache.get(target) === '') {
return unsubscribe(target);

@@ -192,6 +207,11 @@ }

const previous = ignore ? null : Reflect.get(target, property, receiver);
const result = Reflect.set(target[proxyTarget] || target, property, value);
const isChanged = !(property in target) || !equals(previous, value);
let result = true;
if (!ignore && !equals(previous, value)) {
handleChange(pathCache.get(target), property, previous, value);
if (isChanged) {
result = Reflect.set(target[proxyTarget] || target, property, value);
if (!ignore && result) {
handleChange(pathCache.get(target), property, previous, value);
}
}

@@ -203,8 +223,12 @@

defineProperty(target, property, descriptor) {
const result = Reflect.defineProperty(target, property, descriptor);
let result = true;
if (!ignoreChange(property)) {
invalidateCachedDescriptor(target, property);
if (!isSameDescriptor(descriptor, getOwnPropertyDescriptor(target, property))) {
result = Reflect.defineProperty(target, property, descriptor);
handleChange(pathCache.get(target), property, undefined, descriptor.value);
if (result && !ignoreChange(property) && !isSameDescriptor()) {
invalidateCachedDescriptor(target, property);
handleChange(pathCache.get(target), property, undefined, descriptor.value);
}
}

@@ -224,3 +248,3 @@

if (!ignore) {
if (!ignore && result) {
invalidateCachedDescriptor(target, property);

@@ -227,0 +251,0 @@

{
"name": "on-change",
"version": "1.6.2",
"version": "1.6.3",
"description": "Watch an object or array for changes",

@@ -41,3 +41,3 @@ "license": "MIT",

"ava": "^1.4.1",
"display-value": "^1.0.1",
"display-value": "^1.3.2",
"matcha": "^0.7.0",

@@ -44,0 +44,0 @@ "tsd": "^0.7.1",

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