Last change
on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
900 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
---|
| 4 | value: true
|
---|
| 5 | });
|
---|
| 6 | exports.getDirectory = getDirectory;
|
---|
| 7 | exports.getDirectorySync = getDirectorySync;
|
---|
| 8 |
|
---|
| 9 | var _path = _interopRequireDefault(require("path"));
|
---|
| 10 |
|
---|
| 11 | var _pathType = require("path-type");
|
---|
| 12 |
|
---|
| 13 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
---|
| 14 |
|
---|
| 15 | async function getDirectory(filepath) {
|
---|
| 16 | const filePathIsDirectory = await (0, _pathType.isDirectory)(filepath);
|
---|
| 17 |
|
---|
| 18 | if (filePathIsDirectory === true) {
|
---|
| 19 | return filepath;
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | const directory = _path.default.dirname(filepath);
|
---|
| 23 |
|
---|
| 24 | return directory;
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | function getDirectorySync(filepath) {
|
---|
| 28 | const filePathIsDirectory = (0, _pathType.isDirectorySync)(filepath);
|
---|
| 29 |
|
---|
| 30 | if (filePathIsDirectory === true) {
|
---|
| 31 | return filepath;
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | const directory = _path.default.dirname(filepath);
|
---|
| 35 |
|
---|
| 36 | return directory;
|
---|
| 37 | }
|
---|
| 38 | //# sourceMappingURL=getDirectory.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.