diff --git a/readme.md b/readme.md index b48b407..714a9a3 100644 --- a/readme.md +++ b/readme.md @@ -35,7 +35,7 @@ require('./foo')(); ## API -### clearModule(moduleId, callback) +### clearModule(moduleId, options) #### moduleId @@ -43,13 +43,17 @@ Type: `string` What you would use with `require()`. -#### callback +#### options -Type: `function` +Type: `object` -Optional callback to filter with, must return false to not clear. -Passes in the full path to the module. -Will not process child modules of modules that are filtered out. +##### options.filter + +Optional callback to filter with, must return false to not clear. Passes in the full path to the module. Will not process child modules of modules that are filtered out. + +Use case + +This allows you to prevent specific submodules from being unloaded, i.e. aws-sdk, if used in main code, but you have it in modules that are being cleared out, this could adversely affect code that is not being cleared. You could also, prevent anything from node_modules from being unloaded as well, fp => !fp.match(/node_modules/). For users, this will only unload user code and not package code. ### clearModule.all()