puvox-library 1.0.25 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/library_standard.js +31 -24
 - package/package.json +1 -1
 
    
        package/library_standard.js
    CHANGED
    
    | 
         @@ -1969,16 +1969,16 @@ const puvox_library = 
     | 
|
| 
       1969 
1969 
     | 
    
         
             
            	parsePOST(request, callback)
         
     | 
| 
       1970 
1970 
     | 
    
         
             
            	{
         
     | 
| 
       1971 
1971 
     | 
    
         
             
            		if (request.method == 'POST') {
         
     | 
| 
       1972 
     | 
    
         
            -
            			let name='querystring' 
     | 
| 
       1973 
     | 
    
         
            -
            			var qs = require(name);
         
     | 
| 
       1974 
     | 
    
         
            -
            			let stringData = '';
         
     | 
| 
       1975 
     | 
    
         
            -
            			request.on('data', function (data) {
         
     | 
| 
       1976 
     | 
    
         
            -
             
     | 
| 
       1977 
     | 
    
         
            -
             
     | 
| 
       1978 
     | 
    
         
            -
             
     | 
| 
       1979 
     | 
    
         
            -
             
     | 
| 
       1980 
     | 
    
         
            -
            			});
         
     | 
| 
       1981 
     | 
    
         
            -
            			request.on('end', function(){ callback(qs.parse(stringData)); } );
         
     | 
| 
      
 1972 
     | 
    
         
            +
            			// let name='querystring';// deprecated by URLSearchParams 
         
     | 
| 
      
 1973 
     | 
    
         
            +
            			// var qs = require(name);  
         
     | 
| 
      
 1974 
     | 
    
         
            +
            			// let stringData = '';
         
     | 
| 
      
 1975 
     | 
    
         
            +
            			// request.on('data', function (data) {
         
     | 
| 
      
 1976 
     | 
    
         
            +
            			// 	stringData += data;
         
     | 
| 
      
 1977 
     | 
    
         
            +
            			// 	// Too much POST data, kill the connection!   1e6 === 1 * Math.pow(10, 6) === 1 * 1000000 ~~~ 1MB
         
     | 
| 
      
 1978 
     | 
    
         
            +
            			// 	if (stringData.length > 1e6)
         
     | 
| 
      
 1979 
     | 
    
         
            +
            			// 		request.connection.destroy();
         
     | 
| 
      
 1980 
     | 
    
         
            +
            			// });
         
     | 
| 
      
 1981 
     | 
    
         
            +
            			// request.on('end', function(){ callback(qs.parse(stringData)); } );
         
     | 
| 
       1982 
1982 
     | 
    
         
             
            		}
         
     | 
| 
       1983 
1983 
     | 
    
         
             
            	},
         
     | 
| 
       1984 
1984 
     | 
    
         | 
| 
         @@ -2417,6 +2417,14 @@ const puvox_library = 
     | 
|
| 
       2417 
2417 
     | 
    
         
             
            		else if (operator === '<=') return a <= b;
         
     | 
| 
       2418 
2418 
     | 
    
         
             
            		else throw "Unknown operator";
         
     | 
| 
       2419 
2419 
     | 
    
         
             
            	},
         
     | 
| 
      
 2420 
     | 
    
         
            +
            	calculate(a, b, operator) {
         
     | 
| 
      
 2421 
     | 
    
         
            +
            		if(operator === '+') return a + b;
         
     | 
| 
      
 2422 
     | 
    
         
            +
            		else if (operator === '-') return a - b;
         
     | 
| 
      
 2423 
     | 
    
         
            +
            		else if (operator === '*') return a * b;
         
     | 
| 
      
 2424 
     | 
    
         
            +
            		else if (operator === '/') return a / b;
         
     | 
| 
      
 2425 
     | 
    
         
            +
            		else if (operator === '%') return a % b;
         
     | 
| 
      
 2426 
     | 
    
         
            +
            		else throw "Unknown operator";
         
     | 
| 
      
 2427 
     | 
    
         
            +
            	},
         
     | 
| 
       2420 
2428 
     | 
    
         | 
| 
       2421 
2429 
     | 
    
         
             
            	// random NUMBER or STRINGS
         
     | 
