@drawbridge/drawbridge-utils 0.0.73 → 0.0.74
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/dist/sanitize.cjs +2 -2
- package/dist/sanitize.d.cts +13 -4
- package/dist/sanitize.d.ts +13 -4
- package/dist/sanitize.js +2 -2
- package/package.json +1 -1
package/dist/sanitize.cjs
CHANGED
|
@@ -88,8 +88,8 @@ var sanitizeHttps = (val) => {
|
|
|
88
88
|
return value ? "https://" + value : "";
|
|
89
89
|
};
|
|
90
90
|
var sanitizeUrl = (url) => {
|
|
91
|
-
|
|
92
|
-
return (
|
|
91
|
+
if (!url) return url;
|
|
92
|
+
return sanitizeHttps(url).replace(/^https:\/\/www\./, "https://").replace(/\/$/, "");
|
|
93
93
|
};
|
|
94
94
|
var sanitizeEmail = (raw) => {
|
|
95
95
|
if (typeof raw !== "string") return {
|
package/dist/sanitize.d.cts
CHANGED
|
@@ -101,10 +101,19 @@ const sanitizeHttps = ( val ) => {
|
|
|
101
101
|
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
// Full write-path normalizer for finished urls: canonical https prefix
|
|
105
|
+
// (via sanitizeHttps — regex.url validation alone still lets a doubled
|
|
106
|
+
// https://https:// prefix through), then strip www. and any trailing slash.
|
|
107
|
+
// Keystroke-time inputs want sanitizeHttps alone — this one fights typing.
|
|
108
|
+
const sanitizeUrl = ( url ) => {
|
|
109
|
+
|
|
110
|
+
if( ! url ) return url;
|
|
111
|
+
|
|
112
|
+
return sanitizeHttps( url )
|
|
113
|
+
.replace( /^https:\/\/www\./, 'https://' )
|
|
114
|
+
.replace( /\/$/, '' );
|
|
115
|
+
|
|
116
|
+
};
|
|
108
117
|
|
|
109
118
|
// Normalize + validate an email address. Trim, lowercase, basic shape
|
|
110
119
|
// check, and reject disposable-domain providers. Returns the normalized
|
package/dist/sanitize.d.ts
CHANGED
|
@@ -101,10 +101,19 @@ const sanitizeHttps = ( val ) => {
|
|
|
101
101
|
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
// Full write-path normalizer for finished urls: canonical https prefix
|
|
105
|
+
// (via sanitizeHttps — regex.url validation alone still lets a doubled
|
|
106
|
+
// https://https:// prefix through), then strip www. and any trailing slash.
|
|
107
|
+
// Keystroke-time inputs want sanitizeHttps alone — this one fights typing.
|
|
108
|
+
const sanitizeUrl = ( url ) => {
|
|
109
|
+
|
|
110
|
+
if( ! url ) return url;
|
|
111
|
+
|
|
112
|
+
return sanitizeHttps( url )
|
|
113
|
+
.replace( /^https:\/\/www\./, 'https://' )
|
|
114
|
+
.replace( /\/$/, '' );
|
|
115
|
+
|
|
116
|
+
};
|
|
108
117
|
|
|
109
118
|
// Normalize + validate an email address. Trim, lowercase, basic shape
|
|
110
119
|
// check, and reject disposable-domain providers. Returns the normalized
|
package/dist/sanitize.js
CHANGED
|
@@ -50,8 +50,8 @@ var sanitizeHttps = (val) => {
|
|
|
50
50
|
return value ? "https://" + value : "";
|
|
51
51
|
};
|
|
52
52
|
var sanitizeUrl = (url) => {
|
|
53
|
-
|
|
54
|
-
return (
|
|
53
|
+
if (!url) return url;
|
|
54
|
+
return sanitizeHttps(url).replace(/^https:\/\/www\./, "https://").replace(/\/$/, "");
|
|
55
55
|
};
|
|
56
56
|
var sanitizeEmail = (raw) => {
|
|
57
57
|
if (typeof raw !== "string") return {
|
package/package.json
CHANGED