Skip to content

Commit

Permalink
Replaced string.split().pop() with string.endsWith()
Browse files Browse the repository at this point in the history
  • Loading branch information
bvaughn committed Nov 6, 2017
1 parent d8d6076 commit b809279
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down

0 comments on commit b809279

Please sign in to comment.