const { map } = require('lodash');
const { get } = require('lodash');
const path = require('path');
const pify = require('pify');
const fs = pify(require('fs'));

module.exports = {
    async uploadFolderToBucket(folder, bucket) {
        const dirContents = map(await fs.readdir(folder),
            name => path.join(folder, name)
        );

        const dotFiles = get(this.serverless, 'service.custom.apigs3.dotFiles', false);

        await Promise.all(dirContents.map(async item => {
            if (path.basename(item)[0] === '.' && !dotFiles) return;

            const stat = await fs.stat(item);

            if (stat.isFile()) {
                return this.uploadFileToBucket(item, bucket);

            } else if (stat.isDirectory()) {
                return this.uploadFolderToBucket(item, bucket);
            }
        }));
    }
};

@@ -1,39 +1,4 @@
-const %7B map %7D = require('lodash');%0A
 cons
@@ -4,16 +4,21 @@
 st %7B get
+, map
  %7D = req

combine lodash imports