targaryen icon indicating copy to clipboard operation
targaryen copied to clipboard

Allow .toJSON() function on objects to be used

Open rhodgkins opened this issue 6 years ago • 1 comments

Firebase database itself allows toJSON to be used when storing data (I'm guessing through the use of JSON.stringify).

I've changed the .from method to check for objects and the presence of this method and use it.

Also updated any failing tests and added new ones to cover the change.

Note that this will mean that new Date() is now a valid value, stored as '2018-10-16T10:12:00.060Z' for example.

rhodgkins avatar Oct 16 '18 10:10 rhodgkins

Also added node 8 to test matrix - I've changed the node 6 check node --version | grep v6\. to not check for node 4 instead so 6 and 8 are now included.

I'm not sure why the builds are failing though - a basic npm t on node 6 and 8 work fine! (Node 4 build was failing before this change.)

rhodgkins avatar Oct 16 '18 10:10 rhodgkins