Socket
Socket
Sign inDemoInstall

ampersand-state

Package Overview
Dependencies
Maintainers
5
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.6 to 4.5.0

23

ampersand-state.js

@@ -321,12 +321,15 @@ /*$AMPERSAND_VERSION*/

unset: function (attr, options) {
var def = this._definition[attr];
var type = def.type;
var val;
if (def.required) {
val = result(def, 'default');
return this.set(attr, val, options);
} else {
return this.set(attr, val, assign({}, options, {unset: true}));
}
unset: function (attrs, options) {
attrs = Array.isArray(attrs) ? attrs : [attrs];
forEach(attrs, function (key) {
var def = this._definition[key];
var type = def.type;
var val;
if (def.required) {
val = result(def, 'default');
return this.set(key, val, options);
} else {
return this.set(key, val, assign({}, options, {unset: true}));
}
}, this);
},

@@ -333,0 +336,0 @@

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

@@ -6,0 +6,0 @@ "files": [

@@ -541,5 +541,5 @@ # ampersand-state

### unset `state.unset(attribute, [options])`
### unset `state.unset(attribute|attributes[], [options])`
Clear the named attribute from the state object. Fires a `"change"` event and a `"change:attributeName"` event unless `silent` is passed as an option.
Clear the named attribute or an array of named attributes from the state object. Fires a `"change"` event and a `"change:attributeName"` event unless `silent` is passed as an option.

@@ -549,5 +549,11 @@ If the attribute being unset is `required` and has a `default` value as defined in either `props` or `session`, it will be set to that value, otherwise it will be `undefined`.

```javascript
// unset a single attribute
person.unset('firstName')
```
```javascript
// unset multiple attributes
person.unset(['firstName', 'lastName'])
```
### clear `state.clear([options])`

@@ -554,0 +560,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc