@atlantjs/arch 15.6.6 → 15.7.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.
- package/index.js +60 -0
- package/package.json +4 -2
- package/src/@tool-box/tests/builder.abstract.util.d.ts +1 -0
- package/src/@tool-box/tests/builder.abstract.util.d.ts.map +1 -0
- package/src/@tool-box/tests/builders/datetime/datetime.edge.builder.d.ts +1 -0
- package/src/@tool-box/tests/builders/datetime/datetime.edge.builder.d.ts.map +1 -0
- package/src/@tool-box/tests/builders/failures/dummies/failure.dummy.d.ts +1 -0
- package/src/@tool-box/tests/builders/failures/dummies/failure.dummy.d.ts.map +1 -0
- package/src/@tool-box/tests/builders/failures/failure.builder.d.ts +1 -0
- package/src/@tool-box/tests/builders/failures/failure.builder.d.ts.map +1 -0
- package/src/@tool-box/tests/builders/metadata/metadata-uv.builder.d.ts +1 -0
- package/src/@tool-box/tests/builders/metadata/metadata-uv.builder.d.ts.map +1 -0
- package/src/@tool-box/tests/builders/metadata/metadata.edge.builder.d.ts +1 -0
- package/src/@tool-box/tests/builders/metadata/metadata.edge.builder.d.ts.map +1 -0
- package/src/@tool-box/tests/builders/user/email.edge.builder.d.ts +1 -0
- package/src/@tool-box/tests/builders/user/email.edge.builder.d.ts.map +1 -0
- package/src/@tool-box/tests/builders/user/username.edge.builder.d.ts +1 -0
- package/src/@tool-box/tests/builders/user/username.edge.builder.d.ts.map +1 -0
- package/src/@tool-box/tests/faker/faker.d.ts +1 -0
- package/src/@tool-box/tests/faker/faker.d.ts.map +1 -0
- package/src/@tool-box/utils/convert-units/convert-units.d.ts +1 -0
- package/src/@tool-box/utils/convert-units/convert-units.d.ts.map +1 -0
- package/src/@tool-box/utils/datatypes/boolean-utils.d.ts +1 -0
- package/src/@tool-box/utils/datatypes/boolean-utils.d.ts.map +1 -0
- package/src/@tool-box/utils/datatypes/generic-types.d.ts +1 -0
- package/src/@tool-box/utils/datatypes/generic-types.d.ts.map +1 -0
- package/src/@tool-box/utils/datatypes/plainify.d.ts +1 -0
- package/src/@tool-box/utils/datatypes/plainify.d.ts.map +1 -0
- package/src/@tool-box/utils/datatypes/string-utils.d.ts +1 -0
- package/src/@tool-box/utils/datatypes/string-utils.d.ts.map +1 -0
- package/src/@tool-box/utils/datetime/mappers/month.mapper.d.ts +1 -0
- package/src/@tool-box/utils/datetime/mappers/month.mapper.d.ts.map +1 -0
- package/src/@tool-box/utils/datetime/mappers/points/month-abbreviation.enum.d.ts +1 -0
- package/src/@tool-box/utils/datetime/mappers/points/month-abbreviation.enum.d.ts.map +1 -0
- package/src/@tool-box/utils/datetime/mappers/points/month-number.enum.d.ts +1 -0
- package/src/@tool-box/utils/datetime/mappers/points/month-number.enum.d.ts.map +1 -0
- package/src/@tool-box/utils/ducts/common.d.ts +1 -0
- package/src/@tool-box/utils/ducts/common.d.ts.map +1 -0
- package/src/@tool-box/utils/ducts/optional-type.d.ts +1 -0
- package/src/@tool-box/utils/ducts/optional-type.d.ts.map +1 -0
- package/src/@tool-box/utils/ducts/return-type.d.ts +1 -0
- package/src/@tool-box/utils/ducts/return-type.d.ts.map +1 -0
- package/src/@tool-box/utils/http-provider/http-provider-failure-response.d.ts +1 -0
- package/src/@tool-box/utils/http-provider/http-provider-failure-response.d.ts.map +1 -0
- package/src/@tool-box/utils/http-provider/http-provider-success-response.d.ts +1 -0
- package/src/@tool-box/utils/http-provider/http-provider-success-response.d.ts.map +1 -0
- package/src/@tool-box/utils/http-provider/http-provider.d.ts +1 -0
- package/src/@tool-box/utils/http-provider/http-provider.d.ts.map +1 -0
- package/src/@tool-box/utils/logger/index.d.ts +1 -0
- package/src/@tool-box/utils/logger/index.d.ts.map +1 -0
- package/src/@tool-box/utils/map/map.abstract.d.ts +1 -0
- package/src/@tool-box/utils/map/map.abstract.d.ts.map +1 -0
- package/src/@tool-box/utils/random/random.d.ts +1 -0
- package/src/@tool-box/utils/random/random.d.ts.map +1 -0
- package/src/@tool-box/utils/type-guard/guardian-exception.d.ts +1 -0
- package/src/@tool-box/utils/type-guard/guardian-exception.d.ts.map +1 -0
- package/src/@tool-box/utils/type-guard/guardian.d.ts +1 -0
- package/src/@tool-box/utils/type-guard/guardian.d.ts.map +1 -0
- package/src/@tool-box/utils/type-guard/guardian.type.d.ts +1 -0
- package/src/@tool-box/utils/type-guard/guardian.type.d.ts.map +1 -0
- package/src/@tool-box/utils/validators/is-cron-expression.d.ts +1 -0
- package/src/@tool-box/utils/validators/is-cron-expression.d.ts.map +1 -0
- package/src/@tool-box/utils/validators/is-date-string.d.ts +1 -0
- package/src/@tool-box/utils/validators/is-date-string.d.ts.map +1 -0
- package/src/@tool-box/utils/validators/is-password-match.d.ts +1 -0
- package/src/@tool-box/utils/validators/is-password-match.d.ts.map +1 -0
- package/src/@tool-box/utils/validators/is-password-policy.validator.d.ts +1 -0
- package/src/@tool-box/utils/validators/is-password-policy.validator.d.ts.map +1 -0
- package/src/@tool-box/utils/validators/is-schedule.d.ts +1 -0
- package/src/@tool-box/utils/validators/is-schedule.d.ts.map +1 -0
- package/src/@tool-box/utils/validators/is-time-string.d.ts +1 -0
- package/src/@tool-box/utils/validators/is-time-string.d.ts.map +1 -0
- package/src/@tool-box/utils/validators/is-ulid.d.ts +1 -0
- package/src/@tool-box/utils/validators/is-ulid.d.ts.map +1 -0
- package/src/index.d.ts +1 -0
- package/src/index.d.ts.map +1 -0
- package/src/objects/@common/edges/email.edge.d.ts +1 -0
- package/src/objects/@common/edges/email.edge.d.ts.map +1 -0
- package/src/objects/@common/edges/ulid.sketch.edge.d.ts +1 -0
- package/src/objects/@common/edges/ulid.sketch.edge.d.ts.map +1 -0
- package/src/objects/@common/edges/url.edge.d.ts +1 -0
- package/src/objects/@common/edges/url.edge.d.ts.map +1 -0
- package/src/objects/@common/edges/username.edge.d.ts +1 -0
- package/src/objects/@common/edges/username.edge.d.ts.map +1 -0
- package/src/objects/@common/edges/uuid.sketch.edge.d.ts +1 -0
- package/src/objects/@common/edges/uuid.sketch.edge.d.ts.map +1 -0
- package/src/objects/@common/points/environment.point.d.ts +1 -0
- package/src/objects/@common/points/environment.point.d.ts.map +1 -0
- package/src/objects/@common/points/header-token-name.point.d.ts +1 -0
- package/src/objects/@common/points/header-token-name.point.d.ts.map +1 -0
- package/src/objects/@common/points/http-status-codes.point.d.ts +1 -0
- package/src/objects/@common/points/http-status-codes.point.d.ts.map +1 -0
- package/src/objects/amount/amount-value.edge.d.ts +1 -0
- package/src/objects/amount/amount-value.edge.d.ts.map +1 -0
- package/src/objects/amount/amount.edge.d.ts +142 -132
- package/src/objects/amount/amount.edge.d.ts.map +1 -0
- package/src/objects/amount/amount.polygon.d.ts +1 -0
- package/src/objects/amount/amount.polygon.d.ts.map +1 -0
- package/src/objects/amount/amount.uv.d.ts +2 -1
- package/src/objects/amount/amount.uv.d.ts.map +1 -0
- package/src/objects/amount/points/duration-unit.point.d.ts +1 -0
- package/src/objects/amount/points/duration-unit.point.d.ts.map +1 -0
- package/src/objects/amount/points/energy-unit.point.d.ts +1 -0
- package/src/objects/amount/points/energy-unit.point.d.ts.map +1 -0
- package/src/objects/amount/points/length-unit.point.d.ts +1 -0
- package/src/objects/amount/points/length-unit.point.d.ts.map +1 -0
- package/src/objects/amount/points/mass-unit.point.d.ts +1 -0
- package/src/objects/amount/points/mass-unit.point.d.ts.map +1 -0
- package/src/objects/amount/points/month-name.point.d.ts +1 -0
- package/src/objects/amount/points/month-name.point.d.ts.map +1 -0
- package/src/objects/amount/points/object-unit.point.d.ts +1 -0
- package/src/objects/amount/points/object-unit.point.d.ts.map +1 -0
- package/src/objects/amount/points/units.point.d.ts +1 -0
- package/src/objects/amount/points/units.point.d.ts.map +1 -0
- package/src/objects/amount/points/volume-unit.point.d.ts +1 -0
- package/src/objects/amount/points/volume-unit.point.d.ts.map +1 -0
- package/src/objects/amount/points/week-day.point.d.ts +1 -0
- package/src/objects/amount/points/week-day.point.d.ts.map +1 -0
- package/src/objects/datetime/edges/datetime.edge.d.ts +174 -162
- package/src/objects/datetime/edges/datetime.edge.d.ts.map +1 -0
- package/src/objects/datetime/edges/locale/day/day-name-to-english.mapper.d.ts +5 -0
- package/src/objects/datetime/edges/locale/day/day-name-to-english.mapper.d.ts.map +1 -0
- package/src/objects/datetime/edges/locale/day/day-name-to-portuguese.mapper.d.ts +5 -0
- package/src/objects/datetime/edges/locale/day/day-name-to-portuguese.mapper.d.ts.map +1 -0
- package/src/objects/datetime/edges/locale/day/today-to-language.mapper.d.ts +6 -0
- package/src/objects/datetime/edges/locale/day/today-to-language.mapper.d.ts.map +1 -0
- package/src/objects/datetime/edges/locale/holidays-country.type.d.ts +3 -0
- package/src/objects/datetime/edges/locale/holidays-country.type.d.ts.map +1 -0
- package/src/objects/datetime/edges/locale/month/month-to-english.mapper.d.ts +5 -0
- package/src/objects/datetime/edges/locale/month/month-to-english.mapper.d.ts.map +1 -0
- package/src/objects/datetime/edges/locale/month/month-to-portuguese.mapper.d.ts +5 -0
- package/src/objects/datetime/edges/locale/month/month-to-portuguese.mapper.d.ts.map +1 -0
- package/src/objects/datetime/points/month-name.enum.d.ts +1 -0
- package/src/objects/datetime/points/month-name.enum.d.ts.map +1 -0
- package/src/objects/datetime/points/week-day.enum.d.ts +1 -0
- package/src/objects/datetime/points/week-day.enum.d.ts.map +1 -0
- package/src/objects/failure/edges/failure.abstract.d.ts +1 -0
- package/src/objects/failure/edges/failure.abstract.d.ts.map +1 -0
- package/src/objects/failure/edges/failure.abstract.polygon.d.ts +1 -0
- package/src/objects/failure/edges/failure.abstract.polygon.d.ts.map +1 -0
- package/src/objects/language/points/language.point.d.ts +1 -0
- package/src/objects/language/points/language.point.d.ts.map +1 -0
- package/src/objects/metadata/metadata.edge.d.ts +1 -0
- package/src/objects/metadata/metadata.edge.d.ts.map +1 -0
- package/src/objects/metadata/metadata.polygon.d.ts +1 -0
- package/src/objects/metadata/metadata.polygon.d.ts.map +1 -0
- package/src/objects/metadata/metadata.uv.d.ts +1 -0
- package/src/objects/metadata/metadata.uv.d.ts.map +1 -0
- package/src/objects/password/password.edge.d.ts +1 -0
- package/src/objects/password/password.edge.d.ts.map +1 -0
- package/src/objects/password/password.polygon.d.ts +1 -0
- package/src/objects/password/password.polygon.d.ts.map +1 -0
- package/src/objects/password/steps/not-allowing-consecutive-chars-step.d.ts +1 -0
- package/src/objects/password/steps/not-allowing-consecutive-chars-step.d.ts.map +1 -0
- package/src/objects/password/steps/not-allowing-date-step.d.ts +1 -0
- package/src/objects/password/steps/not-allowing-date-step.d.ts.map +1 -0
- package/src/objects/password/steps/not-allowing-phone-step.d.ts +1 -0
- package/src/objects/password/steps/not-allowing-phone-step.d.ts.map +1 -0
- package/src/objects/password/steps/not-allowing-repeated-chars-step.d.ts +1 -0
- package/src/objects/password/steps/not-allowing-repeated-chars-step.d.ts.map +1 -0
- package/src/objects/password/steps/not-allowing-string-step.d.ts +1 -0
- package/src/objects/password/steps/not-allowing-string-step.d.ts.map +1 -0
- package/src/objects/password/steps/not-allowing-these-chars-step.d.ts +1 -0
- package/src/objects/password/steps/not-allowing-these-chars-step.d.ts.map +1 -0
- package/src/objects/password/steps/numeric-step.d.ts +1 -0
- package/src/objects/password/steps/numeric-step.d.ts.map +1 -0
- package/src/objects/password/steps/with-at-least-one-letter-step.d.ts +1 -0
- package/src/objects/password/steps/with-at-least-one-letter-step.d.ts.map +1 -0
- package/src/objects/password/steps/with-at-least-one-number-digit-step.d.ts +1 -0
- package/src/objects/password/steps/with-at-least-one-number-digit-step.d.ts.map +1 -0
- package/src/objects/password/steps/with-at-least-one-special-char-step.d.ts +1 -0
- package/src/objects/password/steps/with-at-least-one-special-char-step.d.ts.map +1 -0
- package/src/objects/password/steps/with-length-step.d.ts +1 -0
- package/src/objects/password/steps/with-length-step.d.ts.map +1 -0
- package/src/objects/password/validation-step.d.ts +1 -0
- package/src/objects/password/validation-step.d.ts.map +1 -0
- package/src/objects/password/validation-step.type.d.ts +1 -0
- package/src/objects/password/validation-step.type.d.ts.map +1 -0
- package/src/objects/primitives/boolean.edge.sketch.d.ts +1 -0
- package/src/objects/primitives/boolean.edge.sketch.d.ts.map +1 -0
- package/src/objects/primitives/datetime.edge.sketch.d.ts +1 -0
- package/src/objects/primitives/datetime.edge.sketch.d.ts.map +1 -0
- package/src/objects/primitives/number.edge.sketch.d.ts +1 -0
- package/src/objects/primitives/number.edge.sketch.d.ts.map +1 -0
- package/src/objects/primitives/string.edge.sketch.d.ts +1 -0
- package/src/objects/primitives/string.edge.sketch.d.ts.map +1 -0
- package/src/objects/scheduling/scheduling.edge.d.ts +1 -0
- package/src/objects/scheduling/scheduling.edge.d.ts.map +1 -0
- package/src/objects/scheduling/scheduling.edge.failure.d.ts +1 -0
- package/src/objects/scheduling/scheduling.edge.failure.d.ts.map +1 -0
- package/src/objects/time/time.edge.d.ts +1 -0
- package/src/objects/time/time.edge.d.ts.map +1 -0
- package/src/objects-interface/edges/edge.abstract.d.ts +1 -0
- package/src/objects-interface/edges/edge.abstract.d.ts.map +1 -0
- package/src/objects-interface/face.abstract.d.ts +1 -0
- package/src/objects-interface/face.abstract.d.ts.map +1 -0
- package/src/objects-interface/solid.abstract.d.ts +1 -0
- package/src/objects-interface/solid.abstract.d.ts.map +1 -0
- package/src/objects-interface/uv.abstract.d.ts +1 -0
- package/src/objects-interface/uv.abstract.d.ts.map +1 -0
- package/src/objects-interface/vertices/vertex.abstract.d.ts +1 -0
- package/src/objects-interface/vertices/vertex.abstract.d.ts.map +1 -0
- package/src/shared/payload.abstract.d.ts +1 -0
- package/src/shared/payload.abstract.d.ts.map +1 -0
- package/src/shared/request.abstract.d.ts +1 -0
- package/src/shared/request.abstract.d.ts.map +1 -0
- package/src/shared/response.abstract.d.ts +1 -0
- package/src/shared/response.abstract.d.ts.map +1 -0
- package/tsconfig-lib.json +3 -2
- package/tsconfig.build.tsbuildinfo +1 -0
- package/types/boolean.d.ts +19 -0
- package/types/string.d.ts +33 -0
- package/src/@tool-box/tests/builder.abstract.util.js +0 -39
- package/src/@tool-box/tests/builders/datetime/datetime.edge.builder.js +0 -15
- package/src/@tool-box/tests/builders/failures/dummies/failure.dummy.js +0 -13
- package/src/@tool-box/tests/builders/failures/failure.builder.js +0 -17
- package/src/@tool-box/tests/builders/metadata/metadata-uv.builder.js +0 -18
- package/src/@tool-box/tests/builders/metadata/metadata.edge.builder.js +0 -15
- package/src/@tool-box/tests/builders/user/email.edge.builder.js +0 -15
- package/src/@tool-box/tests/builders/user/username.edge.builder.js +0 -15
- package/src/@tool-box/tests/faker/faker.js +0 -208
- package/src/@tool-box/utils/convert-units/convert-units.js +0 -154
- package/src/@tool-box/utils/datatypes/boolean-utils.js +0 -155
- package/src/@tool-box/utils/datatypes/generic-types.js +0 -3
- package/src/@tool-box/utils/datatypes/plainify.js +0 -2
- package/src/@tool-box/utils/datatypes/string-utils.js +0 -292
- package/src/@tool-box/utils/datetime/mappers/month.mapper.js +0 -58
- package/src/@tool-box/utils/datetime/mappers/points/month-abbreviation.enum.js +0 -18
- package/src/@tool-box/utils/datetime/mappers/points/month-number.enum.js +0 -18
- package/src/@tool-box/utils/ducts/common.js +0 -47
- package/src/@tool-box/utils/ducts/optional-type.js +0 -128
- package/src/@tool-box/utils/ducts/return-type.js +0 -67
- package/src/@tool-box/utils/http-provider/http-provider-failure-response.js +0 -19
- package/src/@tool-box/utils/http-provider/http-provider-success-response.js +0 -20
- package/src/@tool-box/utils/http-provider/http-provider.js +0 -85
- package/src/@tool-box/utils/logger/index.js +0 -31
- package/src/@tool-box/utils/map/map.abstract.js +0 -84
- package/src/@tool-box/utils/random/random.js +0 -260
- package/src/@tool-box/utils/type-guard/guardian-exception.js +0 -6
- package/src/@tool-box/utils/type-guard/guardian.js +0 -625
- package/src/@tool-box/utils/type-guard/guardian.type.js +0 -2
- package/src/@tool-box/utils/validators/is-cron-expression.js +0 -39
- package/src/@tool-box/utils/validators/is-date-string.js +0 -42
- package/src/@tool-box/utils/validators/is-password-match.js +0 -27
- package/src/@tool-box/utils/validators/is-password-policy.validator.js +0 -30
- package/src/@tool-box/utils/validators/is-schedule.js +0 -43
- package/src/@tool-box/utils/validators/is-time-string.js +0 -39
- package/src/@tool-box/utils/validators/is-ulid.js +0 -39
- package/src/index.js +0 -179
- package/src/objects/@common/edges/email.edge.js +0 -95
- package/src/objects/@common/edges/ulid.sketch.edge.js +0 -91
- package/src/objects/@common/edges/url.edge.js +0 -269
- package/src/objects/@common/edges/username.edge.js +0 -41
- package/src/objects/@common/edges/uuid.sketch.edge.js +0 -145
- package/src/objects/@common/points/environment.point.js +0 -10
- package/src/objects/@common/points/header-token-name.point.js +0 -10
- package/src/objects/@common/points/http-status-codes.point.js +0 -244
- package/src/objects/amount/amount-value.edge.js +0 -76
- package/src/objects/amount/amount.edge.js +0 -599
- package/src/objects/amount/amount.polygon.js +0 -2
- package/src/objects/amount/amount.uv.js +0 -29
- package/src/objects/amount/points/duration-unit.point.js +0 -15
- package/src/objects/amount/points/energy-unit.point.js +0 -10
- package/src/objects/amount/points/length-unit.point.js +0 -10
- package/src/objects/amount/points/mass-unit.point.js +0 -11
- package/src/objects/amount/points/month-name.point.js +0 -18
- package/src/objects/amount/points/object-unit.point.js +0 -7
- package/src/objects/amount/points/units.point.js +0 -2
- package/src/objects/amount/points/volume-unit.point.js +0 -8
- package/src/objects/amount/points/week-day.point.js +0 -13
- package/src/objects/datetime/edges/datetime.edge.js +0 -683
- package/src/objects/datetime/points/month-name.enum.js +0 -18
- package/src/objects/datetime/points/week-day.enum.js +0 -13
- package/src/objects/failure/edges/failure.abstract.js +0 -24
- package/src/objects/failure/edges/failure.abstract.polygon.js +0 -2
- package/src/objects/language/points/language.point.js +0 -135
- package/src/objects/metadata/metadata.edge.js +0 -25
- package/src/objects/metadata/metadata.polygon.js +0 -2
- package/src/objects/metadata/metadata.uv.js +0 -29
- package/src/objects/password/password.edge.js +0 -175
- package/src/objects/password/password.polygon.js +0 -2
- package/src/objects/password/steps/not-allowing-consecutive-chars-step.js +0 -34
- package/src/objects/password/steps/not-allowing-date-step.js +0 -61
- package/src/objects/password/steps/not-allowing-phone-step.js +0 -27
- package/src/objects/password/steps/not-allowing-repeated-chars-step.js +0 -34
- package/src/objects/password/steps/not-allowing-string-step.js +0 -19
- package/src/objects/password/steps/not-allowing-these-chars-step.js +0 -17
- package/src/objects/password/steps/numeric-step.js +0 -13
- package/src/objects/password/steps/with-at-least-one-letter-step.js +0 -14
- package/src/objects/password/steps/with-at-least-one-number-digit-step.js +0 -14
- package/src/objects/password/steps/with-at-least-one-special-char-step.js +0 -14
- package/src/objects/password/steps/with-length-step.js +0 -18
- package/src/objects/password/validation-step.js +0 -9
- package/src/objects/password/validation-step.type.js +0 -2
- package/src/objects/primitives/boolean.edge.sketch.js +0 -147
- package/src/objects/primitives/datetime.edge.sketch.js +0 -7
- package/src/objects/primitives/number.edge.sketch.js +0 -346
- package/src/objects/primitives/string.edge.sketch.js +0 -218
- package/src/objects/scheduling/scheduling.edge.failure.js +0 -14
- package/src/objects/scheduling/scheduling.edge.js +0 -280
- package/src/objects/time/time.edge.js +0 -447
- package/src/objects-interface/edges/edge.abstract.js +0 -6
- package/src/objects-interface/face.abstract.js +0 -6
- package/src/objects-interface/solid.abstract.js +0 -11
- package/src/objects-interface/uv.abstract.js +0 -6
- package/src/objects-interface/vertices/vertex.abstract.js +0 -11
- package/src/shared/payload.abstract.js +0 -6
- package/src/shared/request.abstract.js +0 -3
- package/src/shared/response.abstract.js +0 -6
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -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
|
-
};
|