Jordan Tucker
Jordan Tucker
Here's a few examples that would fail if we treated everything between two `/` as a `RegExp`: ``` js /\/ /(/ /)/ /[/ /*/ /+/ /?/ ``` We would also...
It still seems that there is some desire to implement regular expressions as first class values in JSON5. So, I'm going to elaborate on why I think it's a bad...
I've re-opened this issue to discuss whether JSON5 should serialize `RegExp` objects to strings and how it would be implemented. I'm not suggesting that we treat `RegExp`s as first class...
I'm in the process of finalizing v1.0.0, so I've taken another look at `RegExp` support. I've been testing out an option for `parse` that will automatically find strings that look...
@aseemk Valid point about having differing implementations, especially since this is the reference implementation. This feature may be better left to another implementation. I'm still hesitant about allowing regex literals...
Funny thing about that rant. I actually used that algorithm to implement this experimental feature.
@bluelovers I agree. That's what this experimental feature does. https://github.com/json5/json5/blob/a6c2b14ee81d4963ed07f4d49013c49bcf99abf6/src/stringify.js#L91-L93
@bluelovers It has only been implemented in this experimental feature. It's not part of the main code. You can use this `replacer` function for now. ```javascript const replacer = (k,...
For functions, use this `replacer`: ```javascript const replacer = (k, v) => v instanceof Function ? 'I tried to serialize a function with JSON5, but all I got was this...
@gajus No, but you can use this reviver function to achieve the same result. https://github.com/json5/json5/blob/v1.0.0-regexps/src/parse.js#L51-L115 The `util.isIdContinueChar` function can be imported from `json5/lib/util`. Or you can use this self-contained [regexp-reviver.js](https://gist.github.com/jordanbtucker/28975ef9d7df480274d74b021dfac1cd)...