JSON.stringify(m.prop(x)) use x.toJSON method when possible

When JSON serializing m.prop, check if wrapped object does define toJSON method
and if so, return it's result.
This commit is contained in:
Piotr Husiatyński 2016-05-25 10:18:32 +02:00
parent 42b21a5950
commit c71e8f4fcb
2 changed files with 17 additions and 0 deletions

View file

@ -1331,6 +1331,7 @@
}
prop.toJSON = function () {
if (store && isFunction(store.toJSON)) return store.toJSON()
return store
}