Socket
Socket
Sign inDemoInstall

valtio

Package Overview
Dependencies
Maintainers
0
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

valtio - npm Package Compare versions

Comparing version 2.0.0-rc.1 to 2.0.0-rc.2

4

package.json
{
"name": "valtio",
"description": "💊 Valtio makes proxy-state simple for React and Vanilla",
"description": "🧙 Valtio makes proxy-state simple for React and Vanilla",
"private": false,
"type": "commonjs",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"publishConfig": {

@@ -8,0 +8,0 @@ "tag": "next"

type AnyFunction = (...args: any[]) => any;
type Path = (string | symbol)[];
type Op = [op: 'set', path: Path, value: unknown, prevValue: unknown] | [op: 'delete', path: Path, prevValue: unknown] | [op: 'resolve', path: Path, value: unknown] | [op: 'reject', path: Path, error: unknown];
type Op = [op: 'set', path: Path, value: unknown, prevValue: unknown] | [op: 'delete', path: Path, prevValue: unknown];
type Listener = (op: Op, nextVersion: number) => void;

@@ -5,0 +5,0 @@ type Primitive = string | number | boolean | null | undefined | symbol | bigint;

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

const isObject = (x) => typeof x === "object" && x !== null;
const canProxyDefault = (x) => isObject(x) && !refSet.has(x) && (Array.isArray(x) || !(Symbol.iterator in x)) && !(x instanceof WeakMap) && !(x instanceof WeakSet) && !(x instanceof Error) && !(x instanceof Number) && !(x instanceof Date) && !(x instanceof String) && !(x instanceof RegExp) && !(x instanceof ArrayBuffer);
const canProxyDefault = (x) => isObject(x) && !refSet.has(x) && (Array.isArray(x) || !(Symbol.iterator in x)) && !(x instanceof WeakMap) && !(x instanceof WeakSet) && !(x instanceof Error) && !(x instanceof Number) && !(x instanceof Date) && !(x instanceof String) && !(x instanceof RegExp) && !(x instanceof ArrayBuffer) && !(x instanceof Promise);
const createSnapshotDefault = (target, version) => {

@@ -64,19 +64,4 @@ const cache = snapCache.get(target);

}
let nextValue = value;
if (value instanceof Promise) {
value.then((v) => {
value.status = "fulfilled";
value.value = v;
notifyUpdate(["resolve", [prop], v]);
}).catch((e) => {
value.status = "rejected";
value.reason = e;
notifyUpdate(["reject", [prop], e]);
});
} else {
if (!proxyStateMap.has(value) && canProxy(value)) {
nextValue = proxy(value);
}
addPropListener(prop, nextValue);
}
const nextValue = !proxyStateMap.has(value) && canProxy(value) ? proxy(value) : value;
addPropListener(prop, nextValue);
Reflect.set(target, prop, nextValue, receiver);

@@ -83,0 +68,0 @@ notifyUpdate(["set", [prop], value, prevValue]);

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