files-filters
Advanced tools
Comparing version 0.1.0 to 0.1.1
'use strict'; | ||
var path = require('path'); | ||
var isDir = require('is-directory'); | ||
@@ -6,0 +5,0 @@ module.exports = function(re, method) { |
@@ -6,9 +6,18 @@ 'use strict'; | ||
module.exports = function(extname) { | ||
/** | ||
* Match the given `extname` | ||
* | ||
* @param {String} extname | ||
* @param {Boolean} `recurse` When `true` will also return directories matched before | ||
* the actual condition is met, but necessary for nested dirs. | ||
* @return {String} | ||
*/ | ||
module.exports = function(extname, recurse) { | ||
return function ext(fp, dir) { | ||
if (typeof dir === 'string' && isDir(path.join(dir, fp))) { | ||
if (recurse && typeof dir === 'string' && isDir(path.join(dir, fp))) { | ||
return true; | ||
} | ||
return path.extname(fp) === extname; | ||
} | ||
}; | ||
}; |
@@ -5,2 +5,3 @@ 'use strict'; | ||
var isDir = require('is-directory'); | ||
var name = require('../utils/name'); | ||
@@ -15,3 +16,3 @@ module.exports = function(str, method) { | ||
if (method && method === 'name') { | ||
fp = path.basename(fp, path.extname(fp)); | ||
fp = name(fp); | ||
} else if (method && Boolean(path[method])) { | ||
@@ -21,3 +22,3 @@ fp = path[method](fp); | ||
return fp === str; | ||
} | ||
}; | ||
}; |
@@ -16,3 +16,3 @@ 'use strict'; | ||
return re.test(fp); | ||
} | ||
}; | ||
}; |
'use strict'; | ||
var path = require('path'); | ||
var lookup = require('filter-files'); | ||
@@ -5,0 +4,0 @@ var camelize = require('../utils/camelize'); |
{ | ||
"name": "files-filters", | ||
"description": "Functions for fantastically fast file filtering, and more things that start with 'f'.", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "https://github.com/jonschlinkert/files-filters", | ||
@@ -32,3 +32,3 @@ "author": { | ||
"is-directory": "^0.2.2", | ||
"multimatch": "^1.0.0" | ||
"minimatch": "^1.0.0" | ||
}, | ||
@@ -38,2 +38,3 @@ "devDependencies": { | ||
"mocha": "*", | ||
"should": "^4.1.0", | ||
"verb": ">= 0.2.6", | ||
@@ -40,0 +41,0 @@ "verb-tag-jscomments": ">= 0.2.0" |
'use strict'; | ||
/** | ||
* Coerce value to an flattened, dense array. | ||
* | ||
* @api private | ||
*/ | ||
module.exports = function (val) { | ||
module.exports = function arrayify(val) { | ||
return Array.isArray(val) ? val : [val]; | ||
}; |
'use strict'; | ||
var path = require('path'); | ||
var name = require('./name'); | ||
module.exports = function camelize(fp) { | ||
var str = path.basename(fp, path.extname(fp)); | ||
return str.replace(/-(.)/g, function (_, s) { | ||
return name(fp).replace(/-(.)/g, function (_, s) { | ||
return s.toUpperCase(); | ||
}); | ||
}; |
@@ -5,4 +5,4 @@ 'use strict'; | ||
module.exports = function ext(filepath) { | ||
return path.extname(filepath); | ||
module.exports = function ext(fp) { | ||
return path.extname(fp); | ||
}; |
@@ -8,2 +8,16 @@ 'use strict'; | ||
// module.exports = { | ||
// basename: require('./basename'), | ||
// camelize: require('./camelize'), | ||
// dirname: require('./dirname'), | ||
// ext: require('./ext'), | ||
// isDir: require('./is-dir'), | ||
// isFile: require('./is-file'), | ||
// method: require('./method'), | ||
// name: require('./name'), | ||
// normalize: require('./normalize'), | ||
// segment: require('./segment'), | ||
// }; | ||
lookup.sync(__dirname, false).forEach(function (name) { | ||
@@ -10,0 +24,0 @@ var fp = path.resolve(__dirname, name); |
'use strict'; | ||
var path = require('path'); | ||
var isDir = require('is-directory'); | ||
module.exports = function(fp, dir) { | ||
fp = dir ? path.join(dir, fp) : fp; | ||
module.exports = function(fp) { | ||
return isDir(fp); | ||
}; |
'use strict'; | ||
var path = require('path'); | ||
var isDir = require('is-directory'); | ||
module.exports = function isFile(fp, dir) { | ||
fp = dir ? path.join(dir, fp) : fp; | ||
module.exports = function isFile(fp) { | ||
return !isDir(fp); | ||
}; |
'use strict'; | ||
var re = /[\\\/]+/g; | ||
module.exports = function normalize(files) { | ||
if (typeof files === 'string') { | ||
return files.replace(re, '/'); | ||
} | ||
return files.map(function(fp) { | ||
return fp.replace(/[\\\/]+/g, '/'); | ||
return fp.replace(re, '/'); | ||
}).sort(); | ||
}; |
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
264
13029
5
33
+ Addedminimatch@^1.0.0
- Removedmultimatch@^1.0.0
- Removedarray-differ@1.0.0(transitive)
- Removedarray-union@1.0.2(transitive)
- Removedarray-uniq@1.0.3(transitive)
- Removedmultimatch@1.0.1(transitive)