Socket
Socket
Sign inDemoInstall

ampersand-state

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ampersand-state - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

17

ampersand-state.js

@@ -0,1 +1,2 @@

/* jshint expr: true, eqnull: true */
// (c) 2013 Henrik Joreteg

@@ -30,3 +31,3 @@ // MIT Licensed

if (this.seal) Object.seal(this);
};
}

@@ -160,3 +161,3 @@ var accessors = {

if (def.values && !_.contains(def.values, newVal)) {
throw new TypeError('Property \'' + attr + '\' must be one of values: ' + def.values.map(function (item) { return item.toString(); }).join(', '));
throw new TypeError('Property \'' + attr + '\' must be one of values: ' + def.values.join(', '));
}

@@ -417,8 +418,7 @@

if (this._derived[name].cache) {
// read through cache
if (!flushCache && this._cache.hasOwnProperty(name)) {
return this._cache[name];
} else {
return this._cache[name] = this._derived[name].fn.apply(this);
//set if this is the first time, or flushCache is set
if (flushCache || !this._cache.hasOwnProperty(name)) {
this._cache[name] = this._derived[name].fn.apply(this);
}
return this._cache[name];
} else {

@@ -460,3 +460,3 @@ return this._derived[name].fn.apply(this);

// add event methods
BBEvents.mixin(prototypeMixins)
BBEvents.mixin(prototypeMixins);

@@ -545,2 +545,3 @@ // our dataTypes

var extend = function (spec) {
spec = spec || {};
var parent = this;

@@ -547,0 +548,0 @@ var BaseClass = this._super || Base;

{
"name": "ampersand-state",
"description": "An observable, extensible state object with derived watchable properties.",
"version": "0.3.0",
"version": "0.3.1",
"author": "Henrik Joreteg <henrik@andyet.net>",

@@ -6,0 +6,0 @@ "bugs": {

@@ -0,1 +1,3 @@

/*jshint expr: true*/
var test = require('tape');

@@ -10,2 +12,11 @@ var State = require('../ampersand-state');

test('init with nothing should be okay', function (t) {
var EmptyModel = State.extend();
var something = new EmptyModel();
something.foo = 'bar';
t.ok(something);
t.equal(something.foo, 'bar');
t.end();
});
test('init with values', function (t) {

@@ -12,0 +23,0 @@ var person = new Person({name: 'henrik'});

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