Skip to content

Commit

Permalink
chore: Remove arrify dependency. (#1058)
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyfarrell authored and JaKXz committed Apr 5, 2019
1 parent 68d6333 commit 997ed29
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 29 deletions.
7 changes: 3 additions & 4 deletions index.js
Expand Up @@ -2,7 +2,6 @@

/* global __coverage__ */

const arrify = require('arrify')
const cachingTransform = require('caching-transform')
const util = require('util')
const findCacheDir = require('find-cache-dir')
Expand Down Expand Up @@ -44,12 +43,12 @@ function NYC (config) {
this._buildProcessTree = this._showProcessTree || config.buildProcessTree
this._eagerInstantiation = config.eager || false
this.cwd = config.cwd || process.cwd()
this.reporter = arrify(config.reporter || 'text')
this.reporter = [].concat(config.reporter || 'text')

this.cacheDirectory = (config.cacheDir && path.resolve(config.cacheDir)) || findCacheDir({ name: 'nyc', cwd: this.cwd })
this.cache = Boolean(this.cacheDirectory && config.cache)

this.extensions = arrify(config.extension)
this.extensions = [].concat(config.extension || [])
.concat('.js')
.map(ext => ext.toLowerCase())
.filter((item, pos, arr) => arr.indexOf(item) === pos)
Expand All @@ -68,7 +67,7 @@ function NYC (config) {
})

// require extensions can be provided as config in package.json.
this.require = arrify(config.require)
this.require = [].concat(config.require || [])

this.transforms = this.extensions.reduce((transforms, ext) => {
transforms[ext] = this._createTransform(ext)
Expand Down
9 changes: 4 additions & 5 deletions lib/config-util.js
@@ -1,6 +1,5 @@
'use strict'

const arrify = require('arrify')
const fs = require('fs')
const path = require('path')
const findUp = require('find-up')
Expand Down Expand Up @@ -37,10 +36,10 @@ Config.loadConfig = function (argv, cwd) {
}
}

if (config.require) config.require = arrify(config.require)
if (config.extension) config.extension = arrify(config.extension)
if (config.exclude) config.exclude = arrify(config.exclude)
if (config.include) config.include = arrify(config.include)
if (config.require) config.require = [].concat(config.require)
if (config.extension) config.extension = [].concat(config.extension)
if (config.exclude) config.exclude = [].concat(config.exclude)
if (config.include) config.include = [].concat(config.include)

return config
}
Expand Down
38 changes: 19 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Expand Up @@ -68,7 +68,6 @@
"license": "ISC",
"dependencies": {
"archy": "^1.0.0",
"arrify": "^1.0.1",
"caching-transform": "^3.0.2",
"convert-source-map": "^1.6.0",
"find-cache-dir": "^2.1.0",
Expand Down

0 comments on commit 997ed29

Please sign in to comment.