Backbone.Mutators
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -1,30 +0,5 @@ | ||
/*! Backbone.Mutators - v0.4.0 | ||
------------------------------ | ||
Build @ 2013-05-01 | ||
Documentation and Full License Available at: | ||
http://asciidisco.github.com/Backbone.Mutators/index.html | ||
git://github.com/asciidisco/Backbone.Mutators.git | ||
Copyright (c) 2013 Sebastian Golasch <public@asciidisco.com> | ||
Permission is hereby granted, free of charge, to any person obtaining a | ||
copy of this software and associated documentation files (the "Software"), | ||
to deal in the Software without restriction, including without limitation | ||
the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
and/or sell copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
IN THE SOFTWARE.*/ | ||
(function (root, factory, undef) { | ||
'use strict'; | ||
if (typeof exports === 'object') { | ||
if (typeof exports === 'object' && typeof require === 'function') { | ||
// Node. Does not work with strict CommonJS, but | ||
@@ -124,2 +99,4 @@ // only CommonJS-like enviroments that support module.exports, | ||
ret = oldSet.call(this, key, value, options); | ||
// seamleassly stolen from backbone core | ||
@@ -147,6 +124,5 @@ // check if the setter action is triggered | ||
if (_.isObject(attrs)) { | ||
if (isMutator === true && _.isObject(attrs)) { | ||
_.each(attrs, _.bind(function (attr, attrKey) { | ||
var cur_ret = null; | ||
if (isMutator === true && _.isObject(this.mutators[attrKey]) === true) { | ||
if (_.isObject(this.mutators[attrKey]) === true) { | ||
// check if we need to set a single value | ||
@@ -163,21 +139,10 @@ | ||
} | ||
cur_ret = meth.call(this, attrKey, attr, options, _.bind(oldSet, this)); | ||
meth.call(this, attrKey, attr, options, _.bind(oldSet, this)); | ||
} | ||
} | ||
if (cur_ret === null) { | ||
cur_ret = _.bind(oldSet, this)(attrKey, attr, options); | ||
} | ||
if (ret !== false) { ret = cur_ret; } | ||
}, this)); | ||
} | ||
//validation purposes | ||
if (ret !== null) { | ||
return ret; | ||
} | ||
return oldSet.call(this, key, value, options); | ||
return ret; | ||
}; | ||
@@ -184,0 +149,0 @@ |
{ | ||
"name": "Backbone.Mutators", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"main": "backbone.mutators.js", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
{ | ||
"name": "Backbone.Mutators", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Backbone plugin to override getters and setters with logic", | ||
@@ -5,0 +5,0 @@ "homepage": "http://asciidisco.github.com/Backbone.Mutators/index.html", |
@@ -323,2 +323,6 @@ ## Backbone.Mutators | ||
### 0.4.1 | ||
+ Fixes [#22](https://github.com/asciidisco/Backbone.Mutators/pull/22) | ||
+ Fixes [#24](https://github.com/asciidisco/Backbone.Mutators/pull/24) | ||
### 0.3.1 | ||
@@ -328,2 +332,6 @@ + Change get context to modal instead of attributes | ||
### 0.3.1 | ||
+ Change get context to modal instead of attributes | ||
+ Added single getter / setter method | ||
### 0.3.0 | ||
@@ -330,0 +338,0 @@ + Removed the Cake based build process and moved to grunt |
@@ -99,2 +99,4 @@ (function (root, factory, undef) { | ||
ret = oldSet.call(this, key, value, options); | ||
// seamleassly stolen from backbone core | ||
@@ -122,6 +124,5 @@ // check if the setter action is triggered | ||
if (_.isObject(attrs)) { | ||
if (isMutator === true && _.isObject(attrs)) { | ||
_.each(attrs, _.bind(function (attr, attrKey) { | ||
var cur_ret = null; | ||
if (isMutator === true && _.isObject(this.mutators[attrKey]) === true) { | ||
if (_.isObject(this.mutators[attrKey]) === true) { | ||
// check if we need to set a single value | ||
@@ -138,21 +139,10 @@ | ||
} | ||
cur_ret = meth.call(this, attrKey, attr, options, _.bind(oldSet, this)); | ||
meth.call(this, attrKey, attr, options, _.bind(oldSet, this)); | ||
} | ||
} | ||
if (cur_ret === null) { | ||
cur_ret = _.bind(oldSet, this)(attrKey, attr, options); | ||
} | ||
if (ret !== false) { ret = cur_ret; } | ||
}, this)); | ||
} | ||
//validation purposes | ||
if (ret !== null) { | ||
return ret; | ||
} | ||
return oldSet.call(this, key, value, options); | ||
return ret; | ||
}; | ||
@@ -159,0 +149,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
353
0
64772
1250