Home Variable with reg expression is not recognized in js
Reply: 0

Variable with reg expression is not recognized in js

Naveen DINUSHKA Published in 2018-01-13 02:05:55Z

I am trying to generate a template using slush, my code repo is here: https://github.com/NaveenDK/slush-template-generator/blob/master/templates/react-native-app/MediaButtons.js

Even though the template files run fine on its own, when I try to generate using slush with the following lines in the MediaButtons.js file

 let match = /\.(\w+)$/.exec(filename);
    let type = match ? `image/${match[1]}` : `image`;

I get an error which says that 'match' is not defined, when I scaffold it with slush and when it is in the templates folder . My guess is that the reg expression is not interpreted properly

Thanks for any help! Naveen

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.298125 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO