Skip to content

Commit

Permalink
refactor: remove dependency on lodash
Browse files Browse the repository at this point in the history
  • Loading branch information
iiroj authored and okonet committed Jul 1, 2019
1 parent c59cd9a commit 767edbd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"del": "^4.1.1",
"execa": "^2.0.1",
"listr": "^0.14.3",
"lodash": "^4.17.11",
"log-symbols": "^3.0.0",
"micromatch": "^4.0.2",
"path-is-inside": "^1.0.2",
Expand Down
13 changes: 5 additions & 8 deletions src/validateConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

const chalk = require('chalk')
const format = require('stringify-object')
const isArray = require('lodash/isArray')
const isFunction = require('lodash/isFunction')
const isObject = require('lodash/isObject')
const isString = require('lodash/isString')

const debug = require('debug')('lint-staged:cfg')

Expand Down Expand Up @@ -36,7 +32,7 @@ module.exports = function validateConfig(config) {

const errors = []

if (!isObject(config)) {
if (!config || typeof config !== 'object') {
errors.push('Configuration should be an object!')
} else {
const globs = Object.keys(config)
Expand All @@ -47,9 +43,10 @@ module.exports = function validateConfig(config) {

globs.forEach(key => {
if (
(!isArray(config[key]) || config[key].some(item => !isString(item) && !isFunction(item))) &&
!isString(config[key]) &&
!isFunction(config[key])
(!Array.isArray(config[key]) ||
config[key].some(item => typeof item !== 'string' && typeof item !== 'function')) &&
typeof config[key] !== 'string' &&
typeof config[key] !== 'function'
) {
errors.push(
createError(
Expand Down

0 comments on commit 767edbd

Please sign in to comment.