locutusjs / locutus

Bringing stdlibs of other programming languages to JavaScript for educational purposes

Home Page:https://locutus.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for php_strip_whitespace?

tomjn opened this issue · comments

  • Have you checked the guidelines in our Contributing document?

Description

Is php_strip_whitespace support intended? I see a lot of things were removed in the move from php.js to locutus, but I can't find any trace of it before or after.

There is an implementation floating around that credits yourself and Brett Zamir, but it produces similar but different output, making it useless for my purposes :(

Pre-locutus functions are saved in the https://github.com/kvz/locutus/tree/v1.3.2 tag for reference. That being said, we removed it for a good reason. That function locks the entire browser up and should only be used for experimentation and nothing else :)

I can see that with the retrieval of remote stuff, though my local copy has that bit snipped out, I was hoping for the regex pattern part fixing as I'm dealing exclusively with strings.

Is there anything or anywhere you'd recommend I look next?

This comes with a whole bunch of disclaimers and recommendations against using, but since you seem to be knowing what you're doing: https://github.com/kvz/locutus/blob/v1.3.2/experimental/misc/php_strip_whitespace.js

Why not create a web worker to do this on a separate background thread, that way it doesn't lock up the browser?

@Knight-Yoshi that could work, but in my case I already have the PHP string, I need to do the stripping in a way that matches the native PHP version, the two give differing output