@ayapapa-npm/contracts-js 0.2.4 → 0.2.5
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/index.cjs +11 -2
- package/dist/index.d.cts +17 -6
- package/dist/index.d.ts +17 -6
- package/dist/index.js +11 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -55,7 +55,7 @@ var Contracts = class _Contracts {
|
|
|
55
55
|
*
|
|
56
56
|
* Is the `logger` property is specified,
|
|
57
57
|
* it is used instead of the standard logger, `console`.
|
|
58
|
-
* This module uses only the `error` method
|
|
58
|
+
* This module uses only the `error` method of the `logger`.
|
|
59
59
|
*
|
|
60
60
|
* @example
|
|
61
61
|
* // Use a logger that is slightly more advanced than the standard logger—namely, `console`.
|
|
@@ -518,6 +518,9 @@ var Contracts = class _Contracts {
|
|
|
518
518
|
* - When ErrorClass is null,
|
|
519
519
|
* logs the failure message instead of throwing.
|
|
520
520
|
*
|
|
521
|
+
*
|
|
522
|
+
* @internal
|
|
523
|
+
*
|
|
521
524
|
* @param isOk
|
|
522
525
|
* Condition result.
|
|
523
526
|
*
|
|
@@ -562,6 +565,8 @@ var Contracts = class _Contracts {
|
|
|
562
565
|
* this method returns the original condition value
|
|
563
566
|
* without performing any validation.
|
|
564
567
|
*
|
|
568
|
+
* @internal
|
|
569
|
+
*
|
|
565
570
|
* @param isOk
|
|
566
571
|
* Condition result.
|
|
567
572
|
*
|
|
@@ -590,7 +595,11 @@ var Contracts = class _Contracts {
|
|
|
590
595
|
eProps
|
|
591
596
|
) : isOk;
|
|
592
597
|
}
|
|
593
|
-
/**
|
|
598
|
+
/**
|
|
599
|
+
* Get logger
|
|
600
|
+
*
|
|
601
|
+
* @internal
|
|
602
|
+
*/
|
|
594
603
|
static getLogger() {
|
|
595
604
|
return _Contracts.logger ?? console;
|
|
596
605
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -11,14 +11,16 @@ interface Config {
|
|
|
11
11
|
* If `true`, `DEBUG_MODE` is enabled; otherwise, it is disabled.
|
|
12
12
|
* The default is `false`.
|
|
13
13
|
*/
|
|
14
|
-
debug
|
|
14
|
+
debug?: boolean;
|
|
15
15
|
/**
|
|
16
16
|
* External logger.
|
|
17
17
|
* If specified, it is used instead of the standard logger, `console`.
|
|
18
18
|
* This module uses only the `error` method.
|
|
19
19
|
*/
|
|
20
|
-
logger
|
|
20
|
+
logger?: LogProvider;
|
|
21
21
|
}
|
|
22
|
+
/** Type of `Config`'s key. */
|
|
23
|
+
type ConfigKey = keyof Config;
|
|
22
24
|
/**
|
|
23
25
|
* A lightweight Design by Contract library for JavaScript.
|
|
24
26
|
*
|
|
@@ -82,7 +84,7 @@ declare class Contracts {
|
|
|
82
84
|
*
|
|
83
85
|
* Is the `logger` property is specified,
|
|
84
86
|
* it is used instead of the standard logger, `console`.
|
|
85
|
-
* This module uses only the `error` method
|
|
87
|
+
* This module uses only the `error` method of the `logger`.
|
|
86
88
|
*
|
|
87
89
|
* @example
|
|
88
90
|
* // Use a logger that is slightly more advanced than the standard logger—namely, `console`.
|
|
@@ -478,6 +480,9 @@ declare class Contracts {
|
|
|
478
480
|
* - When ErrorClass is null,
|
|
479
481
|
* logs the failure message instead of throwing.
|
|
480
482
|
*
|
|
483
|
+
*
|
|
484
|
+
* @internal
|
|
485
|
+
*
|
|
481
486
|
* @param isOk
|
|
482
487
|
* Condition result.
|
|
483
488
|
*
|
|
@@ -508,6 +513,8 @@ declare class Contracts {
|
|
|
508
513
|
* this method returns the original condition value
|
|
509
514
|
* without performing any validation.
|
|
510
515
|
*
|
|
516
|
+
* @internal
|
|
517
|
+
*
|
|
511
518
|
* @param isOk
|
|
512
519
|
* Condition result.
|
|
513
520
|
*
|
|
@@ -527,9 +534,13 @@ declare class Contracts {
|
|
|
527
534
|
* Returns the original condition value.
|
|
528
535
|
*
|
|
529
536
|
*/
|
|
530
|
-
static checkDebug
|
|
531
|
-
/**
|
|
537
|
+
private static checkDebug;
|
|
538
|
+
/**
|
|
539
|
+
* Get logger
|
|
540
|
+
*
|
|
541
|
+
* @internal
|
|
542
|
+
*/
|
|
532
543
|
private static getLogger;
|
|
533
544
|
}
|
|
534
545
|
|
|
535
|
-
export { type Config, Contracts, type LogProvider, Contracts as default };
|
|
546
|
+
export { type Config, type ConfigKey, Contracts, type LogProvider, Contracts as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,14 +11,16 @@ interface Config {
|
|
|
11
11
|
* If `true`, `DEBUG_MODE` is enabled; otherwise, it is disabled.
|
|
12
12
|
* The default is `false`.
|
|
13
13
|
*/
|
|
14
|
-
debug
|
|
14
|
+
debug?: boolean;
|
|
15
15
|
/**
|
|
16
16
|
* External logger.
|
|
17
17
|
* If specified, it is used instead of the standard logger, `console`.
|
|
18
18
|
* This module uses only the `error` method.
|
|
19
19
|
*/
|
|
20
|
-
logger
|
|
20
|
+
logger?: LogProvider;
|
|
21
21
|
}
|
|
22
|
+
/** Type of `Config`'s key. */
|
|
23
|
+
type ConfigKey = keyof Config;
|
|
22
24
|
/**
|
|
23
25
|
* A lightweight Design by Contract library for JavaScript.
|
|
24
26
|
*
|
|
@@ -82,7 +84,7 @@ declare class Contracts {
|
|
|
82
84
|
*
|
|
83
85
|
* Is the `logger` property is specified,
|
|
84
86
|
* it is used instead of the standard logger, `console`.
|
|
85
|
-
* This module uses only the `error` method
|
|
87
|
+
* This module uses only the `error` method of the `logger`.
|
|
86
88
|
*
|
|
87
89
|
* @example
|
|
88
90
|
* // Use a logger that is slightly more advanced than the standard logger—namely, `console`.
|
|
@@ -478,6 +480,9 @@ declare class Contracts {
|
|
|
478
480
|
* - When ErrorClass is null,
|
|
479
481
|
* logs the failure message instead of throwing.
|
|
480
482
|
*
|
|
483
|
+
*
|
|
484
|
+
* @internal
|
|
485
|
+
*
|
|
481
486
|
* @param isOk
|
|
482
487
|
* Condition result.
|
|
483
488
|
*
|
|
@@ -508,6 +513,8 @@ declare class Contracts {
|
|
|
508
513
|
* this method returns the original condition value
|
|
509
514
|
* without performing any validation.
|
|
510
515
|
*
|
|
516
|
+
* @internal
|
|
517
|
+
*
|
|
511
518
|
* @param isOk
|
|
512
519
|
* Condition result.
|
|
513
520
|
*
|
|
@@ -527,9 +534,13 @@ declare class Contracts {
|
|
|
527
534
|
* Returns the original condition value.
|
|
528
535
|
*
|
|
529
536
|
*/
|
|
530
|
-
static checkDebug
|
|
531
|
-
/**
|
|
537
|
+
private static checkDebug;
|
|
538
|
+
/**
|
|
539
|
+
* Get logger
|
|
540
|
+
*
|
|
541
|
+
* @internal
|
|
542
|
+
*/
|
|
532
543
|
private static getLogger;
|
|
533
544
|
}
|
|
534
545
|
|
|
535
|
-
export { type Config, Contracts, type LogProvider, Contracts as default };
|
|
546
|
+
export { type Config, type ConfigKey, Contracts, type LogProvider, Contracts as default };
|
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var Contracts = class _Contracts {
|
|
|
29
29
|
*
|
|
30
30
|
* Is the `logger` property is specified,
|
|
31
31
|
* it is used instead of the standard logger, `console`.
|
|
32
|
-
* This module uses only the `error` method
|
|
32
|
+
* This module uses only the `error` method of the `logger`.
|
|
33
33
|
*
|
|
34
34
|
* @example
|
|
35
35
|
* // Use a logger that is slightly more advanced than the standard logger—namely, `console`.
|
|
@@ -492,6 +492,9 @@ var Contracts = class _Contracts {
|
|
|
492
492
|
* - When ErrorClass is null,
|
|
493
493
|
* logs the failure message instead of throwing.
|
|
494
494
|
*
|
|
495
|
+
*
|
|
496
|
+
* @internal
|
|
497
|
+
*
|
|
495
498
|
* @param isOk
|
|
496
499
|
* Condition result.
|
|
497
500
|
*
|
|
@@ -536,6 +539,8 @@ var Contracts = class _Contracts {
|
|
|
536
539
|
* this method returns the original condition value
|
|
537
540
|
* without performing any validation.
|
|
538
541
|
*
|
|
542
|
+
* @internal
|
|
543
|
+
*
|
|
539
544
|
* @param isOk
|
|
540
545
|
* Condition result.
|
|
541
546
|
*
|
|
@@ -564,7 +569,11 @@ var Contracts = class _Contracts {
|
|
|
564
569
|
eProps
|
|
565
570
|
) : isOk;
|
|
566
571
|
}
|
|
567
|
-
/**
|
|
572
|
+
/**
|
|
573
|
+
* Get logger
|
|
574
|
+
*
|
|
575
|
+
* @internal
|
|
576
|
+
*/
|
|
568
577
|
static getLogger() {
|
|
569
578
|
return _Contracts.logger ?? console;
|
|
570
579
|
}
|