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

reactive-function

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reactive-function - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

7

index.js

@@ -36,5 +36,8 @@ var ReactiveProperty = require("reactive-property");

// TODO check for wrong number of args
// Parse arguments.
var dependencies = Array.apply(null, arguments);
var callback = dependencies.pop();
var args = Array.apply(null, arguments);
var dependencies = args.splice(1);
var callback = args[0];

@@ -41,0 +44,0 @@ // This stores the output value.

{
"name": "reactive-function",
"version": "0.1.0",
"version": "0.2.0",
"description": "A library for managing data flows and changing state.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -15,5 +15,7 @@ // Unit tests for reactive-function.

var b = ReactiveProperty(10);
var c = ReactiveFunction(a, b, function (a, b){
var c = ReactiveFunction(function (a, b){
return a + b;
});
}, a, b);
ReactiveFunction.digest();

@@ -28,5 +30,10 @@ assert.equal(c(), 15);

var d = ReactiveFunction(a, function (a){ return a * 2; });
var e = ReactiveFunction(a, b, c, function (a, b, c){ return a + b + c; });
var d = ReactiveFunction(function (a){
return a * 2;
}, a);
var e = ReactiveFunction(function (a, b, c){
return a + b + c;
}, a, b, c);
ReactiveFunction.digest();

@@ -40,4 +47,11 @@

var a = ReactiveProperty(5);
var b = ReactiveFunction(a, function (a){ return a * 2; });
var c = ReactiveFunction(b, function (b){ return b / 2; });
var b = ReactiveFunction(function (a){
return a * 2;
}, a);
var c = ReactiveFunction(function (b){
return b / 2;
}, b);
ReactiveFunction.digest();

@@ -50,4 +64,11 @@ assert.equal(c(), 5);

var b = ReactiveProperty(10);
var c = ReactiveFunction(a, function (a){ return a * 2; });
var d = ReactiveFunction(b, c, function (b, c){ return b + c; });
var c = ReactiveFunction(function (a){
return a * 2;
}, a);
var d = ReactiveFunction(function (b, c){
return b + c;
}, b, c);
ReactiveFunction.digest();

@@ -66,7 +87,10 @@ assert.equal(d(), 20);

var a = ReactiveProperty(5);
var b = ReactiveFunction(a, function (a){ return a * 2; });
var c = ReactiveFunction(b, function (b){ return b + 5; });
var d = ReactiveFunction(a, function (a){ return a * 3; });
var e = ReactiveFunction(c, d, function (c, d){ return c + d; });
var b = ReactiveFunction(function (a){ return a * 2; }, a);
var c = ReactiveFunction(function (b){ return b + 5; }, b);
var d = ReactiveFunction(function (a){ return a * 3; }, a);
var e = ReactiveFunction(function (c, d){ return c + d; }, c, d);
ReactiveFunction.digest();
assert.equal(e(), ((a() * 2) + 5) + (a() * 3));

@@ -77,3 +101,7 @@ });

var a = ReactiveProperty(5);
var b = ReactiveFunction(a, function (a){ return a * 2; });
var b = ReactiveFunction(function (a){
return a * 2;
}, a);
assert.throws(function (){

@@ -87,6 +115,6 @@ b(5);

var a = ReactiveProperty(5);
var b = ReactiveFunction(a, function (a){
var b = ReactiveFunction(function (a){
numInvocations++;
return a * 2;
});
}, a);
ReactiveFunction.digest();

@@ -101,5 +129,5 @@ ReactiveFunction.digest();

var c = ReactiveFunction(a, b, function (a, b){
var c = ReactiveFunction(function (a, b){
return a + b;
});
}, a, b);

@@ -106,0 +134,0 @@ setTimeout(function (){

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