files-filters
Advanced tools
Comparing version 0.1.1 to 0.1.2
'use strict'; | ||
var path = require('path'); | ||
var isDir = require('is-directory'); | ||
module.exports = function(re, method) { | ||
method = method || 'basename'; | ||
return function exclude(fp, dir) { | ||
fp = path.join(dir, fp); | ||
if (typeof dir === 'string' && isDir(fp) && !re.test(dir)) { | ||
return true; | ||
} | ||
if (method && Boolean(path[method])) { | ||
fp = path[method](fp); | ||
} | ||
return !re.test(fp); | ||
if (re.test(fp) || re.test(dir)) { | ||
return false; | ||
} | ||
return true; | ||
}; | ||
}; |
@@ -5,3 +5,2 @@ 'use strict'; | ||
var isDir = require('is-directory'); | ||
var mm = require('minimatch'); | ||
@@ -19,4 +18,6 @@ module.exports = function(pattern, options, recurse) { | ||
} | ||
var mm = require('minimatch'); | ||
return mm(fp, pattern, options); | ||
}; | ||
}; |
@@ -9,10 +9,17 @@ 'use strict'; | ||
fp = path.join(dir, fp); | ||
if (typeof dir === 'string' && isDir(fp)) { | ||
if ((typeof dir === 'string' && isDir(fp)) || re.test(dir)) { | ||
return true; | ||
} | ||
if (method && Boolean(path[method])) { | ||
fp = path[method](fp); | ||
} | ||
return re.test(fp); | ||
if (re.test(fp) || re.test(dir)) { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
}; |
{ | ||
"name": "files-filters", | ||
"description": "Functions for fantastically fast file filtering, and more things that start with 'f'.", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"homepage": "https://github.com/jonschlinkert/files-filters", | ||
@@ -37,5 +37,3 @@ "author": { | ||
"mocha": "*", | ||
"should": "^4.1.0", | ||
"verb": ">= 0.2.6", | ||
"verb-tag-jscomments": ">= 0.2.0" | ||
"should": "^4.1.0" | ||
}, | ||
@@ -42,0 +40,0 @@ "keywords": [ |
@@ -6,3 +6,3 @@ # files-filters [![NPM version](https://badge.fury.io/js/files-filters.svg)](http://badge.fury.io/js/files-filters) | ||
## Install | ||
#### Install with [npm](npmjs.org) | ||
### Install with [npm](npmjs.org) | ||
@@ -22,3 +22,3 @@ ```bash | ||
```js | ||
var filter = require('files-filters'); | ||
var filters = require('files-filters'); | ||
var files = require('filter-files'); | ||
@@ -46,3 +46,3 @@ | ||
## License | ||
Copyright (c) 2014 Jon Schlinkert, contributors. | ||
Copyright (c) 2014 Jon Schlinkert | ||
Released under the MIT license | ||
@@ -52,4 +52,4 @@ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 30, 2014._ | ||
_This file was generated by [verb](https://github.com/assemble/verb) on November 17, 2014._ | ||
[filter-files]: https://github.com/jonschlinkert/filter-files |
@@ -6,4 +6,8 @@ 'use strict'; | ||
/** | ||
* `basename` of a file, excluding extension | ||
*/ | ||
module.exports = function basename(filepath) { | ||
return path.basename(filepath, ext(filepath)); | ||
}; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13101
3
276
32