//var execsync=require('sync-exec'); var child_process=require('child_process'); var compressor=require("node-minify"),util=require("util"),fs=require("fs"),request=require('request'); var really_old=new Date(0); function replace_all(str, find, replace) { return str.replace(new RegExp(find.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g'), replace); } function cdate(time) // custom date/time format [12/06/15] { var time_str="",current=new Date(),arr=[current.getHours(),current.getMinutes(),current.getDate(),current.getMonth()+1,current.getYear()]; for(var i=0;i1000) logs=logs.slice(4,1200); storage.setItem("logs",logs); } function report_logs(storage) { logs=storage.getItem("logs"); if(!logs) logs=[]; for(var i=0;inum) return process.argv[num]; return false; } function is_production() { if(in_args("live") || in_args("production")) return " production "; return ""; } function is_sdk(){ return !is_production(); } function ch(path) { path=path.replace("~",process.env.HOME); process.chdir(path); } function read_file(path) { path=path.replace("~",process.env.HOME); return fs.readFileSync(path,{encoding:'utf-8'}); } function write_file(path,content) { path=path.replace("~",process.env.HOME); fs.writeFileSync(path,content); } function mssince(t,ref) { if(!ref) ref=new Date(); return ref.getTime() - t.getTime(); } function ssince(t,ref) { return mssince(t,ref)/1000.0; } function msince(t,ref) { return mssince(t,ref)/60000.0; } function hsince(t,ref) { return mssince(t,ref)/3600000.0; } module.exports={ util:util, format:util.format, execs:execs, execso:execso, minify_all:minify_all, is_production:is_production, is_sdk:is_sdk, ch:ch, in_args:in_args, get_arg:get_arg, read_file:read_file, write_file:write_file, color:color, ccolor:ccolor, fetch:fetch, in_between_from_file:in_between_from_file, lib_version:lib_version, mssince:mssince,ssince:ssince,msince:msince,hsince:hsince, add_log:add_log,report_logs:report_logs, really_old:really_old, download:download, string_to_int:string_to_int, cdate:cdate, sleep:sleep, replace_all:replace_all, }