Tagged Templates in JS

node v8.17.0
version: 1.0.0
endpointsharetweet
const isProd = true; // Change here to test differents environments function applyHashIfNecessary(strings, shouldOptimize) { const all = String.raw(strings).split('.'); // Transform into array const name = all.shift(); // Get first, assume this is a name if (isProd) { // Apply hash on begginer all.unshift('[hash]'); } return [ name, ...all ].join('.'); // Concat all with . divider } applyHashIfNecessary`[name].test.js`;
Loading…

no comments

    sign in to comment