 if process?.env?.SMC_TEST
     # in test mode we *do* want exception to get thrown below when type checks fails
     TEST_MODE = true
+
+exports.RUNNING_IN_NODE = process?.title == 'node'
 
 # startswith(s, x) is true if s starts with the string x or any of the strings in x.
 exports.startswith = (s, x) ->

exports.weeks_before        = (d, tm)  -> exports.days_before(7*d, tm)
exports.months_before       = (d, tm)  -> exports.days_before(30.5*d, tm)

# Round the given number to 1 decimal place
exports.round1 = round1 = (num) ->
    Math.round(num * 10) / 10

        return ""

exports.emoticons = exports.to_human_list(exports.smiley_strings())

smc_logger_timestamp = smc_logger_timestamp_last = smc_start_time = new Date().getTime() / 1000.0

exports.log = (msg) ->
    smc_logger_timestamp = new Date().getTime() / 1000.0
    t  = seconds2hms(smc_logger_timestamp - smc_start_time)
    dt = seconds2hms(smc_logger_timestamp - smc_logger_timestamp_last)
    console.log_original("[#{t} Δ #{dt}] #{msg}")
    smc_logger_timestamp_last = smc_logger_timestamp

window.console.log_original = window.console.log
window.console.log = exports.log
