Comparing version 0.3.4 to 0.3.5
{ | ||
"name": "fs-utils", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"main": [ | ||
@@ -5,0 +5,0 @@ "index.js" |
40
index.js
@@ -281,5 +281,5 @@ /** | ||
// the first is returned | ||
file.findFile = function(filepath, options) { | ||
var opts = _.extend({filter: 'isFile'}, options); | ||
var str = glob.find(filepath, opts)[0]; | ||
file.findFile = function() { | ||
var filepath = path.join.apply(path, arguments); | ||
var str = glob.find(filepath, {filter: 'isFile'})[0]; | ||
return str ? String(path.resolve(str)) : null; | ||
@@ -291,5 +291,5 @@ }; | ||
// the first direc returned | ||
file.findDir = function(dir, options) { | ||
var opts = _.extend({filter: 'isDirectory'}, options); | ||
var str = glob.find(dir, opts)[0]; | ||
file.findDir = function() { | ||
var filepath = path.join.apply(path, arguments); | ||
var str = glob.find(filepath, {filter: 'isDirectory'})[0]; | ||
return str ? String(path.resolve(str)) : null; | ||
@@ -571,4 +571,9 @@ }; | ||
}; | ||
file.firstDir = file.firstSegment; | ||
// First segment of a file path | ||
file.firstDir = function (f) { | ||
var filepath = path.join.apply(path, arguments); | ||
return _.initial(filepath.split('/')).join('/'); | ||
}; | ||
// Directory path | ||
@@ -592,8 +597,2 @@ file.dirname = function() { | ||
/** | ||
* Path "endings" | ||
*/ | ||
// Last dictory path segment, excluding the filename | ||
@@ -610,2 +609,7 @@ file.lastDir = function() { | ||
/** | ||
* Path "endings" | ||
*/ | ||
// The last character in a filepath. 'foo/bar/baz/' => '/' | ||
@@ -648,2 +652,12 @@ file.lastChar = function(filepath) { | ||
// Ensure that filepath has trailing slash | ||
file.slashify = function () { | ||
var filepath = path.join.apply(path, arguments); | ||
var last = _.last((filepath).split('/')); | ||
if(last.indexOf('.') === -1) { | ||
return filepath.replace(/\/$/, '') + '/'; | ||
} else { | ||
return filepath; | ||
} | ||
}; | ||
@@ -650,0 +664,0 @@ |
{ | ||
"name": "fs-utils", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"description": "File system extras and utilities to extend the Node.js fs module.", | ||
@@ -5,0 +5,0 @@ "repository": { |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Possible typosquat attack
Supply chain riskThere is a package with a similar name that is downloaded much more often.
Did you mean |
---|
tsutils |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
52907
16
1372
0
0
2