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

reactive-box

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reactive-box - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

4

package.json
{
"name": "reactive-box",
"version": "0.2.0",
"version": "0.2.1",
"description": "Minimalistic, fast, and highly efficient reactivity",

@@ -47,3 +47,3 @@ "scripts": {

"homepage": "https://github.com/betula/reactive-box#readme",
"gitHead": "fb575f497551405fc044780b73f21c787656f8ed"
"gitHead": "c97d386107cd302a18b96a965b53a52fc9acd4b0"
}
declare function box<T>(
initialValue?: T,
onChange?: (currentValue?: T, previousValue?: T) => void
onChange?: (currentValue?: T, previousValue?: T) => void,
comparer?: (value?: T, nextValue?: T) => boolean
): [() => T, (nextValue?: T) => void];
declare function sel<T extends () => any>(body: T): [T, () => void];
declare function sel<T extends () => any>(
body: T,
comparer?: (value?: T, prevValue?: T) => boolean
): [T, () => void];

@@ -8,0 +12,0 @@ declare function expr<T extends () => void>(body: T): [T, () => void];

@@ -71,3 +71,3 @@ /**

const box = (value, change_listener) => {
const box = (value, change_listener, comparer = Object.is) => {
const box_node = [new Set()];

@@ -78,3 +78,3 @@ return [

? (next_value) => {
if (!Object.is(value, next_value)) {
if (!comparer(value, next_value)) {
const prev_value = value;

@@ -87,3 +87,3 @@ value = next_value;

: (next_value) => {
if (!Object.is(value, next_value)) {
if (!comparer(value, next_value)) {
value = next_value;

@@ -96,3 +96,3 @@ write(box_node);

const sel = (body) => {
const sel = (body, comparer = Object.is) => {
let cache;

@@ -109,3 +109,3 @@ let last_context;

}
return !Object.is(prev, cache);
return !comparer(cache, prev);
};

@@ -112,0 +112,0 @@ const sel_node = [new Set(), new Set(), 0, recalc];

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