@naturalcycles/js-lib 14.122.1 → 14.123.1
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/datetime/localDate.d.ts +1 -1
- package/dist/datetime/localDate.js +3 -0
- package/dist/datetime/localTime.d.ts +1 -1
- package/dist/datetime/localTime.js +3 -0
- package/dist/http/fetcher.js +2 -2
- package/dist-esm/datetime/localDate.js +3 -0
- package/dist-esm/datetime/localTime.js +3 -0
- package/dist-esm/http/fetcher.js +1 -1
- package/package.json +3 -3
- package/readme.md +1 -1
- package/src/datetime/localDate.ts +5 -1
- package/src/datetime/localTime.ts +5 -1
- package/src/http/fetcher.ts +2 -2
|
@@ -91,7 +91,7 @@ export declare class LocalDate {
|
|
|
91
91
|
unix(): UnixTimestampNumber;
|
|
92
92
|
unixMillis(): UnixTimestampMillisNumber;
|
|
93
93
|
toJSON(): IsoDateString;
|
|
94
|
-
format(fmt: LocalDateFormatter): string;
|
|
94
|
+
format(fmt: Intl.DateTimeFormat | LocalDateFormatter): string;
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
97
|
* Shortcut wrapper around `LocalDate.parse` / `LocalDate.today`
|
|
@@ -120,7 +120,7 @@ export declare class LocalTime {
|
|
|
120
120
|
toStringCompact(seconds?: boolean): string;
|
|
121
121
|
toString(): string;
|
|
122
122
|
toJSON(): UnixTimestampNumber;
|
|
123
|
-
format(fmt: LocalTimeFormatter): string;
|
|
123
|
+
format(fmt: Intl.DateTimeFormat | LocalTimeFormatter): string;
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
126
|
* Shortcut wrapper around `LocalDate.parse` / `LocalDate.today`
|
package/dist/http/fetcher.js
CHANGED
|
@@ -318,10 +318,10 @@ class Fetcher {
|
|
|
318
318
|
}
|
|
319
319
|
req.url = `${baseUrl}/${url}`;
|
|
320
320
|
}
|
|
321
|
-
const searchParams = {
|
|
321
|
+
const searchParams = (0, object_util_1._filterUndefinedValues)({
|
|
322
322
|
...this.cfg.searchParams,
|
|
323
323
|
...opt.searchParams,
|
|
324
|
-
};
|
|
324
|
+
});
|
|
325
325
|
if (Object.keys(searchParams).length) {
|
|
326
326
|
const qs = new URLSearchParams(searchParams).toString();
|
|
327
327
|
req.url += req.url.includes('?') ? '&' : '?' + qs;
|
package/dist-esm/http/fetcher.js
CHANGED
|
@@ -348,7 +348,7 @@ export class Fetcher {
|
|
|
348
348
|
}
|
|
349
349
|
req.url = `${baseUrl}/${url}`;
|
|
350
350
|
}
|
|
351
|
-
const searchParams = Object.assign(Object.assign({}, this.cfg.searchParams), opt.searchParams);
|
|
351
|
+
const searchParams = _filterUndefinedValues(Object.assign(Object.assign({}, this.cfg.searchParams), opt.searchParams));
|
|
352
352
|
if (Object.keys(searchParams).length) {
|
|
353
353
|
const qs = new URLSearchParams(searchParams).toString();
|
|
354
354
|
req.url += req.url.includes('?') ? '&' : '?' + qs;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/js-lib",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.123.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepare": "husky install",
|
|
6
6
|
"build-prod": "build-prod-esm-cjs",
|
|
7
|
-
"docs-serve": "vuepress dev docs",
|
|
8
|
-
"docs-build": "vuepress build docs"
|
|
7
|
+
"docs-serve": "NODE_OPTIONS=--openssl-legacy-provider vuepress dev docs",
|
|
8
|
+
"docs-build": "NODE_OPTIONS=--openssl-legacy-provider vuepress build docs"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"tslib": "^2.0.0"
|
package/readme.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
# Packaging
|
|
16
16
|
|
|
17
17
|
- `engines.node >= Node.js LTS`
|
|
18
|
-
- `main: dist/index.js`: commonjs,
|
|
18
|
+
- `main: dist/index.js`: commonjs, es2021 - targeting Node.js
|
|
19
19
|
- `module: dist-esm/index.js`: esm, es2017 - targeting Browsers
|
|
20
20
|
- `types: dist/index.d.ts`: typescript types
|
|
21
21
|
- `/src` folder with source `*.ts` files included
|
|
@@ -492,7 +492,11 @@ export class LocalDate {
|
|
|
492
492
|
return this.toString()
|
|
493
493
|
}
|
|
494
494
|
|
|
495
|
-
format(fmt: LocalDateFormatter): string {
|
|
495
|
+
format(fmt: Intl.DateTimeFormat | LocalDateFormatter): string {
|
|
496
|
+
if (fmt instanceof Intl.DateTimeFormat) {
|
|
497
|
+
return fmt.format(this.toDate())
|
|
498
|
+
}
|
|
499
|
+
|
|
496
500
|
return fmt(this)
|
|
497
501
|
}
|
|
498
502
|
}
|
|
@@ -590,7 +590,11 @@ export class LocalTime {
|
|
|
590
590
|
return this.unix()
|
|
591
591
|
}
|
|
592
592
|
|
|
593
|
-
format(fmt: LocalTimeFormatter): string {
|
|
593
|
+
format(fmt: Intl.DateTimeFormat | LocalTimeFormatter): string {
|
|
594
|
+
if (fmt instanceof Intl.DateTimeFormat) {
|
|
595
|
+
return fmt.format(this.$date)
|
|
596
|
+
}
|
|
597
|
+
|
|
594
598
|
return fmt(this)
|
|
595
599
|
}
|
|
596
600
|
}
|
package/src/http/fetcher.ts
CHANGED
|
@@ -561,10 +561,10 @@ export class Fetcher {
|
|
|
561
561
|
req.url = `${baseUrl}/${url}`
|
|
562
562
|
}
|
|
563
563
|
|
|
564
|
-
const searchParams = {
|
|
564
|
+
const searchParams = _filterUndefinedValues({
|
|
565
565
|
...this.cfg.searchParams,
|
|
566
566
|
...opt.searchParams,
|
|
567
|
-
}
|
|
567
|
+
})
|
|
568
568
|
|
|
569
569
|
if (Object.keys(searchParams).length) {
|
|
570
570
|
const qs = new URLSearchParams(searchParams).toString()
|