mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-06 12:47:13 +02:00
+ Initial source checkin
This commit is contained in:
parent
9804c93f2e
commit
9a7e90b9b2
31 changed files with 4361 additions and 0 deletions
28
core/misc_util.js
Normal file
28
core/misc_util.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
"use strict";
|
||||
|
||||
var paths = require('path');
|
||||
|
||||
exports.isProduction = isProduction;
|
||||
exports.isDevelopment = isDevelopment;
|
||||
exports.valueWithDefault = valueWithDefault;
|
||||
exports.resolvePath = resolvePath;
|
||||
|
||||
function isProduction() {
|
||||
var env = process.env.NODE_ENV || 'dev';
|
||||
return 'production' === env;
|
||||
};
|
||||
|
||||
function isDevelopment() {
|
||||
return (!(isProduction()));
|
||||
};
|
||||
|
||||
function valueWithDefault(val, defVal) {
|
||||
return (typeof val !== 'undefined' ? val : defVal);
|
||||
};
|
||||
|
||||
function resolvePath(path) {
|
||||
if(path.substr(0, 2) === '~/') {
|
||||
path = (process.env.HOME || process.env.HOMEPATH || process.env.HOMEDIR || process.cwd()) + path.substr(1);
|
||||
}
|
||||
return paths.resolve(path);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue