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

on-change

Package Overview
Dependencies
Maintainers
2
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 2.2.2 to 2.2.3

lib/is-iterator.js

41

index.js

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

const isSymbol = require('./lib/is-symbol');
const isIterator = require('./lib/is-iterator');
const wrapIterator = require('./lib/wrap-iterator');
const ignoreProperty = require('./lib/ignore-property');

@@ -57,2 +59,21 @@ const Cache = require('./lib/cache');

const prepareValue = (value, target, property, basePath) => {
if (
isBuiltin.withoutMutableMethods(value) ||
property === 'constructor' ||
(isShallow && !SmartClone.isHandledMethod(target, property)) ||
ignoreProperty(cache, options, property) ||
cache.isGetInvariant(target, property) ||
(ignoreDetached && cache.isDetached(target, object))
) {
return value;
}
if (basePath === undefined) {
basePath = cache.getPath(target);
}
return cache.getProxy(value, path.concat(basePath, property), handler, proxyTarget);
};
const handler = {

@@ -79,14 +100,3 @@ get(target, property, receiver) {

if (
isBuiltin.withoutMutableMethods(value) ||
property === 'constructor' ||
(isShallow && !SmartClone.isHandledMethod(target, property)) ||
ignoreProperty(cache, options, property) ||
cache.isGetInvariant(target, property) ||
(ignoreDetached && cache.isDetached(target, object))
) {
return value;
}
return cache.getProxy(value, path.concat(cache.getPath(target), property), handler, proxyTarget);
return prepareValue(value, target, property);
},

@@ -172,2 +182,9 @@

if (
(thisArg instanceof Map || thisArg instanceof Set) &&
isIterator(result)
) {
return wrapIterator(result, target, thisArg, applyPath, prepareValue);
}
return (SmartClone.isHandledType(result) && isHandledMethod) ?

@@ -174,0 +191,0 @@ cache.getProxy(result, applyPath, handler, proxyTarget) :

@@ -65,4 +65,3 @@ 'use strict';

'has',
'toString',
'keys'
'toString'
]);

@@ -91,2 +90,8 @@

const COLLECTION_ITERATOR_METHODS = [
'keys',
'values',
'entries'
];
const SHALLOW_MUTABLE_MAP_METHODS = {

@@ -103,6 +108,8 @@ set: shallowEqualMaps,

const HANDLED_SET_METHODS = new Set([...IMMUTABLE_SET_METHODS]
.concat(Object.keys(SHALLOW_MUTABLE_SET_METHODS)));
.concat(Object.keys(SHALLOW_MUTABLE_SET_METHODS))
.concat(COLLECTION_ITERATOR_METHODS));
const HANDLED_MAP_METHODS = new Set([...IMMUTABLE_MAP_METHODS]
.concat(Object.keys(SHALLOW_MUTABLE_MAP_METHODS)));
.concat(Object.keys(SHALLOW_MUTABLE_MAP_METHODS))
.concat(COLLECTION_ITERATOR_METHODS));

@@ -109,0 +116,0 @@ class Clone {

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

@@ -5,0 +5,0 @@ "license": "MIT",

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