Browse Source

Replaced string.split().pop() with string.endsWith()

main
Brian Vaughn 7 years ago
parent
commit
b809279c83
  1. 7
      gatsby-node.js

7
gatsby-node.js

@ -171,12 +171,7 @@ exports.createPages = async ({graphql, boundActionCreators}) => {
const htmlTemplate = fs.readFileSync('./examples/index.html', 'utf8');
fs.readdirSync('./examples').forEach(file => {
// Only create pages for the JS files
if (
file
.toLowerCase()
.split('.')
.pop() === 'js'
) {
if (file.endsWith('.js')) {
const slug = file.substring(0, file.length - 3);
const jsTemplate = fs.readFileSync(`./examples/${file}`, 'utf8');

Loading…
Cancel
Save