Adventures in ES6 with ReactJS

3 months ago

I am hoping to get into the habit of sharing software development related stuff on this site. And one of the key things to have is to share code in a more visually appealing manner. Syntax highlighting courtesy of prism.js to the rescue! 

Getting my hands dirty with newer JavaScript frameworks as well as VisualStudio Code for macOS by Microsoft. I also hope to post Java snippets and other useful stuff in the future.

import jetpack from 'fs-jetpack';

const query = { matching: '*.jpg', files: true, recursive: true };

class ImageScan {
  scan(path) {
    let files = [];
    try {
      let q = Object.assign({}, query);
      files = jetpack.find(path, q);
      console.log("found:", files);
    } catch(err) {
      console.log("Error: ", err);
    }
    return files;
  }
}

export default ImageScan;