@naturalcycles/js-lib 14.117.0 → 14.118.0

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.
Files changed (62) hide show
  1. package/dist/array/array.util.js +4 -4
  2. package/dist/datetime/dateInterval.js +1 -0
  3. package/dist/datetime/localDate.js +2 -0
  4. package/dist/datetime/localTime.js +2 -3
  5. package/dist/datetime/timeInterval.js +1 -0
  6. package/dist/decorators/asyncMemo.decorator.d.ts +2 -2
  7. package/dist/decorators/createPromiseDecorator.d.ts +6 -6
  8. package/dist/decorators/logMethod.decorator.js +4 -5
  9. package/dist/decorators/memo.decorator.d.ts +2 -2
  10. package/dist/error/tryCatch.d.ts +1 -1
  11. package/dist/http/fetcher.d.ts +146 -0
  12. package/dist/http/fetcher.js +298 -0
  13. package/dist/http/http.model.d.ts +2 -0
  14. package/dist/http/http.model.js +2 -0
  15. package/dist/index.d.ts +2 -0
  16. package/dist/index.js +2 -0
  17. package/dist/object/deepEquals.js +1 -0
  18. package/dist/object/object.util.js +8 -10
  19. package/dist/promise/pRetry.d.ts +1 -1
  20. package/dist/promise/pTimeout.d.ts +1 -1
  21. package/dist/string/pupa.d.ts +2 -2
  22. package/dist/string/readingTime.d.ts +1 -1
  23. package/dist/string/safeJsonStringify.js +5 -7
  24. package/dist/string/stringifyAny.js +2 -1
  25. package/dist/string/url.util.js +1 -1
  26. package/dist-esm/array/array.util.js +4 -4
  27. package/dist-esm/datetime/dateInterval.js +1 -0
  28. package/dist-esm/datetime/localDate.js +2 -0
  29. package/dist-esm/datetime/localTime.js +2 -3
  30. package/dist-esm/datetime/timeInterval.js +1 -0
  31. package/dist-esm/decorators/logMethod.decorator.js +4 -5
  32. package/dist-esm/http/fetcher.js +251 -0
  33. package/dist-esm/http/http.model.js +1 -0
  34. package/dist-esm/index.js +2 -0
  35. package/dist-esm/object/deepEquals.js +1 -0
  36. package/dist-esm/object/object.util.js +8 -10
  37. package/dist-esm/string/safeJsonStringify.js +5 -7
  38. package/dist-esm/string/stringifyAny.js +2 -1
  39. package/dist-esm/string/url.util.js +1 -1
  40. package/package.json +1 -1
  41. package/src/array/array.util.ts +4 -4
  42. package/src/datetime/dateInterval.ts +1 -0
  43. package/src/datetime/localDate.ts +2 -0
  44. package/src/datetime/localTime.ts +2 -2
  45. package/src/datetime/timeInterval.ts +1 -0
  46. package/src/decorators/asyncMemo.decorator.ts +2 -2
  47. package/src/decorators/createPromiseDecorator.ts +4 -4
  48. package/src/decorators/logMethod.decorator.ts +4 -4
  49. package/src/decorators/memo.decorator.ts +2 -2
  50. package/src/error/tryCatch.ts +1 -1
  51. package/src/http/fetcher.ts +469 -0
  52. package/src/http/http.model.ts +3 -0
  53. package/src/index.ts +2 -0
  54. package/src/object/deepEquals.ts +1 -0
  55. package/src/object/object.util.ts +7 -8
  56. package/src/promise/pRetry.ts +1 -1
  57. package/src/promise/pTimeout.ts +1 -1
  58. package/src/string/pupa.ts +1 -1
  59. package/src/string/readingTime.ts +1 -1
  60. package/src/string/safeJsonStringify.ts +3 -5
  61. package/src/string/stringifyAny.ts +3 -1
  62. package/src/string/url.util.ts +1 -1
@@ -26,11 +26,9 @@ function serializer(replacer?: Reviver, cycleReplacer?: Reviver): Reviver {
26
26
  const stack: any[] = []
27
27
  const keys: string[] = []
28
28
 
29
- if (cycleReplacer == null) {
30
- cycleReplacer = function (key, value) {
31
- if (stack[0] === value) return '[Circular ~]'
32
- return '[Circular ~.' + keys.slice(0, stack.indexOf(value)).join('.') + ']'
33
- }
29
+ cycleReplacer ??= function (key, value) {
30
+ if (stack[0] === value) return '[Circular ~]'
31
+ return '[Circular ~.' + keys.slice(0, stack.indexOf(value)).join('.') + ']'
34
32
  }
35
33
 
36
34
  return function (key, value) {
@@ -89,7 +89,9 @@ export function _stringifyAny(obj: any, opt: StringifyAnyOptions = {}): string {
89
89
  // This is to fix the rare error (happened with Got) where `err.message` was changed,
90
90
  // but err.stack had "old" err.message
91
91
  // This should "fix" that
92
- s = [s, ...obj.stack.split('\n').slice(1)].join('\n')
92
+ const sLines = s.split('\n').length
93
+
94
+ s = [s, ...obj.stack.split('\n').slice(sLines)].join('\n')
93
95
  }
94
96
 
95
97
  if (_isErrorObject(obj)) {
@@ -16,7 +16,7 @@ import type { StringMap } from '../types'
16
16
  export function _parseQueryString(search: string): StringMap {
17
17
  const qs: StringMap = {}
18
18
  search
19
- .slice(search[0] === '?' ? 1 : 0)
19
+ .slice(search.startsWith('?') ? 1 : 0)
20
20
  .split('&')
21
21
  .forEach(p => {
22
22
  const [k, v] = p.split('=')