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

act-on-modules

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

act-on-modules

Library to perform an action on all user-defined modules under a given directory

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

#Purpose

This project is provides a utility that iterates recursively in a given directory, skips over node_module directories and stops iterating recursively in any directory containing a package.json file to execute a user-defined action with the directory as an argument.

#Usage

##Sync

const actOnModules = require('act-on-modules');

actOnModules.sync('SomePathToADirectory', (directory) => {
    //put your logic here
});

##Async with callback

const actOnModules = require('act-on-modules');

actOnModules('SomePathToADirectory', 
(directory) => {
    //put your logic here
},
(err) => {
    //This is the callback once everything is done
    //Be mindful that asynchronous operations in your custom action might not have completed
    //You'll have to add an additional layer of logic with nimble/async or promises if you want asynchronous flow control
});

##Async with promise

const actOnModules = require('act-on-modules');

actOnModules('SomePathToADirectory', 
(directory) => {
    //put your logic here
}).then(() => {
    //This is the callback once everything is done without any error
    //Be mindful that asynchronous operations in your custom action might not have completed
    //You'll have to add an additional layer of logic with nimble/async or promises if you want asynchronous flow control
}).catch((err) => {
    //This is the callback if an error was encountered
    //Again, be mindful that asynchronous operations in your custom action might not have completed
    //You'll have to add an additional layer of logic with nimble/async or promises if you want asynchronous flow control
};

FAQs

Package last updated on 01 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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