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

reactive-cell

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reactive-cell - npm Package Compare versions

Comparing version 0.0.9 to 0.1.0

93

lib/cell.js
// Generated by CoffeeScript 1.6.3
(function() {
var ReadOnlyError, TooManyArgumentsError, cell, reactivity, _ref, _ref1,
var Box, ReadOnlyError, cell, reactivity, _ref,
__hasProp = {}.hasOwnProperty,

@@ -21,19 +21,45 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

TooManyArgumentsError = (function(_super) {
__extends(TooManyArgumentsError, _super);
Box = (function() {
function Box() {}
function TooManyArgumentsError() {
_ref1 = TooManyArgumentsError.__super__.constructor.apply(this, arguments);
return _ref1;
}
Box.prototype.do_get = function() {
if (this.is_error) {
throw this.v;
} else {
return this.v;
}
};
return TooManyArgumentsError;
Box.prototype.do_set = function(e, r) {
var is_error, new_v;
new_v = (is_error = e != null) ? e : r;
if (new_v === this.v) {
return false;
}
this.is_error = is_error;
return this.v = new_v;
};
})(Error);
Box.prototype.do_set_auto = function() {
var a;
a = arguments;
if (a.length === 2) {
return this.do_set.apply(this, a);
}
if (a[0] instanceof Error) {
return this.do_set(a[0], null);
} else {
return this.do_set(null, a[0]);
}
};
return Box;
})();
module.exports = cell = function() {
var f, notifiers, value;
value = void 0;
var box, f, notifiers;
box = new Box;
notifiers = void 0;
f = function(new_value) {
f = function(x) {
var a, cb, notifiers_, _i, _len;

@@ -45,35 +71,22 @@ a = arguments;

}
if (value instanceof Error) {
throw value;
} else {
return value;
}
} else if (a.length === 1) {
new_value = a[0];
if (value !== new_value) {
value = new_value;
if ((notifiers_ = notifiers) != null) {
notifiers = void 0;
for (_i = 0, _len = notifiers_.length; _i < _len; _i++) {
cb = notifiers_[_i];
cb();
}
return box.do_get();
}
if (box.do_set_auto.apply(box, a)) {
if ((notifiers_ = notifiers) != null) {
notifiers = void 0;
for (_i = 0, _len = notifiers_.length; _i < _len; _i++) {
cb = notifiers_[_i];
cb();
}
}
return void 0;
} else {
throw new TooManyArgumentsError;
}
return void 0;
};
f.view = function() {
return function() {
if (arguments.length > 0) {
throw new ReadOnlyError;
}
f.immutable = function() {
if (arguments.length > 0) {
throw new ReadOnlyError;
} else {
return f();
};
}
};
f.value = function() {
return value;
};
return f;

@@ -84,4 +97,2 @@ };

cell.TooManyArgumentsError = TooManyArgumentsError;
}).call(this);
{
"name": "reactive-cell",
"version": "0.0.9",
"version": "0.1.0",
"description": "A Variable/Slot/Box that holds one value. reactivity.io compatible",

@@ -5,0 +5,0 @@ "author": "Aldo Bucchi <aldo.bucchi@gmail.com>",

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