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

ampersand-state

Package Overview
Dependencies
Maintainers
4
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 4.4.1 to 4.4.2

4

ampersand-state.js

@@ -548,3 +548,5 @@ /*$AMPERSAND_VERSION*/

}
return _.result(def, 'default');
result = _.result(def, 'default');
this._values[name] = result;
return result;
}

@@ -551,0 +553,0 @@ });

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

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

@@ -188,3 +188,3 @@ # ampersand-state

A special property of states, the **cid**, or a client id, is a unique identifier automatically assigned to all states when they are first created. Client ids are handy when the state has not been saved to the server, and so does not yet have it's true **id** but needs a unique id so it can be rendered in the UI etc.
A special property of states, the **cid**, or a client id, is a unique identifier automatically assigned to all states when they are first created. Client ids are handy when the state has not been saved to the server, and so does not yet have its true **id** but needs a unique id so it can be rendered in the UI etc.

@@ -260,3 +260,3 @@ ```javascript

}catch(parseError){
// return the value with what we think it's type is
// return the value with what we think its type is
return {

@@ -553,3 +553,3 @@ val : newVal,

Shortcut to toggle boolean properties, or cycle through "ENUM" type properties that have a `values` array in it's definition. Fires change events as you would expect from set.
Shortcut to toggle boolean properties, or cycle through "ENUM" type properties that have a `values` array in its definition. Fires change events as you would expect from set.

@@ -556,0 +556,0 @@ ```javascript

@@ -688,8 +688,21 @@ var tape = require('tape');

test('Values attribute default works', function (t) {
test('Values attribute default works and is called only once', function (t) {
var ran = 0;
var Model = State.extend({
dataTypes: {
countryType: {
default: 'Atlantis'
}
},
props: {
country: {
type: 'countryType',
required: true
},
state: {
values: ['CA', 'WA', 'NV'],
default: 'CA'
default: function(){
ran++;
return 'CA';
}
}

@@ -700,5 +713,7 @@ }

var m = new Model();
t.equal(m.state, 'CA', 'Should have applied the default');
t.equal(ran, 1, 'Should have been invoked only once');
t.equal(m.state, 'CA', 'Should have returned the same object');
t.equal(ran, 1, 'Should have been invoked only once');
t.equal(m.country, 'Atlantis');
t.throws(function () {

@@ -710,2 +725,3 @@ m.state = 'PR';

test('toggle() works on boolean and values properties.', function (t) {

@@ -712,0 +728,0 @@ var Model = State.extend({

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