best-globals 1.1.2 → 1.1.4
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/best-globals.d.ts +9 -0
- package/best-globals.js +15 -3
- package/package.json +8 -8
package/best-globals.d.ts
CHANGED
|
@@ -59,6 +59,13 @@ declare module "best-globals"{
|
|
|
59
59
|
toYmdHmsM():string
|
|
60
60
|
toYmdHmsMm():string
|
|
61
61
|
}
|
|
62
|
+
interface TimePack{
|
|
63
|
+
ms :number
|
|
64
|
+
seconds:number
|
|
65
|
+
minutes:number
|
|
66
|
+
hours :number
|
|
67
|
+
days :number
|
|
68
|
+
}
|
|
62
69
|
class DateTime implements DateMethods{
|
|
63
70
|
toPlainString():string
|
|
64
71
|
toLocaleString():string
|
|
@@ -107,6 +114,7 @@ declare module "best-globals"{
|
|
|
107
114
|
function iso(IsoString:string):TimeInterval
|
|
108
115
|
function iso(IsoString:string|null, opts:TimeOpts):TimeInterval|null
|
|
109
116
|
}
|
|
117
|
+
function timeInterval(timePack:TimePack):TimeInterval
|
|
110
118
|
function functionName(f:Function):string
|
|
111
119
|
function constructorName<T extends {}>(o:T):string
|
|
112
120
|
function escapeRegExp(regExpString:string):string // minimalistic
|
|
@@ -125,6 +133,7 @@ declare module "best-globals"{
|
|
|
125
133
|
function simplifyText(text:string):string
|
|
126
134
|
function hyperSimplifyText(text:string, spaceReplacer?:string):string
|
|
127
135
|
var simplifiedLetters:Record<string,string>
|
|
136
|
+
function splitRawRowIntoRow(text:string):string[]
|
|
128
137
|
}
|
|
129
138
|
export = bestGlobals
|
|
130
139
|
}
|
package/best-globals.js
CHANGED
|
@@ -493,11 +493,14 @@ bestGlobals.Datetime.prototype.toPlainString = function toPlainString(preserveHm
|
|
|
493
493
|
}
|
|
494
494
|
// bestGlobals.Datetime.prototype.toUTCString = function toUTCString(){ return this.iso; }
|
|
495
495
|
|
|
496
|
-
bestGlobals.Datetime.prototype.
|
|
496
|
+
bestGlobals.Datetime.prototype.toSqlString = function toSqlString(){
|
|
497
497
|
return this.toPlainString();
|
|
498
498
|
}
|
|
499
499
|
|
|
500
|
-
bestGlobals.Datetime.prototype.
|
|
500
|
+
bestGlobals.Datetime.prototype.toPostgres = bestGlobals.Datetime.prototype.toSqlString;
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
bestGlobals.Datetime.prototype.toLocaleString = function toSqlString(){
|
|
501
504
|
var str=this.toDmy()+' '+this.toHms();
|
|
502
505
|
var prune = function(what){
|
|
503
506
|
if(str.substr(str.length-what.length)==what){
|
|
@@ -692,10 +695,12 @@ bestGlobals.TimeInterval.prototype.toHmsOrMs = function toHmsOrMs(){
|
|
|
692
695
|
return this.toHms(false,false,false,true,true);
|
|
693
696
|
}
|
|
694
697
|
|
|
695
|
-
bestGlobals.TimeInterval.prototype.
|
|
698
|
+
bestGlobals.TimeInterval.prototype.toSqlString = function toSqlString(){
|
|
696
699
|
return this.timeInterval.ms+'ms';
|
|
697
700
|
}
|
|
698
701
|
|
|
702
|
+
bestGlobals.TimeInterval.prototype.toPostgres = bestGlobals.TimeInterval.prototype.toSqlString;
|
|
703
|
+
|
|
699
704
|
bestGlobals.timeInterval = function timeInterval(timePack) {
|
|
700
705
|
return new bestGlobals.TimeInterval(timePack);
|
|
701
706
|
};
|
|
@@ -1123,6 +1128,13 @@ bestGlobals.simplifyText = function simplifyText(text){
|
|
|
1123
1128
|
bestGlobals.hyperSimplifyText = function hyperSimplifyText(text, spaceReplacer){
|
|
1124
1129
|
return text.replace(/[^A-Za-z0-9\[\] ]/g,function(a){return bestGlobals.simplifiedChars[a]||' '}).trim().replace(/\s+/g,spaceReplacer==undefined?' ':spaceReplacer).toLowerCase();
|
|
1125
1130
|
}
|
|
1131
|
+
bestGlobals.splitRawRowIntoRow = function splitRawRowIntoRow(line){
|
|
1132
|
+
return line.split(/(?<!(?:^|[^\\])(?:\\\\)*\\)\|/).map(item => item.trimRight().replace(
|
|
1133
|
+
/\\([^x]|x[\dA-Za-z]{1,2})/g,
|
|
1134
|
+
(_,l)=>(l=='t'?'\t':l=='r'?'\r':l=='n'?'\n':l=='s'?' ':l[0]=='x'?String.fromCodePoint(parseInt(l.substr(1),16)):l)
|
|
1135
|
+
))
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1126
1138
|
|
|
1127
1139
|
return bestGlobals;
|
|
1128
1140
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "best-globals",
|
|
3
3
|
"description": "common global function and constants - i.e. changes",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.4",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "codenautas/best-globals",
|
|
@@ -20,19 +20,19 @@
|
|
|
20
20
|
"colors": "~1.4.0",
|
|
21
21
|
"cookie-parser": "^1.4.6",
|
|
22
22
|
"expect.js": "~0.3.1",
|
|
23
|
-
"express": "^4.
|
|
24
|
-
"express-session": "^1.
|
|
25
|
-
"karma": "^6.4.
|
|
23
|
+
"express": "^4.19.2",
|
|
24
|
+
"express-session": "^1.18.0",
|
|
25
|
+
"karma": "^6.4.3",
|
|
26
26
|
"karma-chrome-launcher": "^3.2.0",
|
|
27
|
-
"karma-coverage": "^2.2.
|
|
27
|
+
"karma-coverage": "^2.2.1",
|
|
28
28
|
"karma-coverage-html-index-reporter": "^1.0.2",
|
|
29
29
|
"karma-expect": "^1.1.3",
|
|
30
|
-
"karma-firefox-launcher": "^2.1.
|
|
30
|
+
"karma-firefox-launcher": "^2.1.3",
|
|
31
31
|
"karma-mocha": "^2.0.1",
|
|
32
32
|
"nyc": "~15.1.0",
|
|
33
|
-
"mocha": "~10.
|
|
33
|
+
"mocha": "~10.4.0",
|
|
34
34
|
"require-bro": "^0.3.1",
|
|
35
|
-
"sinon": "~
|
|
35
|
+
"sinon": "~17.0.1",
|
|
36
36
|
"audit-copy": "~0.1.0",
|
|
37
37
|
"discrepances": "~0.2.8"
|
|
38
38
|
},
|