source: frontend/node_modules/tsconfig-paths/lib/filesystem.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.7 KB
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.removeExtension = exports.fileExistsAsync = exports.readJsonFromDiskAsync = exports.readJsonFromDiskSync = exports.fileExistsSync = void 0;
4var fs = require("fs");
5function fileExistsSync(path) {
6 try {
7 var stats = fs.statSync(path);
8 return stats.isFile();
9 }
10 catch (err) {
11 // If error, assume file did not exist
12 return false;
13 }
14}
15exports.fileExistsSync = fileExistsSync;
16/**
17 * Reads package.json from disk
18 * @param file Path to package.json
19 */
20// tslint:disable-next-line:no-any
21function readJsonFromDiskSync(packageJsonPath) {
22 if (!fs.existsSync(packageJsonPath)) {
23 return undefined;
24 }
25 return require(packageJsonPath);
26}
27exports.readJsonFromDiskSync = readJsonFromDiskSync;
28function readJsonFromDiskAsync(path,
29// tslint:disable-next-line:no-any
30callback) {
31 fs.readFile(path, "utf8", function (err, result) {
32 // If error, assume file did not exist
33 if (err || !result) {
34 return callback();
35 }
36 var json = JSON.parse(result);
37 return callback(undefined, json);
38 });
39}
40exports.readJsonFromDiskAsync = readJsonFromDiskAsync;
41function fileExistsAsync(path2, callback2) {
42 fs.stat(path2, function (err, stats) {
43 if (err) {
44 // If error assume file does not exist
45 return callback2(undefined, false);
46 }
47 callback2(undefined, stats ? stats.isFile() : false);
48 });
49}
50exports.fileExistsAsync = fileExistsAsync;
51function removeExtension(path) {
52 return path.substring(0, path.lastIndexOf(".")) || path;
53}
54exports.removeExtension = removeExtension;
55//# sourceMappingURL=filesystem.js.map
Note: See TracBrowser for help on using the repository browser.