Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Request for adding reviver to json-parsing #9

Open
ItsAsbreuk opened this issue Dec 10, 2013 · 0 comments
Open

Request for adding reviver to json-parsing #9

ItsAsbreuk opened this issue Dec 10, 2013 · 0 comments

Comments

@ItsAsbreuk
Copy link

I would like to have the ability to json.parse with a reviver.
The current storage-lite doesn't let me. By making this posible (with a third parameter), i am able to retreive trully Date-objects instead of string-types (that is when Date-properties get stringified), using this reviver:

var DATEPATTERN = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z/;
var reviver = function(key, value) {
     return DATEPATTERN.test(value) ? new Date(value) : value;
};

Thanks in advance,
Marco.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant