@naturalcycles/js-lib 14.95.1 → 14.96.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.
@@ -5,18 +5,6 @@ const assert_1 = require("../error/assert");
5
5
  const time_util_1 = require("../time/time.util");
6
6
  const localDate_1 = require("./localDate");
7
7
  /* eslint-disable no-dupe-class-members */
8
- // Design choices:
9
- // No milliseconds
10
- // No timezone support, ISO8601 is parsed as LocalDateTime, discarding Timezone information
11
- // Formats as unix timestamp, ISO8601 or "pretty string"
12
- // toString and .toJSON formats as unix timestamp
13
- // No "unixMillis", just pure unixtimestamp
14
- // .valueOf returns unix timestamp (no millis)
15
- // Prevents dayjs(undefined) being dayjs.now()
16
- // Validates on parse, throws if invalid. Doesn't allow invalid objects
17
- // No arbitrary .format('') (which is slow to parse) vs well-defined (opinionated) formats
18
- // Separate LocalTime, powered by native js Date, and LocalDate - a smaller functionality class when
19
- // you only need "whole dates", no time, no timezone worry
20
8
  /**
21
9
  * @experimental
22
10
  */
@@ -5,7 +5,7 @@ import { AppError } from './app.error';
5
5
  * Allows to write shorter code that avoids `try/catch`.
6
6
  * Useful e.g. in unit tests.
7
7
  *
8
- * Similar to pTuple, but for sync functions.
8
+ * Similar to pTry, but for sync functions.
9
9
  *
10
10
  * For convenience, second argument type is non-optional,
11
11
  * so you can use it without `!`. But you SHOULD always check `if (err)` first!
package/dist/error/try.js CHANGED
@@ -7,7 +7,7 @@ const app_error_1 = require("./app.error");
7
7
  * Allows to write shorter code that avoids `try/catch`.
8
8
  * Useful e.g. in unit tests.
9
9
  *
10
- * Similar to pTuple, but for sync functions.
10
+ * Similar to pTry, but for sync functions.
11
11
  *
12
12
  * For convenience, second argument type is non-optional,
13
13
  * so you can use it without `!`. But you SHOULD always check `if (err)` first!
package/dist/index.d.ts CHANGED
@@ -45,7 +45,6 @@ export * from './promise/pProps';
45
45
  import { pRetry, pRetryFn, PRetryOptions } from './promise/pRetry';
46
46
  export * from './promise/pState';
47
47
  import { pTimeout, pTimeoutFn, PTimeoutOptions } from './promise/pTimeout';
48
- export * from './promise/pTuple';
49
48
  export * from './string/case';
50
49
  export * from './string/json.util';
51
50
  export * from './string/string.util';
package/dist/index.js CHANGED
@@ -59,7 +59,6 @@ tslib_1.__exportStar(require("./promise/pState"), exports);
59
59
  const pTimeout_1 = require("./promise/pTimeout");
60
60
  Object.defineProperty(exports, "pTimeout", { enumerable: true, get: function () { return pTimeout_1.pTimeout; } });
61
61
  Object.defineProperty(exports, "pTimeoutFn", { enumerable: true, get: function () { return pTimeout_1.pTimeoutFn; } });
62
- tslib_1.__exportStar(require("./promise/pTuple"), exports);
63
62
  tslib_1.__exportStar(require("./string/case"), exports);
64
63
  tslib_1.__exportStar(require("./string/json.util"), exports);
65
64
  tslib_1.__exportStar(require("./string/string.util"), exports);
@@ -2,18 +2,6 @@ import { _assert } from '../error/assert';
2
2
  import { _ms } from '../time/time.util';
3
3
  import { LocalDate } from './localDate';
4
4
  /* eslint-disable no-dupe-class-members */
5
- // Design choices:
6
- // No milliseconds
7
- // No timezone support, ISO8601 is parsed as LocalDateTime, discarding Timezone information
8
- // Formats as unix timestamp, ISO8601 or "pretty string"
9
- // toString and .toJSON formats as unix timestamp
10
- // No "unixMillis", just pure unixtimestamp
11
- // .valueOf returns unix timestamp (no millis)
12
- // Prevents dayjs(undefined) being dayjs.now()
13
- // Validates on parse, throws if invalid. Doesn't allow invalid objects
14
- // No arbitrary .format('') (which is slow to parse) vs well-defined (opinionated) formats
15
- // Separate LocalTime, powered by native js Date, and LocalDate - a smaller functionality class when
16
- // you only need "whole dates", no time, no timezone worry
17
5
  /**
18
6
  * @experimental
19
7
  */
@@ -4,7 +4,7 @@ import { AppError } from './app.error';
4
4
  * Allows to write shorter code that avoids `try/catch`.
