Skip to content

Commit

Permalink
Updated docs to reflect that the flattenDirectories was deprecated in…
Browse files Browse the repository at this point in the history
… favor of 'flatten'. Also added an error message about it. See balderdashy/sails@024991f#commitcomment-18785447 for context.
  • Loading branch information
mikermcneil committed Aug 25, 2016
1 parent 9b94d4c commit 763336c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ require('include-all').aggregate({
| filter | only include modules whose FILENAME matches this regex. default `undefined`
| pathFilter | only include modules whose FULL RELATIVE PATH matches this regex (relative from the entry point directory). default `undefined`
| dontLoad | if `dontLoad` is set to true, don't run the module w/ V8 or load it into memory-- instead, return a tree representing the directory structure (all extant file leaves are included as keys, with their value = `true`)
| flattenDirectories | if enabled, ALL modules appear as top-level keys in the dictionary-- even those from within nested directories.
| keepDirectoryPath | Only relevant if `flattenDictionaries` is `true`. If enabled, this option causes include-all to include the directory path in the key names.
| flatten | if enabled, ALL modules appear as top-level keys in the dictionary-- even those from within nested directories.
| keepDirectoryPath | Only relevant if `flatten` is `true`. If enabled, this option causes include-all to include the relative paths in the key names (for nested modules from subdirectories path in the key names).


## High-Level Options
Expand Down
10 changes: 7 additions & 3 deletions lib/help-include-all-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ var _ = require('lodash');
*
* @optional {Boolean} keepDirectoryPath
* See README
* Note that flattenDirectories must also be set to `true` for this to work.
* Note that `flatten` must also be set to `true` for this to work.
* @default false
*
* @optional {Boolean} flattenDirectories
* @optional {Boolean} flatten
* See README
* @default false
*
Expand Down Expand Up @@ -109,7 +109,7 @@ var _ = require('lodash');
module.exports = function includeAll(options) {
options = options || {};

// Assertions
// Assertions about usage
if (typeof options.dirname === 'undefined') {
throw new Error('`dirname` is required');
}
Expand All @@ -122,6 +122,10 @@ module.exports = function includeAll(options) {
if (typeof options.exclude !== 'undefined' && (typeof options.exclude !== 'object' || options.exclude === null)) {
throw new Error('If specified, `exclude` must be an array of RegExps.');
}
// Deprecations:
if (typeof options.flattenDirectories !== 'undefined') {
throw new Error('As of include-all v1.0.1, `flattenDirectories` was replaced with `flatten`. See https://github.com/balderdashy/include-all#options for more information.');
}


// Sane defaults:
Expand Down

0 comments on commit 763336c

Please sign in to comment.