| 
       2422 
2430 
     | 
    
         
             
            	RandomNum(maxNum)		{ return Math.floor((Math.random() * maxNum) + 1); },
         
     | 
| 
         @@ -2544,8 +2552,7 @@ const puvox_library = 
     | 
|
| 
       2544 
2552 
     | 
    
         
             
            	openUrlInBrowser(url)
         
     | 
| 
       2545 
2553 
     | 
    
         
             
            	{
         
     | 
| 
       2546 
2554 
     | 
    
         
             
            		var cmd = (process.platform == 'darwin'? `open ${url}`: process.platform == 'win32'? `start ${url}`: `xdg-open ${url}`); 
         
     | 
| 
       2547 
     | 
    
         
            -
            		 
     | 
| 
       2548 
     | 
    
         
            -
            		require(name).exec(cmd);
         
     | 
| 
      
 2555 
     | 
    
         
            +
            		require('child_process').exec(cmd);
         
     | 
| 
       2549 
2556 
     | 
    
         
             
            	},
         
     | 
| 
       2550 
2557 
     | 
    
         | 
| 
       2551 
2558 
     | 
    
         
             
            	stringify(obj_or_str){
         
     | 
| 
         @@ -2890,20 +2897,20 @@ const puvox_library = 
     | 
|
| 
       2890 
2897 
     | 
    
         | 
| 
       2891 
2898 
     | 
    
         
             
            	// ################################################
         
     | 
| 
       2892 
2899 
     | 
    
         
             
            	// for node packs:_fs_instance :null,
         
     | 
| 
       2893 
     | 
    
         
            -
            	_required_instances : {},
         
     | 
| 
       2894 
     | 
    
         
            -
            	modules(name){
         
     | 
| 
       2895 
     | 
    
         
            -
             
     | 
| 
       2896 
     | 
    
         
            -
             
     | 
| 
       2897 
     | 
    
         
            -
             
     | 
| 
       2898 
     | 
    
         
            -
             
     | 
| 
       2899 
     | 
    
         
            -
             
     | 
| 
       2900 
     | 
    
         
            -
             
     | 
| 
       2901 
     | 
    
         
            -
            	}, 
         
     | 
| 
      
 2900 
     | 
    
         
            +
            	// _required_instances : {},
         
     | 
| 
      
 2901 
     | 
    
         
            +
            	// modules(name){
         
     | 
| 
      
 2902 
     | 
    
         
            +
            	// 	if (name in this._required_instances){
         
     | 
| 
      
 2903 
     | 
    
         
            +
            	// 		return this._required_instances[name];
         
     | 
| 
      
 2904 
     | 
    
         
            +
            	// 	} else {
         
     | 
| 
      
 2905 
     | 
    
         
            +
            	// 		this._required_instances[name] = require(name);
         
     | 
| 
      
 2906 
     | 
    
         
            +
            	// 		return this._required_instances[name];
         
     | 
| 
      
 2907 
     | 
    
         
            +
            	// 	}
         
     | 
| 
      
 2908 
     | 
    
         
            +
            	// }, 
         
     | 
| 
       2902 
2909 
     | 
    
         
             
            	file: {
         
     | 
| 
       2903 
2910 
     | 
    
         
             
            		parent() {return puvox_library;},
         
     | 
| 
       2904 
     | 
    
         
            -
            		fs() {return puvox_library.modules('fs') 
     | 
| 
       2905 
     | 
    
         
            -
            		os() {return  
     | 
| 
       2906 
     | 
    
         
            -
            		path() {return  
     | 
| 
      
 2911 
     | 
    
         
            +
            		fs() {return require('fs');}, //puvox_library.modules('fs')
         
     | 
| 
      
 2912 
     | 
    
         
            +
            		os() {return require('os');},
         
     | 
| 
      
 2913 
     | 
    
         
            +
            		path() {return require('path');},
         
     | 
| 
       2907 
2914 
     | 
    
         
             
            		//
         
     | 
| 
       2908 
2915 
     | 
    
         
             
            		getTempDir(){ return this.os().tmpdir(); },
         
     | 
| 
       2909 
2916 
     | 
    
         |