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

Variable with reg expression is not recognized in js

user701
1#
user701 Published in April 24, 2018, 10:29 am

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.298814 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO