source: trip-planner-front/node_modules/memfs/lib/process.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1"use strict";
2// Here we mock the global `process` variable in case we are not in Node's environment.
3Object.defineProperty(exports, "__esModule", { value: true });
4exports.createProcess = void 0;
5/**
6 * Looks to return a `process` object, if one is available.
7 *
8 * The global `process` is returned if defined;
9 * otherwise `require('process')` is attempted.
10 *
11 * If that fails, `undefined` is returned.
12 *
13 * @return {IProcess | undefined}
14 */
15var maybeReturnProcess = function () {
16 if (typeof process !== 'undefined') {
17 return process;
18 }
19 try {
20 return require('process');
21 }
22 catch (_a) {
23 return undefined;
24 }
25};
26function createProcess() {
27 var p = maybeReturnProcess() || {};
28 if (!p.getuid)
29 p.getuid = function () { return 0; };
30 if (!p.getgid)
31 p.getgid = function () { return 0; };
32 if (!p.cwd)
33 p.cwd = function () { return '/'; };
34 if (!p.nextTick)
35 p.nextTick = require('./setImmediate').default;
36 if (!p.emitWarning)
37 p.emitWarning = function (message, type) {
38 // tslint:disable-next-line:no-console
39 console.warn("" + type + (type ? ': ' : '') + message);
40 };
41 if (!p.env)
42 p.env = {};
43 return p;
44}
45exports.createProcess = createProcess;
46exports.default = createProcess();
Note: See TracBrowser for help on using the repository browser.