@adviser/cement 0.2.33 → 0.2.34

Sign up to get free protection for your applications and to get access to all the features.
package/index.cjs CHANGED
@@ -1325,15 +1325,17 @@ var BuildURI = class _BuildURI {
1325
1325
  // return this;
1326
1326
  // }
1327
1327
  appendRelative(p) {
1328
- const url = URI.from(p);
1329
- let pathname = url.pathname;
1330
- if (url.pathname === "/") {
1331
- pathname = "";
1332
- } else if (!pathname.startsWith("/")) {
1333
- pathname = `/${pathname}`;
1334
- }
1335
- this.pathname(this._url.pathname + pathname);
1336
- for (const [key, value] of url.getParams) {
1328
+ const appendUrl = URI.from(p);
1329
+ let pathname = appendUrl.pathname;
1330
+ let basePath = this._url.pathname;
1331
+ if (pathname.startsWith("/")) {
1332
+ pathname = pathname.replace(/^\//, "");
1333
+ }
1334
+ if (basePath.length > 0) {
1335
+ basePath = basePath.replace(/\/$/, "");
1336
+ }
1337
+ this.pathname(basePath + "/" + pathname);
1338
+ for (const [key, value] of appendUrl.getParams) {
1337
1339
  this.setParam(key, value);
1338
1340
  }
1339
1341
  return this;
@@ -1371,6 +1373,9 @@ var BuildURI = class _BuildURI {
1371
1373
  toJSON() {
1372
1374
  return this.toString();
1373
1375
  }
1376
+ asURL() {
1377
+ return this.URI().asURL();
1378
+ }
1374
1379
  asObj(...strips) {
1375
1380
  return this.URI().asObj(...strips);
1376
1381
  }