Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@erickmerchant/conditional-watch

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@erickmerchant/conditional-watch - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

14

index.js
const watch = require('recursive-watch')
const debounce = require('debounce-fn')
module.exports = function (conditional, directory, fn, options) {
module.exports = function (conditional, targets, fn, options) {
if (!Array.isArray(targets)) {
targets = [targets]
}
if (conditional) {

@@ -13,6 +17,8 @@ let files = []

watch(directory, function (file) {
files.push(file)
targets.forEach(function (target) {
watch(target, function (file) {
files.push(file)
debounced()
debounced()
})
})

@@ -19,0 +25,0 @@ }

{
"name": "@erickmerchant/conditional-watch",
"version": "2.0.1",
"version": "2.1.0",
"description": "Watch using recursive-watch or not",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -70,1 +70,27 @@ const test = require('tape')

})
test('true - multiple', function (t) {
mockery.enable(mockerySettings)
t.plan(2)
let directories = []
mockery.registerMock('debounce-fn', function (fn, options) {
return fn
})
mockery.registerMock('recursive-watch', function (directory, fn) {
directories.push(directory)
})
require('./index')(true, ['./foo', './bar'], function (files) {
t.ok(1)
t.deepEqual(directories, ['./foo', './bar'])
})
mockery.disable()
mockery.deregisterAll()
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc