Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ The second parameter to require must be an object and supports the following key
### options *[optional, default:{}]*
This allows options to be provided to [node-glob](https://www.npmjs.com/package/glob), which is used internally to find matching files.

### sort *[optional, default: alphanumeric]*
By default the list of files returned is sorted by name. This option allows a custom sort function to be used. The parameter is passed to sort(), so any of the sort variations supported by sort() can be used.

### skip *[optional, default: 0]*
Allows entries at the beginning of the matching list of file names to be skipped.

### limit *[optional, default: length of list]*
Allows the list of matching files to be truncated to the specified length.

### ext *[deprecated, optional, default:false]*
This option is replaced by `resolve: 'strip-ext'`, but remains supported until version 2.0.0.
**WARNING**: Backwards compatibility is not available in combination with the newer "resolve" option.
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ module.exports = require('browserify-transform-tools').makeRequireTransform(

try {
// sort files to ensure consistent order upon multiple runs
files.sort();
files.sort(config.sort); //allow custom sorting
if (config.skip) files.splice(0, config.skip); //skip files at front
if (config.limit) files.splice(config.limit, files.length); //truncate list

result = mode(opts.file, files, config);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "require-globify",
"version": "1.3.0",
"version": "1.3.1",
"description": "transform for browserify, which allows to require files with globbing expressions",
"main": "./index.js",
"scripts": {
Expand Down