@dereekb/util 9.24.10 → 9.24.12
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/CHANGELOG.md +8 -0
- package/fetch/CHANGELOG.md +8 -0
- package/fetch/package.json +3 -2
- package/package.json +2 -1
- package/src/lib/string/url.d.ts +31 -1
- package/src/lib/string/url.js +32 -2
- package/src/lib/string/url.js.map +1 -1
- package/test/CHANGELOG.md +8 -0
- package/test/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [9.24.12](https://github.com/dereekb/dbx-components/compare/v9.24.11-dev...v9.24.12) (2023-07-04)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [9.24.11](https://github.com/dereekb/dbx-components/compare/v9.24.10-dev...v9.24.11) (2023-07-03)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
5
13
|
## [9.24.10](https://github.com/dereekb/dbx-components/compare/v9.24.9-dev...v9.24.10) (2023-07-02)
|
|
6
14
|
|
|
7
15
|
|
package/fetch/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [9.24.12](https://github.com/dereekb/dbx-components/compare/v9.24.11-dev...v9.24.12) (2023-07-04)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [9.24.11](https://github.com/dereekb/dbx-components/compare/v9.24.10-dev...v9.24.11) (2023-07-03)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
5
13
|
## [9.24.10](https://github.com/dereekb/dbx-components/compare/v9.24.9-dev...v9.24.10) (2023-07-02)
|
|
6
14
|
|
|
7
15
|
|
package/fetch/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/util/fetch",
|
|
3
|
-
"version": "9.24.
|
|
3
|
+
"version": "9.24.12",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"types": "./src/index.d.ts",
|
|
6
6
|
"dependencies": {},
|
|
7
7
|
"peerDependencies": {
|
|
8
|
-
"@dereekb/util": "9.24.
|
|
8
|
+
"@dereekb/util": "9.24.12",
|
|
9
9
|
"lodash.isequal": "^4.5.0",
|
|
10
10
|
"make-error": "^1.3.0",
|
|
11
11
|
"class-validator": "^0.13.2",
|
|
12
12
|
"ts-essentials": "^9.1.2",
|
|
13
13
|
"extra-set": "^2.2.11",
|
|
14
|
+
"date-fns": "^2.29.0",
|
|
14
15
|
"node-fetch": "~2.6.7",
|
|
15
16
|
"tslib": "^2.0.0"
|
|
16
17
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/util",
|
|
3
|
-
"version": "9.24.
|
|
3
|
+
"version": "9.24.12",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"class-validator": "^0.13.2",
|
|
29
29
|
"ts-essentials": "^9.1.2",
|
|
30
30
|
"extra-set": "^2.2.11",
|
|
31
|
+
"date-fns": "^2.29.0",
|
|
31
32
|
"tslib": "^2.0.0"
|
|
32
33
|
},
|
|
33
34
|
"main": "./src/index.js",
|
package/src/lib/string/url.d.ts
CHANGED
|
@@ -3,6 +3,15 @@ import { PhoneNumber } from '../contact/phone';
|
|
|
3
3
|
import { IndexRangeInput } from './../value/indexed';
|
|
4
4
|
import { MapFunction } from '../value/map';
|
|
5
5
|
import { Maybe } from '../value/maybe.type';
|
|
6
|
+
/**
|
|
7
|
+
* Connection protocol
|
|
8
|
+
*
|
|
9
|
+
* I.E. http, https, etc.
|
|
10
|
+
*/
|
|
11
|
+
export declare type WebsiteProtocol = string;
|
|
12
|
+
export declare type HttpWebsiteProtocol = 'http';
|
|
13
|
+
export declare type HttpsWebsiteProtocol = 'https';
|
|
14
|
+
export declare type KnownHttpWebsiteProtocol = HttpWebsiteProtocol | HttpsWebsiteProtocol;
|
|
6
15
|
/**
|
|
7
16
|
* A website domain.
|
|
8
17
|
*
|
|
@@ -133,8 +142,29 @@ export interface WebsiteDomainAndPathPair {
|
|
|
133
142
|
}
|
|
134
143
|
export declare function websiteDomainAndPathPair(input: WebsiteDomainAndPath): WebsiteDomainAndPathPair;
|
|
135
144
|
export declare const HTTP_OR_HTTPS_REGEX: RegExp;
|
|
145
|
+
export declare const WEB_PROTOCOL_PREFIX_REGEX: RegExp;
|
|
146
|
+
/**
|
|
147
|
+
* Removes any existing protocol and sets the protocol to match the input.
|
|
148
|
+
*
|
|
149
|
+
* @param url
|
|
150
|
+
* @param protocol
|
|
151
|
+
*/
|
|
152
|
+
export declare function setWebProtocolPrefix(input: string, protocol: WebsiteProtocol): string;
|
|
153
|
+
/**
|
|
154
|
+
* Removes any existing protocol prefix from the input.
|
|
155
|
+
*
|
|
156
|
+
* @param input
|
|
157
|
+
*/
|
|
158
|
+
export declare function removeWebProtocolPrefix(input: string): string;
|
|
159
|
+
/**
|
|
160
|
+
* Adds both https:// to the url.
|
|
161
|
+
*
|
|
162
|
+
* @param url
|
|
163
|
+
* @returns
|
|
164
|
+
*/
|
|
165
|
+
export declare function addHttpToUrl(url: BaseWebsiteUrl | WebsiteDomainAndPath | string, prefix?: KnownHttpWebsiteProtocol): BaseWebsiteUrl;
|
|
136
166
|
/**
|
|
137
|
-
* Removes
|
|
167
|
+
* Removes the prefixes http:// and https:// from the url. If these protocols are not used, nothing is removed.
|
|
138
168
|
*
|
|
139
169
|
* @param url
|
|
140
170
|
* @returns
|
package/src/lib/string/url.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.telUrlString = exports.mailToUrlString = exports.hasHttpPrefix = exports.removeHttpFromUrl = exports.HTTP_OR_HTTPS_REGEX = exports.websiteDomainAndPathPair = exports.websitePathFromWebsiteDomainAndPath = exports.websiteDomainAndPathPairFromWebsiteUrl = exports.websitePathFromWebsiteUrl = exports.fixExtraQueryParameters = exports.websitePathAndQueryPair = exports.isolateWebsitePathFunction = exports.hasWebsiteDomain = exports.WEBSITE_DOMAIN_NAME_REGEX = void 0;
|
|
3
|
+
exports.telUrlString = exports.mailToUrlString = exports.hasHttpPrefix = exports.removeHttpFromUrl = exports.addHttpToUrl = exports.removeWebProtocolPrefix = exports.setWebProtocolPrefix = exports.WEB_PROTOCOL_PREFIX_REGEX = exports.HTTP_OR_HTTPS_REGEX = exports.websiteDomainAndPathPair = exports.websitePathFromWebsiteDomainAndPath = exports.websiteDomainAndPathPairFromWebsiteUrl = exports.websitePathFromWebsiteUrl = exports.fixExtraQueryParameters = exports.websitePathAndQueryPair = exports.isolateWebsitePathFunction = exports.hasWebsiteDomain = exports.WEBSITE_DOMAIN_NAME_REGEX = void 0;
|
|
4
4
|
const path_1 = require("../path/path");
|
|
5
5
|
const map_1 = require("../value/map");
|
|
6
6
|
const replace_1 = require("./replace");
|
|
@@ -137,8 +137,38 @@ function websiteDomainAndPathPair(input) {
|
|
|
137
137
|
}
|
|
138
138
|
exports.websiteDomainAndPathPair = websiteDomainAndPathPair;
|
|
139
139
|
exports.HTTP_OR_HTTPS_REGEX = /^https:\/\/|http:\/\//;
|
|
140
|
+
exports.WEB_PROTOCOL_PREFIX_REGEX = /^(.)+:\/\//;
|
|
140
141
|
/**
|
|
141
|
-
* Removes
|
|
142
|
+
* Removes any existing protocol and sets the protocol to match the input.
|
|
143
|
+
*
|
|
144
|
+
* @param url
|
|
145
|
+
* @param protocol
|
|
146
|
+
*/
|
|
147
|
+
function setWebProtocolPrefix(input, protocol) {
|
|
148
|
+
return `${protocol}://${removeWebProtocolPrefix(input)}`;
|
|
149
|
+
}
|
|
150
|
+
exports.setWebProtocolPrefix = setWebProtocolPrefix;
|
|
151
|
+
/**
|
|
152
|
+
* Removes any existing protocol prefix from the input.
|
|
153
|
+
*
|
|
154
|
+
* @param input
|
|
155
|
+
*/
|
|
156
|
+
function removeWebProtocolPrefix(input) {
|
|
157
|
+
return input.replace(exports.WEB_PROTOCOL_PREFIX_REGEX, '');
|
|
158
|
+
}
|
|
159
|
+
exports.removeWebProtocolPrefix = removeWebProtocolPrefix;
|
|
160
|
+
/**
|
|
161
|
+
* Adds both https:// to the url.
|
|
162
|
+
*
|
|
163
|
+
* @param url
|
|
164
|
+
* @returns
|
|
165
|
+
*/
|
|
166
|
+
function addHttpToUrl(url, prefix = 'https') {
|
|
167
|
+
return setWebProtocolPrefix(url, prefix);
|
|
168
|
+
}
|
|
169
|
+
exports.addHttpToUrl = addHttpToUrl;
|
|
170
|
+
/**
|
|
171
|
+
* Removes the prefixes http:// and https:// from the url. If these protocols are not used, nothing is removed.
|
|
142
172
|
*
|
|
143
173
|
* @param url
|
|
144
174
|
* @returns
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/string/url.ts"],"names":[],"mappings":";;;AAGA,uCAA4G;AAC5G,sCAAkE;AAElE,uCAA6E;AAC7E,qCAA8C;AAE9C,iCAAuF;
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/string/url.ts"],"names":[],"mappings":";;;AAGA,uCAA4G;AAC5G,sCAAkE;AAElE,uCAA6E;AAC7E,qCAA8C;AAE9C,iCAAuF;AAuBvF;;GAEG;AACU,QAAA,yBAAyB,GAAG,YAAY,CAAC;AAEtD;;;;;;;;;;;GAWG;AACH,SAAgB,gBAAgB,CAAC,KAAa;IAC5C,OAAO,iCAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC/C,CAAC;AAFD,4CAEC;AA0ED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C;AAED,YAAY;AACZ,SAAgB,YAAY,CAAC,KAAkB;IAC7C,OAAO,OAAO,KAAK,EAAE,CAAC;AACxB,CAAC;AAFD,oCAEC"}
|
package/test/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [9.24.12](https://github.com/dereekb/dbx-components/compare/v9.24.11-dev...v9.24.12) (2023-07-04)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [9.24.11](https://github.com/dereekb/dbx-components/compare/v9.24.10-dev...v9.24.11) (2023-07-03)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
5
13
|
## [9.24.10](https://github.com/dereekb/dbx-components/compare/v9.24.9-dev...v9.24.10) (2023-07-02)
|
|
6
14
|
|
|
7
15
|
|
package/test/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/util/test",
|
|
3
|
-
"version": "9.24.
|
|
3
|
+
"version": "9.24.12",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
7
7
|
"dependencies": {},
|
|
8
8
|
"peerDependencies": {
|
|
9
|
-
"@dereekb/util": "9.24.
|
|
9
|
+
"@dereekb/util": "9.24.12",
|
|
10
10
|
"lodash.isequal": "^4.5.0",
|
|
11
11
|
"make-error": "^1.3.0",
|
|
12
12
|
"class-validator": "^0.13.2",
|
|
13
13
|
"ts-essentials": "^9.1.2",
|
|
14
14
|
"extra-set": "^2.2.11",
|
|
15
|
+
"date-fns": "^2.29.0",
|
|
15
16
|
"tslib": "^2.0.0"
|
|
16
17
|
}
|
|
17
18
|
}
|