# MapDirectory() Influence & Filters

The `mapDirectory()` allows you to leverage closures or lambdas to influence and filter mappings. The arguments are `filter` to add a filter that MUST return boolean in order to process the mapping and `influence` that can influence the created mapping with any custom bindings.

```javascript
// influence only certain components to be singleton
mapDirectory(packagePath="coldbox.testing.testModel.ioc", influence=function(binder, path){
    if( findNoCase( "simple", arguments.path) ){
        arguments.binder.asSingleton();
    }
});

// filter some components from registration
mapDirectory(packagePath="coldbox.testing.testModel.ioc", filter=function(path){
    return ( findNoCase( "simple", arguments.path ) ? false : true );
});
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wirebox.ortusbooks.com/2/configuration/mapping-dsl/mapdirectory-influence-and-filters.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
