From d6e3b4407b9235008730239612f9cff9606024a8 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Fri, 17 Feb 2017 17:44:58 +0100 Subject: [PATCH] Fixed cwd var error --- src/index.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/index.js b/src/index.js index 1859123..170b9b3 100644 --- a/src/index.js +++ b/src/index.js @@ -15,9 +15,7 @@ const isPlainObj = require('is-plain-obj') */ const getFiles = function(pattern, cwd) { - return glob.sync(pattern, { - cwd: opts.cwd - }) + return glob.sync(pattern, { cwd }) } @@ -82,19 +80,19 @@ module.exports = function(pattern, opts) { } opts = Object.assign({ - cwd: process.cwd(), - dataPaths: (fileName) => {} + cwd : process.cwd(), + dataPaths : () => {} }, opts) // Support relative and absolute paths opts.cwd = path.resolve(process.cwd(), opts.cwd) - const filePaths = getFiles(pattern, cwd) + const filePaths = getFiles(pattern, opts.cwd) return filePaths.map((filePath) => { // Ensure that path is absolute - filePath = path.resolve(cwd, filePath) + filePath = path.resolve(opts.cwd, filePath) return parseComponent(filePath, opts.cwd, opts.dataPaths)