puvox-library 1.0.73 → 1.0.75
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 -16
- package/package.json +1 -1
package/library_standard.js
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
*/
|
17
17
|
|
18
18
|
class PuvoxLibrary {
|
19
|
-
|
19
|
+
selfMain = this;
|
20
20
|
|
21
21
|
// ########## ARRAY ########## //
|
22
22
|
arrayValue(obj_arr, key, default_){
|
@@ -89,7 +89,7 @@ class PuvoxLibrary {
|
|
89
89
|
return source.filter(x => comparedTo.includes(x));
|
90
90
|
}
|
91
91
|
arrayDiffFull(o1,o2) {
|
92
|
-
const
|
92
|
+
const selfFunc = this;
|
93
93
|
const typeObject = function(o){
|
94
94
|
return typeof o === 'object';
|
95
95
|
};
|
@@ -113,7 +113,7 @@ class PuvoxLibrary {
|
|
113
113
|
else if (Object.is(o1, o2)) {
|
114
114
|
return undefined;
|
115
115
|
} else if (bothAreArrays(o1,o2)){
|
116
|
-
return
|
116
|
+
return selfFunc.arrayDiff(o1,o2);
|
117
117
|
}
|
118
118
|
const keys = Object.keys(o2);
|
119
119
|
for (let i=0; i<keys.length; i++) {
|
@@ -873,7 +873,10 @@ class PuvoxLibrary {
|
|
873
873
|
|
874
874
|
|
875
875
|
datetime = new (class{
|
876
|
-
MAIN_CLASS =
|
876
|
+
MAIN_CLASS = null;
|
877
|
+
constructor(mainclass){
|
878
|
+
this.MAIN_CLASS = mainclass;
|
879
|
+
}
|
877
880
|
// 0940 type time-ints
|
878
881
|
isBetweenHMS(target, start, end, equality) { } // datetime, int/datetime, int/datetime, bool
|
879
882
|
equalDays(d1,d2) {
|
@@ -1075,7 +1078,7 @@ class PuvoxLibrary {
|
|
1075
1078
|
}
|
1076
1079
|
return Math.floor((d2 - d1) / _MS_PER_DAY);
|
1077
1080
|
}
|
1078
|
-
})();
|
1081
|
+
})(this);
|
1079
1082
|
// ####### END OF DATETIME FUNCTIONS ####### //
|
1080
1083
|
|
1081
1084
|
|
@@ -1174,7 +1177,7 @@ class PuvoxLibrary {
|
|
1174
1177
|
return prom;
|
1175
1178
|
}
|
1176
1179
|
async linesAmountInFile(filePath, delimiterN = true) {
|
1177
|
-
const
|
1180
|
+
const selfFunc = this;
|
1178
1181
|
// calblack format: callback(linesArray, isLastChunk)
|
1179
1182
|
let resolver = null;
|
1180
1183
|
let rejector = null;
|
@@ -1186,7 +1189,7 @@ class PuvoxLibrary {
|
|
1186
1189
|
let linesAmount = 0;
|
1187
1190
|
readStream.on('data', async function(chunk) {
|
1188
1191
|
const ch = chunk + '';
|
1189
|
-
const curLenth =
|
1192
|
+
const curLenth = selfFunc.occurences_amount(ch, '\n');
|
1190
1193
|
linesAmount = linesAmount + curLenth;
|
1191
1194
|
});
|
1192
1195
|
readStream.on('end', async function() {
|
@@ -2867,8 +2870,11 @@ class PuvoxLibrary {
|
|
2867
2870
|
|
2868
2871
|
|
2869
2872
|
// ######## Cookies: https://github.com/ttodua/useful-javascript/blob/master/cookies-library.js ######## //
|
2870
|
-
Cookies = new (class{
|
2871
|
-
MAIN_CLASS =
|
2873
|
+
Cookies = new (class{
|
2874
|
+
MAIN_CLASS = null;
|
2875
|
+
constructor(mainclass){
|
2876
|
+
this.MAIN_CLASS = mainclass;
|
2877
|
+
}
|
2872
2878
|
get(a,b) { return this.cookies_instance().get(a,b); }
|
2873
2879
|
set(a,b,c) { return this.cookies_instance().set(a,b); }
|
2874
2880
|
remove(a, b) {return this.cookies_instance().remove(a,b); }
|
@@ -2934,11 +2940,14 @@ class PuvoxLibrary {
|
|
2934
2940
|
cookies_inited= null;
|
2935
2941
|
// https://cdn.jsdelivr.net/npm/js-cookie@rc/dist/js.cookie.min.js
|
2936
2942
|
cookies = function(){"use strict";function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var t={read:function(e){return e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};return function n(r,o){function i(t,n,i){if("undefined"!=typeof document){"number"==typeof(i=e({},o,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),n=r.write(n,t);var c="";for(var u in i)i[u]&&(c+="; "+u,!0!==i[u]&&(c+="="+i[u].split(";")[0]));return document.cookie=t+"="+n+c}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],o={},i=0;i<n.length;i++){var c=n[i].split("="),u=c.slice(1).join("=");'"'===u[0]&&(u=u.slice(1,-1));try{var f=t.read(c[0]);if(o[f]=r.read(u,f),e===f)break}catch(e){}}return e?o[e]:o}},remove:function(t,n){i(t,"",e({},n,{expires:-1}))},withAttributes:function(t){return n(this.converter,e({},this.attributes,t))},withConverter:function(t){return n(e({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(r)}})}(t,{path:"/"})}
|
2937
|
-
})();
|
2943
|
+
})(this);
|
2938
2944
|
|
2939
2945
|
|
2940
2946
|
cache = new (class{
|
2941
|
-
MAIN_CLASS =
|
2947
|
+
MAIN_CLASS = null;
|
2948
|
+
constructor(mainclass){
|
2949
|
+
this.MAIN_CLASS = mainclass;
|
2950
|
+
}
|
2942
2951
|
helper_read(groupName, storageType, expireSeconds = 0){
|
2943
2952
|
const appName = this.MAIN_CLASS.getAppName();
|
2944
2953
|
if (storageType === 'file'){
|
@@ -3040,7 +3049,10 @@ class PuvoxLibrary {
|
|
3040
3049
|
|
3041
3050
|
|
3042
3051
|
file = new (class {
|
3043
|
-
MAIN_CLASS =
|
3052
|
+
MAIN_CLASS = null;
|
3053
|
+
constructor(mainclass){
|
3054
|
+
this.MAIN_CLASS = mainclass;
|
3055
|
+
}
|
3044
3056
|
// ########## CACHE DIRS (server-side JS) ##########
|
3045
3057
|
customCacheDir = null;
|
3046
3058
|
get_dir(){
|
@@ -3161,8 +3173,8 @@ class PuvoxLibrary {
|
|
3161
3173
|
}
|
3162
3174
|
return false;
|
3163
3175
|
}
|
3164
|
-
})();
|
3165
|
-
})();
|
3176
|
+
})(this.MAIN_CLASS);
|
3177
|
+
})(this);
|
3166
3178
|
|
3167
3179
|
// ################################################
|
3168
3180
|
// for node packs:_fs_instance :null,
|
@@ -3176,7 +3188,10 @@ class PuvoxLibrary {
|
|
3176
3188
|
// }
|
3177
3189
|
// },
|
3178
3190
|
file = new (class {
|
3179
|
-
MAIN_CLASS =
|
3191
|
+
MAIN_CLASS = null;
|
3192
|
+
constructor(mainclass){
|
3193
|
+
this.MAIN_CLASS = mainclass;
|
3194
|
+
}
|
3180
3195
|
// support for several native modules
|
3181
3196
|
set_module(module) {
|
3182
3197
|
// 'fs'
|
@@ -3257,7 +3272,7 @@ class PuvoxLibrary {
|
|
3257
3272
|
});
|
3258
3273
|
return filesList;
|
3259
3274
|
}
|
3260
|
-
})();
|
3275
|
+
})(this);
|
3261
3276
|
|
3262
3277
|
catchUnhandledExceptions (callback) {
|
3263
3278
|
process.on('uncaughtException', (e) => { callback(e, "exc-uncaught"); });
|