@atlantjs/arch 15.6.7 → 15.7.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.
Files changed (107) hide show
  1. package/index.js +60 -0
  2. package/package.json +5 -3
  3. package/tsconfig-lib.json +1 -0
  4. package/{tsconfig.tsbuildinfo → tsconfig.build.tsbuildinfo} +1 -1
  5. package/src/@tool-box/tests/builder.abstract.util.js +0 -39
  6. package/src/@tool-box/tests/builders/datetime/datetime.edge.builder.js +0 -15
  7. package/src/@tool-box/tests/builders/failures/dummies/failure.dummy.js +0 -13
  8. package/src/@tool-box/tests/builders/failures/failure.builder.js +0 -17
  9. package/src/@tool-box/tests/builders/metadata/metadata-uv.builder.js +0 -18
  10. package/src/@tool-box/tests/builders/metadata/metadata.edge.builder.js +0 -15
  11. package/src/@tool-box/tests/builders/user/email.edge.builder.js +0 -15
  12. package/src/@tool-box/tests/builders/user/username.edge.builder.js +0 -15
  13. package/src/@tool-box/tests/faker/faker.js +0 -208
  14. package/src/@tool-box/utils/convert-units/convert-units.js +0 -154
  15. package/src/@tool-box/utils/datatypes/boolean-utils.js +0 -155
  16. package/src/@tool-box/utils/datatypes/generic-types.js +0 -3
  17. package/src/@tool-box/utils/datatypes/plainify.js +0 -2
  18. package/src/@tool-box/utils/datatypes/string-utils.js +0 -292
  19. package/src/@tool-box/utils/datetime/mappers/month.mapper.js +0 -58
  20. package/src/@tool-box/utils/datetime/mappers/points/month-abbreviation.enum.js +0 -18
  21. package/src/@tool-box/utils/datetime/mappers/points/month-number.enum.js +0 -18
  22. package/src/@tool-box/utils/ducts/common.js +0 -47
  23. package/src/@tool-box/utils/ducts/optional-type.js +0 -128
  24. package/src/@tool-box/utils/ducts/return-type.js +0 -67
  25. package/src/@tool-box/utils/http-provider/http-provider-failure-response.js +0 -19
  26. package/src/@tool-box/utils/http-provider/http-provider-success-response.js +0 -20
  27. package/src/@tool-box/utils/http-provider/http-provider.js +0 -85
  28. package/src/@tool-box/utils/logger/index.js +0 -31
  29. package/src/@tool-box/utils/map/map.abstract.js +0 -84
  30. package/src/@tool-box/utils/random/random.js +0 -260
  31. package/src/@tool-box/utils/type-guard/guardian-exception.js +0 -6
  32. package/src/@tool-box/utils/type-guard/guardian.js +0 -625
  33. package/src/@tool-box/utils/type-guard/guardian.type.js +0 -2
  34. package/src/@tool-box/utils/validators/is-cron-expression.js +0 -39
  35. package/src/@tool-box/utils/validators/is-date-string.js +0 -42
  36. package/src/@tool-box/utils/validators/is-password-match.js +0 -27
  37. package/src/@tool-box/utils/validators/is-password-policy.validator.js +0 -30
  38. package/src/@tool-box/utils/validators/is-schedule.js +0 -43
  39. package/src/@tool-box/utils/validators/is-time-string.js +0 -39
  40. package/src/@tool-box/utils/validators/is-ulid.js +0 -39
  41. package/src/index.js +0 -179
  42. package/src/objects/@common/edges/email.edge.js +0 -94
  43. package/src/objects/@common/edges/ulid.sketch.edge.js +0 -91
  44. package/src/objects/@common/edges/url.edge.js +0 -269
  45. package/src/objects/@common/edges/username.edge.js +0 -41
  46. package/src/objects/@common/edges/uuid.sketch.edge.js +0 -145
  47. package/src/objects/@common/points/environment.point.js +0 -10
  48. package/src/objects/@common/points/header-token-name.point.js +0 -10
  49. package/src/objects/@common/points/http-status-codes.point.js +0 -244
  50. package/src/objects/amount/amount-value.edge.js +0 -76
  51. package/src/objects/amount/amount.edge.js +0 -626
  52. package/src/objects/amount/amount.polygon.js +0 -2
  53. package/src/objects/amount/amount.uv.js +0 -29
  54. package/src/objects/amount/points/duration-unit.point.js +0 -15
  55. package/src/objects/amount/points/energy-unit.point.js +0 -10
  56. package/src/objects/amount/points/length-unit.point.js +0 -10
  57. package/src/objects/amount/points/mass-unit.point.js +0 -11
  58. package/src/objects/amount/points/month-name.point.js +0 -18
  59. package/src/objects/amount/points/object-unit.point.js +0 -7
  60. package/src/objects/amount/points/units.point.js +0 -2
  61. package/src/objects/amount/points/volume-unit.point.js +0 -8
  62. package/src/objects/amount/points/week-day.point.js +0 -13
  63. package/src/objects/datetime/edges/datetime.edge.js +0 -672
  64. package/src/objects/datetime/edges/locale/day/day-name-to-english.mapper.js +0 -19
  65. package/src/objects/datetime/edges/locale/day/day-name-to-portuguese.mapper.js +0 -19
  66. package/src/objects/datetime/edges/locale/day/today-to-language.mapper.js +0 -15
  67. package/src/objects/datetime/edges/locale/holidays-country.type.js +0 -2
  68. package/src/objects/datetime/edges/locale/month/month-to-english.mapper.js +0 -24
  69. package/src/objects/datetime/edges/locale/month/month-to-portuguese.mapper.js +0 -24
  70. package/src/objects/datetime/points/month-name.enum.js +0 -18
  71. package/src/objects/datetime/points/week-day.enum.js +0 -13
  72. package/src/objects/failure/edges/failure.abstract.js +0 -24
  73. package/src/objects/failure/edges/failure.abstract.polygon.js +0 -2
  74. package/src/objects/language/points/language.point.js +0 -135
  75. package/src/objects/metadata/metadata.edge.js +0 -25
  76. package/src/objects/metadata/metadata.polygon.js +0 -2
  77. package/src/objects/metadata/metadata.uv.js +0 -29
  78. package/src/objects/password/password.edge.js +0 -175
  79. package/src/objects/password/password.polygon.js +0 -2
  80. package/src/objects/password/steps/not-allowing-consecutive-chars-step.js +0 -34
  81. package/src/objects/password/steps/not-allowing-date-step.js +0 -61
  82. package/src/objects/password/steps/not-allowing-phone-step.js +0 -27
  83. package/src/objects/password/steps/not-allowing-repeated-chars-step.js +0 -34
  84. package/src/objects/password/steps/not-allowing-string-step.js +0 -19
  85. package/src/objects/password/steps/not-allowing-these-chars-step.js +0 -17
  86. package/src/objects/password/steps/numeric-step.js +0 -13
  87. package/src/objects/password/steps/with-at-least-one-letter-step.js +0 -14
  88. package/src/objects/password/steps/with-at-least-one-number-digit-step.js +0 -14
  89. package/src/objects/password/steps/with-at-least-one-special-char-step.js +0 -14
  90. package/src/objects/password/steps/with-length-step.js +0 -18
  91. package/src/objects/password/validation-step.js +0 -9
  92. package/src/objects/password/validation-step.type.js +0 -2
  93. package/src/objects/primitives/boolean.edge.sketch.js +0 -147
  94. package/src/objects/primitives/datetime.edge.sketch.js +0 -7
  95. package/src/objects/primitives/number.edge.sketch.js +0 -346
  96. package/src/objects/primitives/string.edge.sketch.js +0 -218
  97. package/src/objects/scheduling/scheduling.edge.failure.js +0 -14
  98. package/src/objects/scheduling/scheduling.edge.js +0 -280
  99. package/src/objects/time/time.edge.js +0 -447
  100. package/src/objects-interface/edges/edge.abstract.js +0 -6
  101. package/src/objects-interface/face.abstract.js +0 -6
  102. package/src/objects-interface/solid.abstract.js +0 -11
  103. package/src/objects-interface/uv.abstract.js +0 -6
  104. package/src/objects-interface/vertices/vertex.abstract.js +0 -11
  105. package/src/shared/payload.abstract.js +0 -6
  106. package/src/shared/request.abstract.js +0 -3
  107. package/src/shared/response.abstract.js +0 -6
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BuilderAbstract = void 0;
4
- class BuilderAbstract {
5
- constructor(innerType) {
6
- this.innerType = innerType;
7
- this.modifiers = [];
8
- }
9
- build() {
10
- const instance = this.buildDefault();
11
- this.applyModifiers(instance);
12
- return instance;
13
- }
14
- with(key, value) {
15
- return this.newBuilder((entity) => {
16
- entity[key] = value;
17
- });
18
- }
19
- buildMany(quantity) {
20
- let calculatedQuantity = quantity;
21
- if (calculatedQuantity === undefined) {
22
- const min = 2;
23
- const max = 6;
24
- calculatedQuantity = Math.floor(Math.random() * (max - min + 1) + min);
25
- }
26
- return Array.from({ length: calculatedQuantity }, () => this.build());
27
- }
28
- applyModifiers(instance) {
29
- for (const modifier of this.modifiers) {
30
- modifier(instance);
31
- }
32
- }
33
- newBuilder(modifier) {
34
- const newBuilder = new this.innerType();
35
- newBuilder.modifiers = [...this.modifiers, modifier];
36
- return newBuilder;
37
- }
38
- }
39
- exports.BuilderAbstract = BuilderAbstract;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DatetimeEdgeBuilder = void 0;
4
- const builder_abstract_util_1 = require("#/@tool-box/tests/builder.abstract.util");
5
- const faker_1 = require("#/@tool-box/tests/faker/faker");
6
- const datetime_edge_1 = require("#/objects/datetime/edges/datetime.edge");
7
- class DatetimeEdgeBuilder extends builder_abstract_util_1.BuilderAbstract {
8
- constructor() {
9
- super(DatetimeEdgeBuilder);
10
- }
11
- buildDefault() {
12
- return new datetime_edge_1.DatetimeEdge(faker_1.faker.date.random().toISOString());
13
- }
14
- }
15
- exports.DatetimeEdgeBuilder = DatetimeEdgeBuilder;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FailureDummy = void 0;
4
- const failure_abstract_1 = require("#/objects/failure/edges/failure.abstract");
5
- class FailureDummy extends failure_abstract_1.FailureAbstract {
6
- constructor() {
7
- super({
8
- failureClass: FailureDummy,
9
- message: "This is a dummy failure for testing purposes.",
10
- });
11
- }
12
- }
13
- exports.FailureDummy = FailureDummy;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FailureBuilder = void 0;
4
- const builder_abstract_util_1 = require("#/@tool-box/tests/builder.abstract.util");
5
- const failure_dummy_1 = require("#/@tool-box/tests/builders/failures/dummies/failure.dummy");
6
- class FailureBuilder extends builder_abstract_util_1.BuilderAbstract {
7
- constructor(entityClass) {
8
- super(FailureBuilder);
9
- this.instance = entityClass;
10
- }
11
- buildDefault() {
12
- const dummy = new failure_dummy_1.FailureDummy();
13
- Object.assign(dummy, this.instance);
14
- return dummy;
15
- }
16
- }
17
- exports.FailureBuilder = FailureBuilder;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MetadataUvBuilder = void 0;
4
- const builder_abstract_util_1 = require("#/@tool-box/tests/builder.abstract.util");
5
- const datetime_edge_builder_1 = require("#/@tool-box/tests/builders/datetime/datetime.edge.builder");
6
- const metadata_uv_1 = require("#/objects/metadata/metadata.uv");
7
- class MetadataUvBuilder extends builder_abstract_util_1.BuilderAbstract {
8
- constructor() {
9
- super(MetadataUvBuilder);
10
- }
11
- buildDefault() {
12
- const metadataUv = new metadata_uv_1.MetadataUv();
13
- metadataUv.createdAt = new datetime_edge_builder_1.DatetimeEdgeBuilder().build().toISOString();
14
- metadataUv.updatedAt = new datetime_edge_builder_1.DatetimeEdgeBuilder().build().toISOString();
15
- return metadataUv;
16
- }
17
- }
18
- exports.MetadataUvBuilder = MetadataUvBuilder;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MetadataEdgeBuilder = void 0;
4
- const builder_abstract_util_1 = require("#/@tool-box/tests/builder.abstract.util");
5
- const datetime_edge_builder_1 = require("#/@tool-box/tests/builders/datetime/datetime.edge.builder");
6
- const metadata_edge_1 = require("#/objects/metadata/metadata.edge");
7
- class MetadataEdgeBuilder extends builder_abstract_util_1.BuilderAbstract {
8
- constructor() {
9
- super(MetadataEdgeBuilder);
10
- }
11
- buildDefault() {
12
- return new metadata_edge_1.MetadataEdge(new datetime_edge_builder_1.DatetimeEdgeBuilder().build(), new datetime_edge_builder_1.DatetimeEdgeBuilder().build());
13
- }
14
- }
15
- exports.MetadataEdgeBuilder = MetadataEdgeBuilder;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EmailEdgeBuilder = void 0;
4
- const builder_abstract_util_1 = require("#/@tool-box/tests/builder.abstract.util");
5
- const faker_1 = require("#/@tool-box/tests/faker/faker");
6
- const email_edge_1 = require("#/objects/@common/edges/email.edge");
7
- class EmailEdgeBuilder extends builder_abstract_util_1.BuilderAbstract {
8
- constructor() {
9
- super(EmailEdgeBuilder);
10
- }
11
- buildDefault() {
12
- return new email_edge_1.EmailEdge(faker_1.faker.internet.email());
13
- }
14
- }
15
- exports.EmailEdgeBuilder = EmailEdgeBuilder;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UsernameEdgeBuilder = void 0;
4
- const builder_abstract_util_1 = require("#/@tool-box/tests/builder.abstract.util");
5
- const faker_1 = require("#/@tool-box/tests/faker/faker");
6
- const username_edge_1 = require("#/objects/@common/edges/username.edge");
7
- class UsernameEdgeBuilder extends builder_abstract_util_1.BuilderAbstract {
8
- constructor() {
9
- super(UsernameEdgeBuilder);
10
- }
11
- buildDefault() {
12
- return new username_edge_1.UsernameEdge(faker_1.faker.internet.username());
13
- }
14
- }
15
- exports.UsernameEdgeBuilder = UsernameEdgeBuilder;
@@ -1,208 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.faker = void 0;
7
- const react_native_uuid_1 = __importDefault(require("react-native-uuid"));
8
- const ulid_1 = require("ulid");
9
- exports.faker = {
10
- date: {
11
- past: ({ yearsAgo = 1 } = {}) => {
12
- const date = new Date();
13
- date.setFullYear(date.getFullYear() - yearsAgo);
14
- return date;
15
- },
16
- future: ({ yearsAhead = 1 } = {}) => {
17
- const date = new Date();
18
- date.setFullYear(date.getFullYear() + yearsAhead);
19
- return date;
20
- },
21
- recent: ({ daysAgo = 30 } = {}) => {
22
- const date = new Date();
23
- date.setDate(date.getDate() - Math.floor(Math.random() * daysAgo));
24
- return date;
25
- },
26
- random: () => {
27
- const start = new Date(2000, 0, 1);
28
- const end = new Date();
29
- return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
30
- },
31
- },
32
- commerce: {
33
- productName: () => {
34
- const adjectives = [
35
- "Awesome",
36
- "Incredible",
37
- "Fantastic",
38
- "Revolutionary",
39
- "Innovative",
40
- "Amazing",
41
- ];
42
- const nouns = ["Gadget", "Device", "Tool", "Item", "Product", "Solution"];
43
- const adjective = adjectives[Math.floor(Math.random() * adjectives.length)];
44
- const noun = nouns[Math.floor(Math.random() * nouns.length)];
45
- return `${adjective} ${noun}`;
46
- },
47
- productDescription: ({ lines = 3 } = {}) => {
48
- const result = [];
49
- for (let i = 0; i < lines; i++) {
50
- result.push(exports.faker.lorem.paragraph());
51
- }
52
- return result.join("\n");
53
- },
54
- },
55
- image: {
56
- url: () => {
57
- const width = exports.faker.number.int({ min: 100, max: 1000 });
58
- const height = exports.faker.number.int({ min: 100, max: 1000 });
59
- return `https://via.placeholder.com/${width}x${height}`;
60
- },
61
- },
62
- number: {
63
- float: ({ min = 0, max = 1 } = {}) => {
64
- return Math.random() * (max - min) + min;
65
- },
66
- int: ({ min = 0, max = 100 } = {}) => {
67
- return Math.floor(Math.random() * (max - min + 1)) + min;
68
- },
69
- },
70
- string: {
71
- alphanumeric: ({ length = Math.floor(Math.random() * 6) + 5 } = {}) => {
72
- const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
73
- let result = "";
74
- for (let i = 0; i < length; i++) {
75
- result += chars.charAt(Math.floor(Math.random() * chars.length));
76
- }
77
- return result;
78
- },
79
- ulid: () => (0, ulid_1.ulid)(),
80
- uuid: () => react_native_uuid_1.default.v4(),
81
- },
82
- person: {
83
- firstName: () => {
84
- const firstNames = ["John", "Jane", "Alex", "Emily", "Chris", "Katie"];
85
- return firstNames[Math.floor(Math.random() * firstNames.length)];
86
- },
87
- lastName: () => {
88
- const lastNames = ["Smith", "Doe", "Johnson", "Brown", "Davis", "Miller"];
89
- return lastNames[Math.floor(Math.random() * lastNames.length)];
90
- },
91
- fullName: () => {
92
- return `${exports.faker.person.firstName()} ${exports.faker.person.lastName()}`;
93
- },
94
- },
95
- internet: {
96
- username: () => {
97
- const usernames = [
98
- "user123",
99
- "coolguy",
100
- "techgal",
101
- "coder123",
102
- "devmaster",
103
- "netwizard",
104
- ];
105
- return usernames[Math.floor(Math.random() * usernames.length)];
106
- },
107
- email: () => {
108
- const domains = ["example.com", "test.com", "demo.com", "sample.com"];
109
- return `${exports.faker.internet.username()}@${domains[Math.floor(Math.random() * domains.length)]}`;
110
- },
111
- url: () => {
112
- const protocols = ["http", "https"];
113
- const domains = ["example.com", "test.com", "demo.com", "sample.com"];
114
- const paths = ["home", "about", "contact", "products", "services"];
115
- const protocol = protocols[Math.floor(Math.random() * protocols.length)];
116
- const domain = domains[Math.floor(Math.random() * domains.length)];
117
- const path = paths[Math.floor(Math.random() * paths.length)];
118
- return `${protocol}://${domain}/${path}`;
119
- },
120
- },
121
- lorem: {
122
- words: ({ count = 5 } = {}) => {
123
- const loremWords = [
124
- "lorem",
125
- "ipsum",
126
- "dolor",
127
- "sit",
128
- "amet",
129
- "consectetur",
130
- "adipiscing",
131
- "elit",
132
- "sed",
133
- "do",
134
- "eiusmod",
135
- "tempor",
136
- "incididunt",
137
- "ut",
138
- "labore",
139
- "et",
140
- "dolore",
141
- "magna",
142
- "aliqua",
143
- "ut",
144
- "enim",
145
- "ad",
146
- "minim",
147
- "veniam",
148
- "quis",
149
- "nostrud",
150
- "exercitation",
151
- "ullamco",
152
- "laboris",
153
- "nisi",
154
- "ut",
155
- "aliquip",
156
- "ex",
157
- "ea",
158
- "commodo",
159
- "consequat",
160
- "duis",
161
- "aute",
162
- "irure",
163
- "dolor",
164
- "in",
165
- "reprehenderit",
166
- "in",
167
- "voluptate",
168
- "velit",
169
- "esse",
170
- "cillum",
171
- "dolore",
172
- "eu",
173
- "fugiat",
174
- "nulla",
175
- "pariatur",
176
- "excepteur",
177
- "sint",
178
- "occaecat",
179
- "cupidatat",
180
- "non",
181
- "proident",
182
- "sunt",
183
- "in",
184
- "culpa",
185
- "qui",
186
- "officia",
187
- "deserunt",
188
- "mollit",
189
- "anim",
190
- "id",
191
- "est",
192
- "laborum",
193
- ];
194
- const result = [];
195
- for (let i = 0; i < count; i++) {
196
- result.push(loremWords[Math.floor(Math.random() * loremWords.length)]);
197
- }
198
- return result.join(" ");
199
- },
200
- paragraph: ({ sentences = 5 } = {}) => {
201
- const result = [];
202
- for (let i = 0; i < sentences; i++) {
203
- result.push(exports.faker.lorem.words({ count: Math.floor(Math.random() * 10) + 5 }));
204
- }
205
- return result.join(". ") + ".";
206
- },
207
- },
208
- };
@@ -1,154 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ConvertUnit = void 0;
7
- const convert_units_1 = __importDefault(require("convert-units"));
8
- const guardian_1 = require("#/@tool-box/utils/type-guard/guardian");
9
- const energy_unit_point_1 = require("#/objects/amount/points/energy-unit.point");
10
- const length_unit_point_1 = require("#/objects/amount/points/length-unit.point");
11
- const mass_unit_point_1 = require("#/objects/amount/points/mass-unit.point");
12
- const volume_unit_point_1 = require("#/objects/amount/points/volume-unit.point");
13
- class ConvertUnit {
14
- // Mass
15
- static toKilogram(value) {
16
- if (guardian_1._.isEqual(value.unit, mass_unit_point_1.MassUnitPoint.gram)) {
17
- return (0, convert_units_1.default)(value.value).from("g").to("kg");
18
- }
19
- if (guardian_1._.isEqual(value.unit, mass_unit_point_1.MassUnitPoint.micrograma)) {
20
- return (0, convert_units_1.default)(value.value).from("mcg").to("kg");
21
- }
22
- if (guardian_1._.isEqual(value.unit, mass_unit_point_1.MassUnitPoint.milligram)) {
23
- return (0, convert_units_1.default)(value.value).from("mg").to("kg");
24
- }
25
- return value.value;
26
- }
27
- static toGram(value) {
28
- if (guardian_1._.isEqual(value.unit, mass_unit_point_1.MassUnitPoint.kilogram)) {
29
- return (0, convert_units_1.default)(value.value).from("kg").to("g");
30
- }
31
- if (guardian_1._.isEqual(value.unit, mass_unit_point_1.MassUnitPoint.micrograma)) {
32
- return (0, convert_units_1.default)(value.value).from("mcg").to("g");
33
- }
34
- if (guardian_1._.isEqual(value.unit, mass_unit_point_1.MassUnitPoint.milligram)) {
35
- return (0, convert_units_1.default)(value.value).from("mg").to("g");
36
- }
37
- return value.value;
38
- }
39
- static toMilligram(value) {
40
- if (guardian_1._.isEqual(value.unit, mass_unit_point_1.MassUnitPoint.kilogram)) {
41
- return (0, convert_units_1.default)(value.value).from("kg").to("mg");
42
- }
43
- if (guardian_1._.isEqual(value.unit, mass_unit_point_1.MassUnitPoint.micrograma)) {
44
- return (0, convert_units_1.default)(value.value).from("mcg").to("mg");
45
- }
46
- if (guardian_1._.isEqual(value.unit, mass_unit_point_1.MassUnitPoint.gram)) {
47
- return (0, convert_units_1.default)(value.value).from("g").to("mg");
48
- }
49
- return value.value;
50
- }
51
- static toMicrogram(value) {
52
- if (guardian_1._.isEqual(value.unit, mass_unit_point_1.MassUnitPoint.kilogram)) {
53
- return (0, convert_units_1.default)(value.value).from("kg").to("mcg");
54
- }
55
- if (guardian_1._.isEqual(value.unit, mass_unit_point_1.MassUnitPoint.milligram)) {
56
- return (0, convert_units_1.default)(value.value).from("mg").to("mcg");
57
- }
58
- if (guardian_1._.isEqual(value.unit, mass_unit_point_1.MassUnitPoint.gram)) {
59
- return (0, convert_units_1.default)(value.value).from("g").to("mcg");
60
- }
61
- return value.value;
62
- }
63
- // Length
64
- static toKilometer(value) {
65
- if (guardian_1._.isEqual(value.unit, length_unit_point_1.LengthUnitPoint.millimeter)) {
66
- return (0, convert_units_1.default)(value.value).from("mm").to("km");
67
- }
68
- if (guardian_1._.isEqual(value.unit, length_unit_point_1.LengthUnitPoint.centimeter)) {
69
- return (0, convert_units_1.default)(value.value).from("cm").to("km");
70
- }
71
- if (guardian_1._.isEqual(value.unit, length_unit_point_1.LengthUnitPoint.meter)) {
72
- return (0, convert_units_1.default)(value.value).from("m").to("km");
73
- }
74
- return value.value;
75
- }
76
- static toCentimeter(value) {
77
- if (guardian_1._.isEqual(value.unit, length_unit_point_1.LengthUnitPoint.millimeter)) {
78
- return (0, convert_units_1.default)(value.value).from("mm").to("cm");
79
- }
80
- if (guardian_1._.isEqual(value.unit, length_unit_point_1.LengthUnitPoint.kilometer)) {
81
- return (0, convert_units_1.default)(value.value).from("km").to("cm");
82
- }
83
- if (guardian_1._.isEqual(value.unit, length_unit_point_1.LengthUnitPoint.meter)) {
84
- return (0, convert_units_1.default)(value.value).from("m").to("cm");
85
- }
86
- return value.value;
87
- }
88
- static toMeter(value) {
89
- if (guardian_1._.isEqual(value.unit, length_unit_point_1.LengthUnitPoint.millimeter)) {
90
- return (0, convert_units_1.default)(value.value).from("mm").to("m");
91
- }
92
- if (guardian_1._.isEqual(value.unit, length_unit_point_1.LengthUnitPoint.kilometer)) {
93
- return (0, convert_units_1.default)(value.value).from("km").to("m");
94
- }
95
- if (guardian_1._.isEqual(value.unit, length_unit_point_1.LengthUnitPoint.centimeter)) {
96
- return (0, convert_units_1.default)(value.value).from("cm").to("m");
97
- }
98
- return value.value;
99
- }
100
- static toMillimeter(value) {
101
- if (guardian_1._.isEqual(value.unit, length_unit_point_1.LengthUnitPoint.meter)) {
102
- return (0, convert_units_1.default)(value.value).from("m").to("mm");
103
- }
104
- if (guardian_1._.isEqual(value.unit, length_unit_point_1.LengthUnitPoint.kilometer)) {
105
- return (0, convert_units_1.default)(value.value).from("km").to("mm");
106
- }
107
- if (guardian_1._.isEqual(value.unit, length_unit_point_1.LengthUnitPoint.centimeter)) {
108
- return (0, convert_units_1.default)(value.value).from("cm").to("mm");
109
- }
110
- return value.value;
111
- }
112
- // Volume
113
- static toLiter(value) {
114
- if (guardian_1._.isEqual(value.unit, volume_unit_point_1.VolumeUnitPoint.milliliter)) {
115
- return (0, convert_units_1.default)(value.value).from("ml").to("l");
116
- }
117
- return value.value;
118
- }
119
- static toMilliliter(value) {
120
- if (guardian_1._.isEqual(value.unit, volume_unit_point_1.VolumeUnitPoint.liter)) {
121
- return (0, convert_units_1.default)(value.value).from("l").to("ml");
122
- }
123
- return value.value;
124
- }
125
- // Energy
126
- static toKilocalorie(value) {
127
- if (guardian_1._.isEqual(value.unit, energy_unit_point_1.EnergyUnitPoint.calorie)) {
128
- return value.value / 1000;
129
- }
130
- if (guardian_1._.isEqual(value.unit, energy_unit_point_1.EnergyUnitPoint.joule)) {
131
- return value.value / 4184;
132
- }
133
- return value.value;
134
- }
135
- static toCalorie(value) {
136
- if (guardian_1._.isEqual(value.unit, energy_unit_point_1.EnergyUnitPoint.kilocalorie)) {
137
- return value.value * 1000;
138
- }
139
- if (guardian_1._.isEqual(value.unit, energy_unit_point_1.EnergyUnitPoint.joule)) {
140
- return value.value / 4.184;
141
- }
142
- return value.value;
143
- }
144
- static toJoule(value) {
145
- if (guardian_1._.isEqual(value.unit, energy_unit_point_1.EnergyUnitPoint.kilocalorie)) {
146
- return value.value * 4184;
147
- }
148
- if (guardian_1._.isEqual(value.unit, energy_unit_point_1.EnergyUnitPoint.calorie)) {
149
- return value.value * 4.184;
150
- }
151
- return value.value;
152
- }
153
- }
154
- exports.ConvertUnit = ConvertUnit;
@@ -1,155 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /**
4
- * Verifica se o valor booleano é verdadeiro (true).
5
- * @returns true se o valor é true, false caso contrário
6
- * @example
7
- * (true).truthy() // true
8
- * (false).truthy() // false
9
- */
10
- Boolean.prototype.truthy = function () {
11
- return this.valueOf() === true;
12
- };
13
- /**
14
- * Verifica se o valor booleano é falso (false ou undefined).
15
- * @returns true se o valor é false ou undefined, false caso contrário
16
- * @example
17
- * (false).falsy() // true
18
- * (true).falsy() // false
19
- */
20
- Boolean.prototype.falsy = function () {
21
- return this.valueOf() === false || this.valueOf() === undefined;
22
- };
23
- /**
24
- * Retorna o valor booleano negado (inversão lógica).
25
- * @returns true se o valor é false, false se o valor é true
26
- * @example
27
- * (true).not() // false
28
- * (false).not() // true
29
- */
30
- Boolean.prototype.not = function () {
31
- return !this.valueOf();
32
- };
33
- /**
34
- * Realiza a operação lógica AND (E) entre este valor e outro.
35
- * Retorna true somente se ambos os valores forem true.
36
- * @param value - Segundo operando booleano
37
- * @returns true se ambos são true, false caso contrário
38
- * @example
39
- * (true).and(true) // true
40
- * (true).and(false) // false
41
- * (false).and(true) // false
42
- */
43
- Boolean.prototype.and = function (value) {
44
- return this.valueOf() === true && value === true;
45
- };
46
- /**
47
- * Realiza a operação lógica OR (OU) entre este valor e outro.
48
- * Retorna true se pelo menos um dos valores for true.
49
- * @param value - Segundo operando booleano
50
- * @returns true se pelo menos um é true, false caso contrário
51
- * @example
52
- * (true).or(false) // true
53
- * (false).or(false) // false
54
- * (false).or(true) // true
55
- */
56
- Boolean.prototype.or = function (value) {
57
- return this.valueOf() === true || value === true;
58
- };
59
- /**
60
- * Verifica se este valor booleano é igual a outro.
61
- * @param value - Valor booleano para comparação
62
- * @returns true se os valores são iguais, false caso contrário
63
- * @example
64
- * (true).equal(true) // true
65
- * (true).equal(false) // false
66
- */
67
- Boolean.prototype.equal = function (value) {
68
- return this.valueOf() === value;
69
- };
70
- /**
71
- * Verifica se este valor booleano é diferente de outro.
72
- * @param value - Valor booleano para comparação
73
- * @returns true se os valores são diferentes, false caso contrário
74
- * @example
75
- * (true).different(false) // true
76
- * (true).different(true) // false
77
- */
78
- Boolean.prototype.different = function (value) {
79
- return this.valueOf() !== value;
80
- };
81
- /**
82
- * Realiza a operação lógica XOR (OU exclusivo) entre este valor e outro.
83
- * Retorna true somente se exatamente um dos valores for true.
84
- * @param value - Segundo operando booleano
85
- * @returns true se exatamente um é true, false caso contrário
86
- * @example
87
- * (true).xor(false) // true
88
- * (true).xor(true) // false
89
- * (false).xor(false) // false
90
- */
91
- Boolean.prototype.xor = function (value) {
92
- return this.valueOf() !== value;
93
- };
94
- /**
95
- * Realiza a operação lógica NAND (NÃO-E) entre este valor e outro.
96
- * Retorna false somente se ambos os valores forem true.
97
- * @param value - Segundo operando booleano
98
- * @returns false se ambos são true, true caso contrário
99
- * @example
100
- * (true).nand(true) // false
101
- * (true).nand(false) // true
102
- * (false).nand(false) // true
103
- */
104
- Boolean.prototype.nand = function (value) {
105
- return !(this.valueOf() === true && value === true);
106
- };
107
- /**
108
- * Realiza a operação lógica NOR (NÃO-OU) entre este valor e outro.
109
- * Retorna true somente se ambos os valores forem false.
110
- * @param value - Segundo operando booleano
111
- * @returns true se ambos são false, false caso contrário
112
- * @example
113
- * (false).nor(false) // true
114
- * (true).nor(false) // false
115
- * (true).nor(true) // false
116
- */
117
- Boolean.prototype.nor = function (value) {
118
- return !(this.valueOf() === true || value === true);
119
- };
120
- /**
121
- * Realiza a operação lógica de implicação (→) entre este valor e outro.
122
- * Retorna false somente se este valor é true e o outro é false.
123
- * @param value - Consequente da implicação
124
- * @returns false se this é true e value é false, true caso contrário
125
- * @example
126
- * (true).implies(true) // true
127
- * (true).implies(false) // false
128
- * (false).implies(true) // true
129
- * (false).implies(false) // true
130
- */
131
- Boolean.prototype.implies = function (value) {
132
- return !this.valueOf() || value;
133
- };
134
- /**
135
- * Converte o valor booleano para número.
136
- * true é convertido para 1, false para 0.
137
- * @returns 1 se o valor é true, 0 se o valor é false
138
- * @example
139
- * (true).toNumber() // 1
140
- * (false).toNumber() // 0
141
- */
142
- Boolean.prototype.toNumber = function () {
143
- return this.valueOf() ? 1 : 0;
144
- };
145
- /**
146
- * Retorna o valor booleano invertido sem alterar o original.
147
- * Equivalente a `.not()`, porém semânticamente indica alternância de estado.
148
- * @returns true se o valor é false, false se o valor é true
149
- * @example
150
- * (true).toggle() // false
151
- * (false).toggle() // true
152
- */
153
- Boolean.prototype.toggle = function () {
154
- return !this.valueOf();
155
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const emptyObject = {};