ctx-core 5.36.2 → 5.36.3

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.
@@ -9,16 +9,14 @@ export function url__join(...url_segment_a) {
9
9
  for (let url_segment of url_segment_a.flat(Infinity)) {
10
10
  let url_segment_str = '' + url_segment
11
11
  url += (
12
- ~[
13
- '/',
14
- '?',
15
- '&'
16
- ].indexOf(url_segment_str[0])
17
- || (!url && url_segment_str.includes('://'))
18
- ? url_segment_str
19
- : in_query
20
- ? '&' + url_segment_str
21
- : '/' + url_segment_str
12
+ url_segment_str[0] === '/' && url.slice(-1) === '/'
13
+ ? url_segment_str.slice(1)
14
+ : ~['/', '?', '&'].indexOf(url_segment_str[0])
15
+ || (!url && url_segment_str.includes('://'))
16
+ ? url_segment_str
17
+ : in_query
18
+ ? '&' + url_segment_str
19
+ : '/' + url_segment_str
22
20
  )
23
21
  if (url_segment_str.includes('?')) in_query = 1
24
22
  }
@@ -23,5 +23,8 @@ test('url__join', ()=>{
23
23
  equal(
24
24
  url__join(['http://localhost/foo/bar/baz?id=1', [['something=else']]]),
25
25
  'http://localhost/foo/bar/baz?id=1&something=else')
26
+ equal(
27
+ url__join(['http://localhost/', '/foo/bar/baz?id=1', 'something=else']),
28
+ 'http://localhost/foo/bar/baz?id=1&something=else')
26
29
  })
27
30
  test.run()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ctx-core",
3
- "version": "5.36.2",
3
+ "version": "5.36.3",
4
4
  "description": "ctx-core core library",
5
5
  "keywords": [
6
6
  "ctx-core",