5
5
  * Useful e.g. in unit tests.
6
6
  *
7
- * Similar to pTuple, but for sync functions.
7
+ * Similar to pTry, but for sync functions.
8
8
  *
9
9
  * For convenience, second argument type is non-optional,
10
10
  * so you can use it without `!`. But you SHOULD always check `if (err)` first!
package/dist-esm/index.js CHANGED
@@ -42,7 +42,6 @@ export * from './promise/pProps';
42
42
  import { pRetry, pRetryFn } from './promise/pRetry';
43
43
  export * from './promise/pState';
44
44
  import { pTimeout, pTimeoutFn } from './promise/pTimeout';
45
- export * from './promise/pTuple';
46
45
  export * from './string/case';
47
46
  export * from './string/json.util';
48
47
  export * from './string/string.util';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
- "version": "14.95.1",
3
+ "version": "14.96.0",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "build-prod": "build-prod-esm-cjs",
@@ -18,18 +18,6 @@ export interface LocalTimeComponents {
18
18
 
19
19
  /* eslint-disable no-dupe-class-members */
20
20
 
21
- // Design choices:
22
- // No milliseconds
23
- // No timezone support, ISO8601 is parsed as LocalDateTime, discarding Timezone information
24
- // Formats as unix timestamp, ISO8601 or "pretty string"
25
- // toString and .toJSON formats as unix timestamp
26
- // No "unixMillis", just pure unixtimestamp
27
- // .valueOf returns unix timestamp (no millis)
28
- // Prevents dayjs(undefined) being dayjs.now()
29
- // Validates on parse, throws if invalid. Doesn't allow invalid objects
30
- // No arbitrary .format('') (which is slow to parse) vs well-defined (opinionated) formats
31
- // Separate LocalTime, powered by native js Date, and LocalDate - a smaller functionality class when
32
- // you only need "whole dates", no time, no timezone worry
33
21
  /**
34
22
  * @experimental
35
23
  */
package/src/error/try.ts CHANGED
@@ -6,7 +6,7 @@ import { AppError } from './app.error'
6
6
  * Allows to write shorter code that avoids `try/catch`.
7
7
  * Useful e.g. in unit tests.
8
8
  *
9
- * Similar to pTuple, but for sync functions.
9
+ * Similar to pTry, but for sync functions.
10
10
  *
11
11
  * For convenience, second argument type is non-optional,
12
12
  * so you can use it without `!`. But you SHOULD always check `if (err)` first!
package/src/index.ts CHANGED
@@ -78,7 +78,6 @@ export * from './promise/pProps'
78
78
  import { pRetry, pRetryFn, PRetryOptions } from './promise/pRetry'
79
79
  export * from './promise/pState'
80
80
  import { pTimeout, pTimeoutFn, PTimeoutOptions } from './promise/pTimeout'
81
- export * from './promise/pTuple'
82
81
  export * from './string/case'
83
82
  export * from './string/json.util'
84
83
  export * from './string/string.util'
@@ -1,7 +0,0 @@
1
- /**
2
- * Wraps async calls in try catch blocks
3
- * to simplify syntax.
4
- *
5
- * source: https://github.com/scopsy/await-to-js/blob/master/src/await-to-js.ts
6
- */
7
- export declare function pTuple<RETURN, ERR = Error>(promise: Promise<RETURN>): Promise<[ERR, undefined] | [null, RETURN]>;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pTuple = void 0;
4
- /**
5
- * Wraps async calls in try catch blocks
6
- * to simplify syntax.
7
- *
8
- * source: https://github.com/scopsy/await-to-js/blob/master/src/await-to-js.ts
9
- */
10
- async function pTuple(promise) {
11
- return promise.then(data => [null, data]).catch(err => [err, undefined]);
12
- }
13
- exports.pTuple = pTuple;
@@ -1,9 +0,0 @@
1
- /**
2
- * Wraps async calls in try catch blocks
3
- * to simplify syntax.
4
- *
5
- * source: https://github.com/scopsy/await-to-js/blob/master/src/await-to-js.ts
6
- */
7
- export async function pTuple(promise) {
8
- return promise.then(data => [null, data]).catch(err => [err, undefined]);
9
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Wraps async calls in try catch blocks
3
- * to simplify syntax.
4
- *
5
- * source: https://github.com/scopsy/await-to-js/blob/master/src/await-to-js.ts
6
- */
7
- export async function pTuple<RETURN, ERR = Error>(
8
- promise: Promise<RETURN>,
9
- ): Promise<[ERR, undefined] | [null, RETURN]> {
10
- return promise.then(data => [null, data] as [null, RETURN]).catch(err => [err as ERR, undefined])
11
- }