Skip to content

Commit 6428abe

Browse files
committed
avoid serialization of function valued properties.
1 parent 113dff3 commit 6428abe

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/instance/attributes.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@
6363
serializeValue: function(value, inferredType) {
6464
if (inferredType === 'boolean') {
6565
return value ? '' : undefined;
66-
} else if (inferredType !== 'object' && value !== undefined) {
66+
} else if (inferredType !== 'object' && inferredType !== 'function'
67+
&& value !== undefined) {
6768
return value;
6869
}
6970
},

src/lib/deserialize.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
// The object isn't valid JSON, return the raw value
3737
return value;
3838
}
39+
},
40+
// avoid deserialization of functions
41+
'function': function(value, currentValue) {
42+
return currentValue;
3943
}
4044
};
4145

0 commit comments

Comments
 (0)