Skip to content

Commit

Permalink
avoid serialization of function valued properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
sorvell committed Oct 31, 2013
1 parent 113dff3 commit 6428abe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/instance/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
serializeValue: function(value, inferredType) {
if (inferredType === 'boolean') {
return value ? '' : undefined;
} else if (inferredType !== 'object' && value !== undefined) {
} else if (inferredType !== 'object' && inferredType !== 'function'
&& value !== undefined) {
return value;
}
},
Expand Down
4 changes: 4 additions & 0 deletions src/lib/deserialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
// The object isn't valid JSON, return the raw value
return value;
}
},
// avoid deserialization of functions
'function': function(value, currentValue) {
return currentValue;
}
};

Expand Down

0 comments on commit 6428abe

Please sign in to comment.