Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to convert function with split #14

Open
hernaneche opened this issue Apr 1, 2016 · 1 comment
Open

Fail to convert function with split #14

hernaneche opened this issue Apr 1, 2016 · 1 comment

Comments

@hernaneche
Copy link

Running with this code

function getStrAfter(str, delimiter) {
       var pre=str.split(delimiter,2);
       if(pre.length>1){
           return pre[1];
       }else{
           return str;
       }           
}

I got


 C:\Users\Me\AppData\Roaming\npm\node_modules\js2php\core\string.js:116
    var regexpData = args[0].raw.match(/^\/([^\/]+)\/([gimy])?$/),
                                ^

TypeError: Cannot read property 'match' of undefined
    at module.exports.split (C:\Users\Me\AppData\Roaming\npm\node_modules\js2php\core\string.js:116:33)
    at Object.module.exports.evaluate (C:\Users\Me\AppData\Roaming\npm\node_modules\js2php\core.js:22:24)
    at visit (C:\Users\Me\AppData\Roaming\npm\node_modules\js2php\index.js:198:26)
    at visit (C:\Users\Me\AppData\Roaming\npm\node_modules\js2php\index.js:166:18)
    at visit (C:\Users\Me\AppData\Roaming\npm\node_modules\js2php\index.js:68:28)
    at visit (C:\Users\Me\AppData\Roaming\npm\node_modules\js2php\index.js:58:20)
    at visit (C:\Users\Me\AppData\Roaming\npm\node_modules\js2php\index.js:52:20)
    at visit (C:\Users\Me\AppData\Roaming\npm\node_modules\js2php\index.js:266:27)
    at visit (C:\Users\Me\AppData\Roaming\npm\node_modules\js2php\index.js:52:20)
    at module.exports (C:\Users\Me\AppData\Roaming\npm\node_modules\js2php\index.js:538:22)

@endel
Copy link
Owner

endel commented Apr 1, 2016

Hi @hernaneche,

Thanks for trying out this project and for reporting. Unfortunately I do not plan to support this library anymore, since there isn't a real usage scenario I can think of.

In case you'd like to fix this by yourself, it's perfectly feasible to do it by modifying the split call here: https://github.com/endel/js2php/blob/master/core/string.js#L109-L135

Cheers!

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

No branches or pull requests

2 participants