@universal-packages/fs-utils
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "@universal-packages/fs-utils", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Extended functionality for fs", | ||
@@ -13,3 +13,4 @@ "author": "David De Anda <david@universal-packages.com> (https://github.com/universal-packages)", | ||
"test": "jest --watch", | ||
"test:full": "jest --coverage --verbose" | ||
"test:full": "jest --coverage --verbose", | ||
"test:clear": "jest --clearCache" | ||
}, | ||
@@ -16,0 +17,0 @@ "dependencies": {}, |
@@ -15,4 +15,6 @@ # fs Utils | ||
## checkDirectory() | ||
## Global methods | ||
#### **`checkDirectory(location: String)`** | ||
Checks if a string is a valid path to a directory and expands it. | ||
@@ -45,3 +47,3 @@ | ||
## checkFile() | ||
#### **`checkFile(location: String)`** | ||
@@ -75,3 +77,3 @@ Checks if a string is a valid path to a file and expands it. | ||
## ensureDirectory() | ||
#### **`ensureDirectory(location: String)`** | ||
@@ -104,5 +106,5 @@ Checks and expand a path and tries to create the directory if the check fails. | ||
## ensureFile() | ||
#### **`ensureFile(location: String)`** | ||
Checks and expand a path and tries to create an empty file if the check fails | ||
Checks and expand a path and tries to create an empty file if the check fails | ||
@@ -133,3 +135,3 @@ ```js | ||
## expandPath() | ||
#### **`expandPath(location: String)`** | ||
@@ -153,3 +155,3 @@ Tries to expand a path by resolving the tilde and resolving to an absolute path. | ||
The development of this library in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving this library. | ||
The development of this library happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving this library. | ||
@@ -156,0 +158,0 @@ - [Code of Conduct](./CODE_OF_CONDUCT.md) |
@@ -44,3 +44,3 @@ "use strict"; | ||
catch { | ||
throw new Error(`Directory "${finalLocation}" is an invalid path or greater permisons are reaquired`); | ||
throw new Error(`Directory "${finalLocation}" is an invalid path or greater permissions are reacquired`); | ||
} | ||
@@ -58,3 +58,3 @@ } | ||
catch { | ||
throw new Error(`File location "${finalLocation}" is an invalid path or greater permisons are reaquired`); | ||
throw new Error(`File location "${finalLocation}" is an invalid path or greater permissions are reacquired`); | ||
} | ||
@@ -66,6 +66,6 @@ return finalLocation; | ||
function expandPath(location) { | ||
const expanded = !exports.IS_WINDOWS && exports.HOME_DIR ? location.replace(/^~(?=$|\/|\\)/, exports.HOME_DIR) : location; | ||
return path_1.default.resolve(expanded); | ||
const expanded = location && !exports.IS_WINDOWS && exports.HOME_DIR ? location.replace(/^~(?=$|\/|\\)/, exports.HOME_DIR) : location; | ||
return expanded ? path_1.default.resolve(expanded) : expanded; | ||
} | ||
exports.expandPath = expandPath; | ||
//# sourceMappingURL=utils.js.map |
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
12885
9
158