Skip to content

Commit

Permalink
standard
Browse files Browse the repository at this point in the history
  • Loading branch information
feross committed Oct 29, 2020
1 parent 1815aa9 commit 502f26c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
26 changes: 13 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = deglob

var findRoot = require('find-root')
var fs = require('fs')
var glob = require('glob')
var ignorePkg = require('ignore')
var os = require('os')
var parallel = require('run-parallel')
var path = require('path')
var pkgConfig = require('pkg-config')
var uniq = require('uniq')
const findRoot = require('find-root')
const fs = require('fs')
const glob = require('glob')
const ignorePkg = require('ignore')
const os = require('os')
const parallel = require('run-parallel')
const path = require('path')
const pkgConfig = require('pkg-config')
const uniq = require('uniq')

function deglob (files, opts, cb) {
if (typeof opts === 'function') return deglob(files, null, opts)
Expand All @@ -30,7 +30,7 @@ function deglob (files, opts, cb) {
if (err) return cb(err)

// flatten nested arrays
var files = results.reduce(function (files, result) {
let files = results.reduce(function (files, result) {
result.forEach(function (file) {
files.push(path.resolve(opts.cwd, file))
})
Expand Down Expand Up @@ -80,14 +80,14 @@ function parseOpts (opts) {
}

// Find package.json in the project root
var root
let root
try {
root = findRoot(opts.cwd)
} catch (e) {}

if (root) {
if (opts.usePackageJson) {
var packageOpts = pkgConfig(opts.configKey, { root: false, cwd: opts.cwd })
const packageOpts = pkgConfig(opts.configKey, { root: false, cwd: opts.cwd })
if (packageOpts && packageOpts.ignore) {
// Use ignore patterns from package.json ("config.ignore" property)
addIgnorePattern(packageOpts.ignore)
Expand All @@ -96,7 +96,7 @@ function parseOpts (opts) {

if (opts.useGitIgnore) {
// Use ignore patterns from project root .gitignore
var gitignores = []
let gitignores = []
gitignores = opts.gitIgnoreFile
.map(function (f) {
try {
Expand Down
12 changes: 6 additions & 6 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var path = require('path')
var test = require('tape')
var deglob = require('../')
const path = require('path')
const test = require('tape')
const deglob = require('../')

var playground = path.join(__dirname, 'playground')
var opts = { cwd: playground, gitIgnoreFile: 'custom-gitignore' }
const playground = path.join(__dirname, 'playground')
const opts = { cwd: playground, gitIgnoreFile: 'custom-gitignore' }

const globbies = [
{
Expand Down Expand Up @@ -52,7 +52,7 @@ globbies.forEach(function (obj) {

function checkEm (err, files) {
if (err) throw err
var testName = obj.name + ' -- matches ' + obj.expectedFiles.length + ' files'
const testName = obj.name + ' -- matches ' + obj.expectedFiles.length + ' files'
t.equals(files.length, obj.expectedFiles.length, testName)
obj.expectedFiles.forEach(function (expectedFile) {
t.ok(files.indexOf(path.join(playground, expectedFile)) > -1, 'File in Result: ' + expectedFile)
Expand Down

0 comments on commit 502f26c

Please sign in to comment.