Open Glavin001 opened 9 years ago
However, I have to say...
I just beautified my entire Atom Beautify source code that was the only bug! I used an experimental feature I am working on, Atom Beautify - Beautify Directory
, and was able to beautify all of my files effortlessly with Coffee-fmt + Atom Beautify. We make a great team. Awesome work so far!
Actually I missed a few files. Here's another issue: #17 :stuck_out_tongue_winking_eye:
Yes think I forgot about regular expressions entirely. Will take a look at this and #17.
Same bug with this line of code:
Date.now() + '-' + file.originalname.replace(/[^0-9A-Za-z\.]+/g, '_').replace(/\.\.+/g, '_')
It hangs at the first square bracket, and I fixed it as @Glavin001 suggested:
Date.now() + '-' + file.originalname.replace(new RegExp('[^0-9A-Za-z\\.]+', 'g'), '_').replace(new RegExp('\\.\\.+', 'g'), '_')
@nmaggioni
Yes, I forgot to implement regex syntax so the constructor method is okay. I'm pretty busy right now but would gladly accept a PR.
The problem seems to be with the caret (^
) in the regular expression.
It works fine with a regular expression without a caret.
I think it has something to do with RegExp shorthand. Here's the applicable portion of the
debug
logs:Note that
Now repeats infinitely.
I changed
to
and things worked again.