@bgord/tools 1.4.0 → 1.4.2
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/{src/day.vo.d.ts → day.vo.d.ts} +1 -1
- package/dist/{src/day.vo.js → day.vo.js} +3 -3
- package/dist/{src/index.d.ts → index.d.ts} +1 -0
- package/dist/{src/index.js → index.js} +1 -0
- package/dist/int.vo.d.ts +8 -0
- package/dist/int.vo.js +15 -0
- package/dist/{src/month.vo.d.ts → month.vo.d.ts} +1 -1
- package/dist/{src/month.vo.js → month.vo.js} +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{src/week.vo.d.ts → week.vo.d.ts} +1 -1
- package/dist/{src/week.vo.js → week.vo.js} +3 -3
- package/dist/{src/year.vo.d.ts → year.vo.d.ts} +1 -1
- package/dist/{src/year.vo.js → year.vo.js} +3 -3
- package/package.json +2 -2
- package/readme.md +1 -0
- package/dist/tests/age-years.vo.test.d.ts +0 -1
- package/dist/tests/age-years.vo.test.js +0 -24
- package/dist/tests/age.vo.test.d.ts +0 -1
- package/dist/tests/age.vo.test.js +0 -106
- package/dist/tests/api-key.vo.test.d.ts +0 -1
- package/dist/tests/api-key.vo.test.js +0 -24
- package/dist/tests/basename.vo.test.d.ts +0 -1
- package/dist/tests/basename.vo.test.js +0 -53
- package/dist/tests/batch.test.d.ts +0 -1
- package/dist/tests/batch.test.js +0 -24
- package/dist/tests/date-calculator.service.test.d.ts +0 -1
- package/dist/tests/date-calculator.service.test.js +0 -32
- package/dist/tests/date-formatter.service.test.d.ts +0 -1
- package/dist/tests/date-formatter.service.test.js +0 -22
- package/dist/tests/date-range.vo.test.d.ts +0 -1
- package/dist/tests/date-range.vo.test.js +0 -49
- package/dist/tests/day-iso-id.vo.test.d.ts +0 -1
- package/dist/tests/day-iso-id.vo.test.js +0 -36
- package/dist/tests/day.vo.test.d.ts +0 -1
- package/dist/tests/day.vo.test.js +0 -68
- package/dist/tests/directory-path-absolute.vo.test.d.ts +0 -1
- package/dist/tests/directory-path-absolute.vo.test.js +0 -47
- package/dist/tests/directory-path-relative.vo.test.d.ts +0 -1
- package/dist/tests/directory-path-relative.vo.test.js +0 -44
- package/dist/tests/distance-value.vo.test.d.ts +0 -1
- package/dist/tests/distance-value.vo.test.js +0 -21
- package/dist/tests/distance.vo.test.d.ts +0 -1
- package/dist/tests/distance.vo.test.js +0 -74
- package/dist/tests/division-factor.vo.test.d.ts +0 -1
- package/dist/tests/division-factor.vo.test.js +0 -21
- package/dist/tests/dll.service.test.d.ts +0 -1
- package/dist/tests/dll.service.test.js +0 -381
- package/dist/tests/duration-ms.vo.test.d.ts +0 -1
- package/dist/tests/duration-ms.vo.test.js +0 -18
- package/dist/tests/duration.service.test.d.ts +0 -1
- package/dist/tests/duration.service.test.js +0 -126
- package/dist/tests/email-mask.service.test.d.ts +0 -1
- package/dist/tests/email-mask.service.test.js +0 -15
- package/dist/tests/email.vo.test.d.ts +0 -1
- package/dist/tests/email.vo.test.js +0 -17
- package/dist/tests/etags.vo.test.d.ts +0 -1
- package/dist/tests/etags.vo.test.js +0 -54
- package/dist/tests/extension.vo.test.d.ts +0 -1
- package/dist/tests/extension.vo.test.js +0 -51
- package/dist/tests/feature-flag-value.vo.test.d.ts +0 -1
- package/dist/tests/feature-flag-value.vo.test.js +0 -12
- package/dist/tests/feature-flag.vo.test.d.ts +0 -1
- package/dist/tests/feature-flag.vo.test.js +0 -13
- package/dist/tests/file-path-absolute-schema.vo.test.d.ts +0 -1
- package/dist/tests/file-path-absolute-schema.vo.test.js +0 -53
- package/dist/tests/file-path-relative-schema.vo.test.d.ts +0 -1
- package/dist/tests/file-path-relative-schema.vo.test.js +0 -52
- package/dist/tests/file-path.vo.test.d.ts +0 -1
- package/dist/tests/file-path.vo.test.js +0 -74
- package/dist/tests/filename-affix.vo.test.d.ts +0 -1
- package/dist/tests/filename-affix.vo.test.js +0 -30
- package/dist/tests/filename-from-string.vo.test.d.ts +0 -1
- package/dist/tests/filename-from-string.vo.test.js +0 -37
- package/dist/tests/filename.vo.test.d.ts +0 -1
- package/dist/tests/filename.vo.test.js +0 -93
- package/dist/tests/height-milimiters.vo.test.d.ts +0 -1
- package/dist/tests/height-milimiters.vo.test.js +0 -21
- package/dist/tests/height.vo.test.d.ts +0 -1
- package/dist/tests/height.vo.test.js +0 -64
- package/dist/tests/hour-value.vo.test.d.ts +0 -1
- package/dist/tests/hour-value.vo.test.js +0 -24
- package/dist/tests/hour.vo.test.d.ts +0 -1
- package/dist/tests/hour.vo.test.js +0 -64
- package/dist/tests/iban-mask.service.test.d.ts +0 -1
- package/dist/tests/iban-mask.service.test.js +0 -13
- package/dist/tests/iban-schema.vo.test.d.ts +0 -1
- package/dist/tests/iban-schema.vo.test.js +0 -43
- package/dist/tests/iban.vo.test.d.ts +0 -1
- package/dist/tests/iban.vo.test.js +0 -46
- package/dist/tests/image.vo.test.d.ts +0 -1
- package/dist/tests/image.vo.test.js +0 -41
- package/dist/tests/integer-non-negative.vo.test.d.ts +0 -1
- package/dist/tests/integer-non-negative.vo.test.js +0 -22
- package/dist/tests/integer-positive.vo.test.d.ts +0 -1
- package/dist/tests/integer-positive.vo.test.js +0 -21
- package/dist/tests/integer.vo.test.d.ts +0 -1
- package/dist/tests/integer.vo.test.js +0 -21
- package/dist/tests/language.vo.test.d.ts +0 -1
- package/dist/tests/language.vo.test.js +0 -28
- package/dist/tests/linear-regression.service.test.d.ts +0 -1
- package/dist/tests/linear-regression.service.test.js +0 -111
- package/dist/tests/mean.service.test.d.ts +0 -1
- package/dist/tests/mean.service.test.js +0 -23
- package/dist/tests/mime-registry-entry.vo.test.d.ts +0 -1
- package/dist/tests/mime-registry-entry.vo.test.js +0 -15
- package/dist/tests/mime-registry.service.test.d.ts +0 -1
- package/dist/tests/mime-registry.service.test.js +0 -45
- package/dist/tests/mime-value.vo.test.d.ts +0 -1
- package/dist/tests/mime-value.vo.test.js +0 -49
- package/dist/tests/mime.vo.test.d.ts +0 -1
- package/dist/tests/mime.vo.test.js +0 -53
- package/dist/tests/mimes.test.d.ts +0 -1
- package/dist/tests/mimes.test.js +0 -28
- package/dist/tests/min-max-scaler.service.test.d.ts +0 -1
- package/dist/tests/min-max-scaler.service.test.js +0 -116
- package/dist/tests/minute-value.vo.test.d.ts +0 -1
- package/dist/tests/minute-value.vo.test.js +0 -24
- package/dist/tests/minute.vo.test.d.ts +0 -1
- package/dist/tests/minute.vo.test.js +0 -64
- package/dist/tests/mocks.d.ts +0 -6
- package/dist/tests/mocks.js +0 -7
- package/dist/tests/money-amount.vo.test.d.ts +0 -1
- package/dist/tests/money-amount.vo.test.js +0 -21
- package/dist/tests/money.vo.test.d.ts +0 -1
- package/dist/tests/money.vo.test.js +0 -90
- package/dist/tests/month-iso-id.vo.test.d.ts +0 -1
- package/dist/tests/month-iso-id.vo.test.js +0 -36
- package/dist/tests/month.vo.test.d.ts +0 -1
- package/dist/tests/month.vo.test.js +0 -65
- package/dist/tests/multiplication-factor.vo.test.d.ts +0 -1
- package/dist/tests/multiplication-factor.vo.test.js +0 -19
- package/dist/tests/noop.test.d.ts +0 -1
- package/dist/tests/noop.test.js +0 -12
- package/dist/tests/object-key.vo.test.d.ts +0 -1
- package/dist/tests/object-key.vo.test.js +0 -56
- package/dist/tests/outlier-detector.service.test.d.ts +0 -1
- package/dist/tests/outlier-detector.service.test.js +0 -35
- package/dist/tests/package-version-schema.vo.test.d.ts +0 -1
- package/dist/tests/package-version-schema.vo.test.js +0 -32
- package/dist/tests/package-version.vo.test.d.ts +0 -1
- package/dist/tests/package-version.vo.test.js +0 -138
- package/dist/tests/pagination-page.vo.test.d.ts +0 -1
- package/dist/tests/pagination-page.vo.test.js +0 -26
- package/dist/tests/pagination-skip.vo.test.d.ts +0 -1
- package/dist/tests/pagination-skip.vo.test.js +0 -23
- package/dist/tests/pagination-take.vo.test.d.ts +0 -1
- package/dist/tests/pagination-take.vo.test.js +0 -25
- package/dist/tests/pagination.service.test.d.ts +0 -1
- package/dist/tests/pagination.service.test.js +0 -92
- package/dist/tests/percentage.service.test.d.ts +0 -1
- package/dist/tests/percentage.service.test.js +0 -16
- package/dist/tests/population-standard-deviation.service.test.d.ts +0 -1
- package/dist/tests/population-standard-deviation.service.test.js +0 -20
- package/dist/tests/quarter-iso-id.vo.test.d.ts +0 -1
- package/dist/tests/quarter-iso-id.vo.test.js +0 -30
- package/dist/tests/quarter.vo.test.d.ts +0 -1
- package/dist/tests/quarter.vo.test.js +0 -54
- package/dist/tests/random.service.test.d.ts +0 -1
- package/dist/tests/random.service.test.js +0 -93
- package/dist/tests/rate-limiter.service.test.d.ts +0 -1
- package/dist/tests/rate-limiter.service.test.js +0 -39
- package/dist/tests/relative-date.vo.test.d.ts +0 -1
- package/dist/tests/relative-date.vo.test.js +0 -22
- package/dist/tests/reordering-item-position-value.vo.test.d.ts +0 -1
- package/dist/tests/reordering-item-position-value.vo.test.js +0 -21
- package/dist/tests/reordering.service.test.d.ts +0 -1
- package/dist/tests/reordering.service.test.js +0 -76
- package/dist/tests/repeat.test.d.ts +0 -1
- package/dist/tests/repeat.test.js +0 -8
- package/dist/tests/revision-value.vo.test.d.ts +0 -1
- package/dist/tests/revision-value.vo.test.js +0 -21
- package/dist/tests/revision.vo.test.d.ts +0 -1
- package/dist/tests/revision.vo.test.js +0 -52
- package/dist/tests/rounding-decimal.strategy.test.d.ts +0 -1
- package/dist/tests/rounding-decimal.strategy.test.js +0 -17
- package/dist/tests/rounding-down.strategy.test.d.ts +0 -1
- package/dist/tests/rounding-down.strategy.test.js +0 -9
- package/dist/tests/rounding-to-nearest.strategy.test.d.ts +0 -1
- package/dist/tests/rounding-to-nearest.strategy.test.js +0 -9
- package/dist/tests/rounding-up.strategy.test.d.ts +0 -1
- package/dist/tests/rounding-up.strategy.test.js +0 -9
- package/dist/tests/size-bytes.vo.test.d.ts +0 -1
- package/dist/tests/size-bytes.vo.test.js +0 -21
- package/dist/tests/size.vo.test.d.ts +0 -1
- package/dist/tests/size.vo.test.js +0 -93
- package/dist/tests/slug.service.test.d.ts +0 -1
- package/dist/tests/slug.service.test.js +0 -45
- package/dist/tests/sum.service.test.d.ts +0 -1
- package/dist/tests/sum.service.test.js +0 -22
- package/dist/tests/thousands-separator.service.test.d.ts +0 -1
- package/dist/tests/thousands-separator.service.test.js +0 -27
- package/dist/tests/time-zone-offset-value.test.d.ts +0 -1
- package/dist/tests/time-zone-offset-value.test.js +0 -27
- package/dist/tests/timestamp-value.vo.test.d.ts +0 -1
- package/dist/tests/timestamp-value.vo.test.js +0 -21
- package/dist/tests/timestamp.vo.test.d.ts +0 -1
- package/dist/tests/timestamp.vo.test.js +0 -73
- package/dist/tests/timezone.vo.test.d.ts +0 -1
- package/dist/tests/timezone.vo.test.js +0 -29
- package/dist/tests/url-with-slash.vo.test.d.ts +0 -1
- package/dist/tests/url-with-slash.vo.test.js +0 -24
- package/dist/tests/url-without-slash.vo.test.d.ts +0 -1
- package/dist/tests/url-without-slash.vo.test.js +0 -25
- package/dist/tests/visually-unambiguous-characters-generator.service.test.d.ts +0 -1
- package/dist/tests/visually-unambiguous-characters-generator.service.test.js +0 -89
- package/dist/tests/week-iso-id.vo.test.d.ts +0 -1
- package/dist/tests/week-iso-id.vo.test.js +0 -37
- package/dist/tests/week.vo.test.d.ts +0 -1
- package/dist/tests/week.vo.test.js +0 -64
- package/dist/tests/weekday-iso-id.vo.test.d.ts +0 -1
- package/dist/tests/weekday-iso-id.vo.test.js +0 -24
- package/dist/tests/weekday.vo.test.d.ts +0 -1
- package/dist/tests/weekday.vo.test.js +0 -51
- package/dist/tests/weight-grams.vo.test.d.ts +0 -1
- package/dist/tests/weight-grams.vo.test.js +0 -21
- package/dist/tests/weight.vo.test.d.ts +0 -1
- package/dist/tests/weight.vo.test.js +0 -66
- package/dist/tests/year-iso-id.vo.test.d.ts +0 -1
- package/dist/tests/year-iso-id.vo.test.js +0 -23
- package/dist/tests/year.vo.test.d.ts +0 -1
- package/dist/tests/year.vo.test.js +0 -79
- package/dist/tests/z-score.service.test.d.ts +0 -1
- package/dist/tests/z-score.service.test.js +0 -26
- /package/dist/{src/age-years.vo.d.ts → age-years.vo.d.ts} +0 -0
- /package/dist/{src/age-years.vo.js → age-years.vo.js} +0 -0
- /package/dist/{src/age.vo.d.ts → age.vo.d.ts} +0 -0
- /package/dist/{src/age.vo.js → age.vo.js} +0 -0
- /package/dist/{src/api-key.vo.d.ts → api-key.vo.d.ts} +0 -0
- /package/dist/{src/api-key.vo.js → api-key.vo.js} +0 -0
- /package/dist/{src/basename.vo.d.ts → basename.vo.d.ts} +0 -0
- /package/dist/{src/basename.vo.js → basename.vo.js} +0 -0
- /package/dist/{src/batch.d.ts → batch.d.ts} +0 -0
- /package/dist/{src/batch.js → batch.js} +0 -0
- /package/dist/{src/date-calculator.service.d.ts → date-calculator.service.d.ts} +0 -0
- /package/dist/{src/date-calculator.service.js → date-calculator.service.js} +0 -0
- /package/dist/{src/date-formatter.service.d.ts → date-formatter.service.d.ts} +0 -0
- /package/dist/{src/date-formatter.service.js → date-formatter.service.js} +0 -0
- /package/dist/{src/date-range.vo.d.ts → date-range.vo.d.ts} +0 -0
- /package/dist/{src/date-range.vo.js → date-range.vo.js} +0 -0
- /package/dist/{src/day-iso-id.vo.d.ts → day-iso-id.vo.d.ts} +0 -0
- /package/dist/{src/day-iso-id.vo.js → day-iso-id.vo.js} +0 -0
- /package/dist/{src/directory-path-absolute.vo.d.ts → directory-path-absolute.vo.d.ts} +0 -0
- /package/dist/{src/directory-path-absolute.vo.js → directory-path-absolute.vo.js} +0 -0
- /package/dist/{src/directory-path-relative.vo.d.ts → directory-path-relative.vo.d.ts} +0 -0
- /package/dist/{src/directory-path-relative.vo.js → directory-path-relative.vo.js} +0 -0
- /package/dist/{src/distance-value.vo.d.ts → distance-value.vo.d.ts} +0 -0
- /package/dist/{src/distance-value.vo.js → distance-value.vo.js} +0 -0
- /package/dist/{src/distance.vo.d.ts → distance.vo.d.ts} +0 -0
- /package/dist/{src/distance.vo.js → distance.vo.js} +0 -0
- /package/dist/{src/division-factor.vo.d.ts → division-factor.vo.d.ts} +0 -0
- /package/dist/{src/division-factor.vo.js → division-factor.vo.js} +0 -0
- /package/dist/{src/dll.service.d.ts → dll.service.d.ts} +0 -0
- /package/dist/{src/dll.service.js → dll.service.js} +0 -0
- /package/dist/{src/duration-ms.vo.d.ts → duration-ms.vo.d.ts} +0 -0
- /package/dist/{src/duration-ms.vo.js → duration-ms.vo.js} +0 -0
- /package/dist/{src/duration.service.d.ts → duration.service.d.ts} +0 -0
- /package/dist/{src/duration.service.js → duration.service.js} +0 -0
- /package/dist/{src/email-mask.service.d.ts → email-mask.service.d.ts} +0 -0
- /package/dist/{src/email-mask.service.js → email-mask.service.js} +0 -0
- /package/dist/{src/email.vo.d.ts → email.vo.d.ts} +0 -0
- /package/dist/{src/email.vo.js → email.vo.js} +0 -0
- /package/dist/{src/etags.vo.d.ts → etags.vo.d.ts} +0 -0
- /package/dist/{src/etags.vo.js → etags.vo.js} +0 -0
- /package/dist/{src/extension.vo.d.ts → extension.vo.d.ts} +0 -0
- /package/dist/{src/extension.vo.js → extension.vo.js} +0 -0
- /package/dist/{src/feature-flag-value.vo.d.ts → feature-flag-value.vo.d.ts} +0 -0
- /package/dist/{src/feature-flag-value.vo.js → feature-flag-value.vo.js} +0 -0
- /package/dist/{src/feature-flag.vo.d.ts → feature-flag.vo.d.ts} +0 -0
- /package/dist/{src/feature-flag.vo.js → feature-flag.vo.js} +0 -0
- /package/dist/{src/file-path-absolute-schema.vo.d.ts → file-path-absolute-schema.vo.d.ts} +0 -0
- /package/dist/{src/file-path-absolute-schema.vo.js → file-path-absolute-schema.vo.js} +0 -0
- /package/dist/{src/file-path-relative-schema.vo.d.ts → file-path-relative-schema.vo.d.ts} +0 -0
- /package/dist/{src/file-path-relative-schema.vo.js → file-path-relative-schema.vo.js} +0 -0
- /package/dist/{src/file-path.vo.d.ts → file-path.vo.d.ts} +0 -0
- /package/dist/{src/file-path.vo.js → file-path.vo.js} +0 -0
- /package/dist/{src/filename-affix.vo.d.ts → filename-affix.vo.d.ts} +0 -0
- /package/dist/{src/filename-affix.vo.js → filename-affix.vo.js} +0 -0
- /package/dist/{src/filename-from-string.vo.d.ts → filename-from-string.vo.d.ts} +0 -0
- /package/dist/{src/filename-from-string.vo.js → filename-from-string.vo.js} +0 -0
- /package/dist/{src/filename.vo.d.ts → filename.vo.d.ts} +0 -0
- /package/dist/{src/filename.vo.js → filename.vo.js} +0 -0
- /package/dist/{src/height-milimiters.vo.d.ts → height-milimiters.vo.d.ts} +0 -0
- /package/dist/{src/height-milimiters.vo.js → height-milimiters.vo.js} +0 -0
- /package/dist/{src/height.vo.d.ts → height.vo.d.ts} +0 -0
- /package/dist/{src/height.vo.js → height.vo.js} +0 -0
- /package/dist/{src/hour-value.vo.d.ts → hour-value.vo.d.ts} +0 -0
- /package/dist/{src/hour-value.vo.js → hour-value.vo.js} +0 -0
- /package/dist/{src/hour.vo.d.ts → hour.vo.d.ts} +0 -0
- /package/dist/{src/hour.vo.js → hour.vo.js} +0 -0
- /package/dist/{src/iban-mask.service.d.ts → iban-mask.service.d.ts} +0 -0
- /package/dist/{src/iban-mask.service.js → iban-mask.service.js} +0 -0
- /package/dist/{src/iban-schema.vo.d.ts → iban-schema.vo.d.ts} +0 -0
- /package/dist/{src/iban-schema.vo.js → iban-schema.vo.js} +0 -0
- /package/dist/{src/iban.vo.d.ts → iban.vo.d.ts} +0 -0
- /package/dist/{src/iban.vo.js → iban.vo.js} +0 -0
- /package/dist/{src/image.vo.d.ts → image.vo.d.ts} +0 -0
- /package/dist/{src/image.vo.js → image.vo.js} +0 -0
- /package/dist/{src/integer-non-negative.vo.d.ts → integer-non-negative.vo.d.ts} +0 -0
- /package/dist/{src/integer-non-negative.vo.js → integer-non-negative.vo.js} +0 -0
- /package/dist/{src/integer-positive.vo.d.ts → integer-positive.vo.d.ts} +0 -0
- /package/dist/{src/integer-positive.vo.js → integer-positive.vo.js} +0 -0
- /package/dist/{src/integer.vo.d.ts → integer.vo.d.ts} +0 -0
- /package/dist/{src/integer.vo.js → integer.vo.js} +0 -0
- /package/dist/{src/language.vo.d.ts → language.vo.d.ts} +0 -0
- /package/dist/{src/language.vo.js → language.vo.js} +0 -0
- /package/dist/{src/linear-regression.service.d.ts → linear-regression.service.d.ts} +0 -0
- /package/dist/{src/linear-regression.service.js → linear-regression.service.js} +0 -0
- /package/dist/{src/mean.service.d.ts → mean.service.d.ts} +0 -0
- /package/dist/{src/mean.service.js → mean.service.js} +0 -0
- /package/dist/{src/mime-registry-entry.vo.d.ts → mime-registry-entry.vo.d.ts} +0 -0
- /package/dist/{src/mime-registry-entry.vo.js → mime-registry-entry.vo.js} +0 -0
- /package/dist/{src/mime-registry.service.d.ts → mime-registry.service.d.ts} +0 -0
- /package/dist/{src/mime-registry.service.js → mime-registry.service.js} +0 -0
- /package/dist/{src/mime-value.vo.d.ts → mime-value.vo.d.ts} +0 -0
- /package/dist/{src/mime-value.vo.js → mime-value.vo.js} +0 -0
- /package/dist/{src/mime.vo.d.ts → mime.vo.d.ts} +0 -0
- /package/dist/{src/mime.vo.js → mime.vo.js} +0 -0
- /package/dist/{src/mimes.d.ts → mimes.d.ts} +0 -0
- /package/dist/{src/mimes.js → mimes.js} +0 -0
- /package/dist/{src/min-max-scaler.service.d.ts → min-max-scaler.service.d.ts} +0 -0
- /package/dist/{src/min-max-scaler.service.js → min-max-scaler.service.js} +0 -0
- /package/dist/{src/minute-value.vo.d.ts → minute-value.vo.d.ts} +0 -0
- /package/dist/{src/minute-value.vo.js → minute-value.vo.js} +0 -0
- /package/dist/{src/minute.vo.d.ts → minute.vo.d.ts} +0 -0
- /package/dist/{src/minute.vo.js → minute.vo.js} +0 -0
- /package/dist/{src/money-amount.vo.d.ts → money-amount.vo.d.ts} +0 -0
- /package/dist/{src/money-amount.vo.js → money-amount.vo.js} +0 -0
- /package/dist/{src/money.vo.d.ts → money.vo.d.ts} +0 -0
- /package/dist/{src/money.vo.js → money.vo.js} +0 -0
- /package/dist/{src/month-iso-id.vo.d.ts → month-iso-id.vo.d.ts} +0 -0
- /package/dist/{src/month-iso-id.vo.js → month-iso-id.vo.js} +0 -0
- /package/dist/{src/multiplication-factor.vo.d.ts → multiplication-factor.vo.d.ts} +0 -0
- /package/dist/{src/multiplication-factor.vo.js → multiplication-factor.vo.js} +0 -0
- /package/dist/{src/noop.service.d.ts → noop.service.d.ts} +0 -0
- /package/dist/{src/noop.service.js → noop.service.js} +0 -0
- /package/dist/{src/object-key.vo.d.ts → object-key.vo.d.ts} +0 -0
- /package/dist/{src/object-key.vo.js → object-key.vo.js} +0 -0
- /package/dist/{src/outlier-detector.service.d.ts → outlier-detector.service.d.ts} +0 -0
- /package/dist/{src/outlier-detector.service.js → outlier-detector.service.js} +0 -0
- /package/dist/{src/package-version-schema.vo.d.ts → package-version-schema.vo.d.ts} +0 -0
- /package/dist/{src/package-version-schema.vo.js → package-version-schema.vo.js} +0 -0
- /package/dist/{src/package-version.vo.d.ts → package-version.vo.d.ts} +0 -0
- /package/dist/{src/package-version.vo.js → package-version.vo.js} +0 -0
- /package/dist/{src/pagination-page.vo.d.ts → pagination-page.vo.d.ts} +0 -0
- /package/dist/{src/pagination-page.vo.js → pagination-page.vo.js} +0 -0
- /package/dist/{src/pagination-skip.vo.d.ts → pagination-skip.vo.d.ts} +0 -0
- /package/dist/{src/pagination-skip.vo.js → pagination-skip.vo.js} +0 -0
- /package/dist/{src/pagination-take.vo.d.ts → pagination-take.vo.d.ts} +0 -0
- /package/dist/{src/pagination-take.vo.js → pagination-take.vo.js} +0 -0
- /package/dist/{src/pagination.service.d.ts → pagination.service.d.ts} +0 -0
- /package/dist/{src/pagination.service.js → pagination.service.js} +0 -0
- /package/dist/{src/percentage.service.d.ts → percentage.service.d.ts} +0 -0
- /package/dist/{src/percentage.service.js → percentage.service.js} +0 -0
- /package/dist/{src/population-standard-deviation.service.d.ts → population-standard-deviation.service.d.ts} +0 -0
- /package/dist/{src/population-standard-deviation.service.js → population-standard-deviation.service.js} +0 -0
- /package/dist/{src/quarter-iso-id.vo.d.ts → quarter-iso-id.vo.d.ts} +0 -0
- /package/dist/{src/quarter-iso-id.vo.js → quarter-iso-id.vo.js} +0 -0
- /package/dist/{src/quarter.vo.d.ts → quarter.vo.d.ts} +0 -0
- /package/dist/{src/quarter.vo.js → quarter.vo.js} +0 -0
- /package/dist/{src/random.service.d.ts → random.service.d.ts} +0 -0
- /package/dist/{src/random.service.js → random.service.js} +0 -0
- /package/dist/{src/rate-limiter.service.d.ts → rate-limiter.service.d.ts} +0 -0
- /package/dist/{src/rate-limiter.service.js → rate-limiter.service.js} +0 -0
- /package/dist/{src/relative-date.vo.d.ts → relative-date.vo.d.ts} +0 -0
- /package/dist/{src/relative-date.vo.js → relative-date.vo.js} +0 -0
- /package/dist/{src/reordering-item-position-value.vo.d.ts → reordering-item-position-value.vo.d.ts} +0 -0
- /package/dist/{src/reordering-item-position-value.vo.js → reordering-item-position-value.vo.js} +0 -0
- /package/dist/{src/reordering.service.d.ts → reordering.service.d.ts} +0 -0
- /package/dist/{src/reordering.service.js → reordering.service.js} +0 -0
- /package/dist/{src/repeat.d.ts → repeat.d.ts} +0 -0
- /package/dist/{src/repeat.js → repeat.js} +0 -0
- /package/dist/{src/revision-value.vo.d.ts → revision-value.vo.d.ts} +0 -0
- /package/dist/{src/revision-value.vo.js → revision-value.vo.js} +0 -0
- /package/dist/{src/revision.vo.d.ts → revision.vo.d.ts} +0 -0
- /package/dist/{src/revision.vo.js → revision.vo.js} +0 -0
- /package/dist/{src/rounding-decimal.strategy.d.ts → rounding-decimal.strategy.d.ts} +0 -0
- /package/dist/{src/rounding-decimal.strategy.js → rounding-decimal.strategy.js} +0 -0
- /package/dist/{src/rounding-down.strategy.d.ts → rounding-down.strategy.d.ts} +0 -0
- /package/dist/{src/rounding-down.strategy.js → rounding-down.strategy.js} +0 -0
- /package/dist/{src/rounding-to-nearest.strategy.d.ts → rounding-to-nearest.strategy.d.ts} +0 -0
- /package/dist/{src/rounding-to-nearest.strategy.js → rounding-to-nearest.strategy.js} +0 -0
- /package/dist/{src/rounding-up.strategy.d.ts → rounding-up.strategy.d.ts} +0 -0
- /package/dist/{src/rounding-up.strategy.js → rounding-up.strategy.js} +0 -0
- /package/dist/{src/rounding.strategy.d.ts → rounding.strategy.d.ts} +0 -0
- /package/dist/{src/rounding.strategy.js → rounding.strategy.js} +0 -0
- /package/dist/{src/size-bytes.vo.d.ts → size-bytes.vo.d.ts} +0 -0
- /package/dist/{src/size-bytes.vo.js → size-bytes.vo.js} +0 -0
- /package/dist/{src/size.vo.d.ts → size.vo.d.ts} +0 -0
- /package/dist/{src/size.vo.js → size.vo.js} +0 -0
- /package/dist/{src/slug.service.d.ts → slug.service.d.ts} +0 -0
- /package/dist/{src/slug.service.js → slug.service.js} +0 -0
- /package/dist/{src/sum.service.d.ts → sum.service.d.ts} +0 -0
- /package/dist/{src/sum.service.js → sum.service.js} +0 -0
- /package/dist/{src/thousands-separator.service.d.ts → thousands-separator.service.d.ts} +0 -0
- /package/dist/{src/thousands-separator.service.js → thousands-separator.service.js} +0 -0
- /package/dist/{src/time-zone-offset-value.vo.d.ts → time-zone-offset-value.vo.d.ts} +0 -0
- /package/dist/{src/time-zone-offset-value.vo.js → time-zone-offset-value.vo.js} +0 -0
- /package/dist/{src/timestamp-value.vo.d.ts → timestamp-value.vo.d.ts} +0 -0
- /package/dist/{src/timestamp-value.vo.js → timestamp-value.vo.js} +0 -0
- /package/dist/{src/timestamp.vo.d.ts → timestamp.vo.d.ts} +0 -0
- /package/dist/{src/timestamp.vo.js → timestamp.vo.js} +0 -0
- /package/dist/{src/timezone.vo.d.ts → timezone.vo.d.ts} +0 -0
- /package/dist/{src/timezone.vo.js → timezone.vo.js} +0 -0
- /package/dist/{src/ts-utils.d.ts → ts-utils.d.ts} +0 -0
- /package/dist/{src/ts-utils.js → ts-utils.js} +0 -0
- /package/dist/{src/url-with-slash.vo.d.ts → url-with-slash.vo.d.ts} +0 -0
- /package/dist/{src/url-with-slash.vo.js → url-with-slash.vo.js} +0 -0
- /package/dist/{src/url-without-slash.vo.d.ts → url-without-slash.vo.d.ts} +0 -0
- /package/dist/{src/url-without-slash.vo.js → url-without-slash.vo.js} +0 -0
- /package/dist/{src/visually-unambiguous-characters-generator.service.d.ts → visually-unambiguous-characters-generator.service.d.ts} +0 -0
- /package/dist/{src/visually-unambiguous-characters-generator.service.js → visually-unambiguous-characters-generator.service.js} +0 -0
- /package/dist/{src/week-iso-id.vo.d.ts → week-iso-id.vo.d.ts} +0 -0
- /package/dist/{src/week-iso-id.vo.js → week-iso-id.vo.js} +0 -0
- /package/dist/{src/weekday-iso-id.vo.d.ts → weekday-iso-id.vo.d.ts} +0 -0
- /package/dist/{src/weekday-iso-id.vo.js → weekday-iso-id.vo.js} +0 -0
- /package/dist/{src/weekday.vo.d.ts → weekday.vo.d.ts} +0 -0
- /package/dist/{src/weekday.vo.js → weekday.vo.js} +0 -0
- /package/dist/{src/weight-grams.vo.d.ts → weight-grams.vo.d.ts} +0 -0
- /package/dist/{src/weight-grams.vo.js → weight-grams.vo.js} +0 -0
- /package/dist/{src/weight.vo.d.ts → weight.vo.d.ts} +0 -0
- /package/dist/{src/weight.vo.js → weight.vo.js} +0 -0
- /package/dist/{src/year-iso-id.vo.d.ts → year-iso-id.vo.d.ts} +0 -0
- /package/dist/{src/year-iso-id.vo.js → year-iso-id.vo.js} +0 -0
- /package/dist/{src/z-score.service.d.ts → z-score.service.d.ts} +0 -0
- /package/dist/{src/z-score.service.js → z-score.service.js} +0 -0
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import * as v from "valibot";
|
|
3
|
-
import { IbanSchema } from "../src/iban-schema.vo";
|
|
4
|
-
describe("IBAN", () => {
|
|
5
|
-
test("normalizes and formats valid IBANs", () => {
|
|
6
|
-
const cases = [
|
|
7
|
-
"PL61 1090 1014 0000 0712 1981 2874",
|
|
8
|
-
"pl61 1090 1014 0000 0712 1981 2874",
|
|
9
|
-
"DE44 5001 0517 5407 3249 31",
|
|
10
|
-
"GB82WEST12345698765432",
|
|
11
|
-
];
|
|
12
|
-
for (const value of cases) {
|
|
13
|
-
expect(v.safeParse(IbanSchema, value).success).toEqual(true);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
test("rejects prefix", () => {
|
|
17
|
-
expect(() => v.parse(IbanSchema, "_PL61 1090 1014 0000 0712 1981 2874")).toThrow("iban.schema.invalid");
|
|
18
|
-
});
|
|
19
|
-
test("rejects suffix", () => {
|
|
20
|
-
expect(() => v.parse(IbanSchema, "PL61 1090 1014 0000 0712 1981 2874_")).toThrow("iban.schema.invalid");
|
|
21
|
-
});
|
|
22
|
-
test("rejects non-string input - number", () => {
|
|
23
|
-
expect(() => v.parse(IbanSchema, 123)).toThrow("iban.schema.type");
|
|
24
|
-
});
|
|
25
|
-
test("rejects non-string input - null", () => {
|
|
26
|
-
expect(() => v.parse(IbanSchema, null)).toThrow("iban.schema.type");
|
|
27
|
-
});
|
|
28
|
-
test("rejects empty", () => {
|
|
29
|
-
expect(() => v.parse(IbanSchema, "")).toThrow("iban.schema.invalid");
|
|
30
|
-
});
|
|
31
|
-
test("rejects invalid format", () => {
|
|
32
|
-
const invalid = [
|
|
33
|
-
"INVALID_VALUE",
|
|
34
|
-
"61 1090 1014 0000 0712 1981 2874",
|
|
35
|
-
"PL61 1090 1014 00",
|
|
36
|
-
"PL61 1090 1014 0000 0712 1981 2874 00000 00",
|
|
37
|
-
"PL61 1090 1014 $000 0712 1981 2874",
|
|
38
|
-
];
|
|
39
|
-
for (const value of invalid) {
|
|
40
|
-
expect(() => v.parse(IbanSchema, value)).toThrow("iban.schema.invalid");
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import { IBAN } from "../src/iban.vo";
|
|
3
|
-
describe("IBAN", () => {
|
|
4
|
-
test("normalizes and formats", () => {
|
|
5
|
-
const cases = [
|
|
6
|
-
[
|
|
7
|
-
"PL61 1090 1014 0000 0712 1981 2874",
|
|
8
|
-
"PL61109010140000071219812874",
|
|
9
|
-
"PL61 1090 1014 0000 0712 1981 2874",
|
|
10
|
-
],
|
|
11
|
-
[
|
|
12
|
-
"pl61 1090 1014 0000 0712 1981 2874",
|
|
13
|
-
"PL61109010140000071219812874",
|
|
14
|
-
"PL61 1090 1014 0000 0712 1981 2874",
|
|
15
|
-
],
|
|
16
|
-
["DE44 5001 0517 5407 3249 31", "DE44500105175407324931", "DE44 5001 0517 5407 3249 31"],
|
|
17
|
-
["GB82WEST12345698765432", "GB82WEST12345698765432", "GB82 WEST 1234 5698 7654 32"],
|
|
18
|
-
];
|
|
19
|
-
for (const [input, normalized, formatted] of cases) {
|
|
20
|
-
const iban = new IBAN(input);
|
|
21
|
-
// @ts-expect-error
|
|
22
|
-
expect(iban.toString()).toEqual(normalized);
|
|
23
|
-
expect(iban.format()).toEqual(formatted);
|
|
24
|
-
expect(iban.countryCode).toEqual(normalized.slice(0, 2));
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
test("equals", () => {
|
|
28
|
-
const a = new IBAN("PL61 1090 1014 0000 0712 1981 2874");
|
|
29
|
-
const b = new IBAN("PL61109010140000071219812874");
|
|
30
|
-
const c = new IBAN("DE44 5001 0517 5407 3249 31");
|
|
31
|
-
expect(a.equals(b)).toEqual(true);
|
|
32
|
-
expect(a.equals(c)).toEqual(false);
|
|
33
|
-
});
|
|
34
|
-
test("rejects invalid format", () => {
|
|
35
|
-
const invalid = [
|
|
36
|
-
"INVALID_VALUE",
|
|
37
|
-
"61 1090 1014 0000 0712 1981 2874",
|
|
38
|
-
"PL61 1090 1014 00",
|
|
39
|
-
"PL61 1090 1014 0000 0712 1981 2874 00000 00",
|
|
40
|
-
"PL61 1090 1014 $000 0712 1981 2874",
|
|
41
|
-
];
|
|
42
|
-
for (const value of invalid) {
|
|
43
|
-
expect(() => new IBAN(value)).toThrow("iban.schema.invalid");
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import * as v from "valibot";
|
|
3
|
-
import { ImageHeight, ImageWidth } from "../src/image.vo";
|
|
4
|
-
describe("ImageWidth", () => {
|
|
5
|
-
test("happy path", () => {
|
|
6
|
-
expect(v.safeParse(ImageWidth, 1).success).toEqual(true);
|
|
7
|
-
expect(v.safeParse(ImageWidth, 100).success).toEqual(true);
|
|
8
|
-
expect(v.safeParse(ImageWidth, 10_000).success).toEqual(true);
|
|
9
|
-
});
|
|
10
|
-
test("rejects non-numeric - null", () => {
|
|
11
|
-
expect(() => v.parse(ImageWidth, null)).toThrow("image.width.type");
|
|
12
|
-
});
|
|
13
|
-
test("rejects non-numeric - string", () => {
|
|
14
|
-
expect(() => v.parse(ImageWidth, "100")).toThrow("image.width.type");
|
|
15
|
-
});
|
|
16
|
-
test("rejects too small", () => {
|
|
17
|
-
expect(() => v.parse(ImageWidth, 0)).toThrow("image.width.length");
|
|
18
|
-
});
|
|
19
|
-
test("rejects too big", () => {
|
|
20
|
-
expect(() => v.parse(ImageWidth, 10_001)).toThrow("image.width.length");
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
describe("ImageHeight", () => {
|
|
24
|
-
test("happy path", () => {
|
|
25
|
-
expect(v.safeParse(ImageHeight, 1).success).toEqual(true);
|
|
26
|
-
expect(v.safeParse(ImageHeight, 100).success).toEqual(true);
|
|
27
|
-
expect(v.safeParse(ImageHeight, 10_000).success).toEqual(true);
|
|
28
|
-
});
|
|
29
|
-
test("rejects non-numeric - null", () => {
|
|
30
|
-
expect(() => v.parse(ImageHeight, null)).toThrow("image.height.type");
|
|
31
|
-
});
|
|
32
|
-
test("rejects non-numeric - string", () => {
|
|
33
|
-
expect(() => v.parse(ImageHeight, "100")).toThrow("image.height.type");
|
|
34
|
-
});
|
|
35
|
-
test("rejects too small", () => {
|
|
36
|
-
expect(() => v.parse(ImageHeight, 0)).toThrow("image.height.length");
|
|
37
|
-
});
|
|
38
|
-
test("rejects too big", () => {
|
|
39
|
-
expect(() => v.parse(ImageHeight, 10_001)).toThrow("image.height.length");
|
|
40
|
-
});
|
|
41
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import * as v from "valibot";
|
|
3
|
-
import { IntegerNonNegative } from "../src/integer-non-negative.vo";
|
|
4
|
-
describe("IntegerNonNegative VO", () => {
|
|
5
|
-
test("happy path", () => {
|
|
6
|
-
expect(v.safeParse(IntegerNonNegative, 0).success).toEqual(true);
|
|
7
|
-
expect(v.safeParse(IntegerNonNegative, 1).success).toEqual(true);
|
|
8
|
-
expect(v.safeParse(IntegerNonNegative, 130).success).toEqual(true);
|
|
9
|
-
});
|
|
10
|
-
test("rejects non-number - null", () => {
|
|
11
|
-
expect(() => v.parse(IntegerNonNegative, null)).toThrow("integer.non.negative.type");
|
|
12
|
-
});
|
|
13
|
-
test("rejects non-number - string", () => {
|
|
14
|
-
expect(() => v.parse(IntegerNonNegative, "100")).toThrow("integer.non.negative.type");
|
|
15
|
-
});
|
|
16
|
-
test("rejects fraction", () => {
|
|
17
|
-
expect(() => v.parse(IntegerNonNegative, 100.5)).toThrow("integer.non.negative.type");
|
|
18
|
-
});
|
|
19
|
-
test("rejects negative", () => {
|
|
20
|
-
expect(() => v.parse(IntegerNonNegative, -1)).toThrow("integer.non.negative.invalid");
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import * as v from "valibot";
|
|
3
|
-
import { IntegerPositive } from "../src/integer-positive.vo";
|
|
4
|
-
describe("IntegerPositive VO", () => {
|
|
5
|
-
test("happy path", () => {
|
|
6
|
-
expect(v.safeParse(IntegerPositive, 1).success).toEqual(true);
|
|
7
|
-
expect(v.safeParse(IntegerPositive, 130).success).toEqual(true);
|
|
8
|
-
});
|
|
9
|
-
test("rejects non-number - null", () => {
|
|
10
|
-
expect(() => v.parse(IntegerPositive, null)).toThrow("integer.positive.type");
|
|
11
|
-
});
|
|
12
|
-
test("rejects non-number - string", () => {
|
|
13
|
-
expect(() => v.parse(IntegerPositive, "100")).toThrow("integer.positive.type");
|
|
14
|
-
});
|
|
15
|
-
test("rejects fraction", () => {
|
|
16
|
-
expect(() => v.parse(IntegerPositive, 100.5)).toThrow("integer.positive.type");
|
|
17
|
-
});
|
|
18
|
-
test("rejects 0", () => {
|
|
19
|
-
expect(() => v.parse(IntegerPositive, 0)).toThrow("integer.positive.invalid");
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import * as v from "valibot";
|
|
3
|
-
import { Integer } from "../src/integer.vo";
|
|
4
|
-
describe("Integer VO", () => {
|
|
5
|
-
test("happy path", () => {
|
|
6
|
-
expect(v.safeParse(Integer, -130).success).toEqual(true);
|
|
7
|
-
expect(v.safeParse(Integer, -1).success).toEqual(true);
|
|
8
|
-
expect(v.safeParse(Integer, 0).success).toEqual(true);
|
|
9
|
-
expect(v.safeParse(Integer, 1).success).toEqual(true);
|
|
10
|
-
expect(v.safeParse(Integer, 130).success).toEqual(true);
|
|
11
|
-
});
|
|
12
|
-
test("rejects non-number - null", () => {
|
|
13
|
-
expect(() => v.parse(Integer, null)).toThrow("integer.type");
|
|
14
|
-
});
|
|
15
|
-
test("rejects non-number - string", () => {
|
|
16
|
-
expect(() => v.parse(Integer, "100")).toThrow("integer.type");
|
|
17
|
-
});
|
|
18
|
-
test("rejects fraction", () => {
|
|
19
|
-
expect(() => v.parse(Integer, 100.5)).toThrow("integer.type");
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import * as v from "valibot";
|
|
3
|
-
import { Language } from "../src/language.vo";
|
|
4
|
-
describe("Language", () => {
|
|
5
|
-
test("happy path", () => {
|
|
6
|
-
expect(v.safeParse(Language, "en").success).toEqual(true);
|
|
7
|
-
expect(v.safeParse(Language, "es").success).toEqual(true);
|
|
8
|
-
expect(v.safeParse(Language, "pl").success).toEqual(true);
|
|
9
|
-
});
|
|
10
|
-
test("rejects empty", () => {
|
|
11
|
-
expect(() => v.parse(Language, "")).toThrow("language.bad.chars");
|
|
12
|
-
});
|
|
13
|
-
test("rejects non-string - null", () => {
|
|
14
|
-
expect(() => v.parse(Language, null)).toThrow("language.type");
|
|
15
|
-
});
|
|
16
|
-
test("rejects non-string - number", () => {
|
|
17
|
-
expect(() => v.parse(Language, 123)).toThrow("language.type");
|
|
18
|
-
});
|
|
19
|
-
test("rejects non-lowercase", () => {
|
|
20
|
-
expect(() => v.parse(Language, "EN")).toThrow("language.bad.chars");
|
|
21
|
-
expect(() => v.parse(Language, "ES")).toThrow("language.bad.chars");
|
|
22
|
-
expect(() => v.parse(Language, "PL")).toThrow("language.bad.chars");
|
|
23
|
-
});
|
|
24
|
-
test("rejects strings < 1 and > 2", () => {
|
|
25
|
-
expect(() => v.parse(Language, "e")).toThrow("language.bad.chars");
|
|
26
|
-
expect(() => v.parse(Language, "eng")).toThrow("language.bad.chars");
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import { LinearRegression } from "../src/linear-regression.service";
|
|
3
|
-
describe("LinearRegression", () => {
|
|
4
|
-
test("throws when sum of x values is too big", () => {
|
|
5
|
-
expect(() => LinearRegression.fromPairs([
|
|
6
|
-
{ x: Number.MAX_SAFE_INTEGER, y: 2 },
|
|
7
|
-
{ x: Number.MAX_SAFE_INTEGER, y: 4 },
|
|
8
|
-
])).toThrow("linear.regression.sum.x.too.big");
|
|
9
|
-
});
|
|
10
|
-
test("throws when sum of y values is too big", () => {
|
|
11
|
-
expect(() => LinearRegression.fromPairs([
|
|
12
|
-
{ y: Number.MAX_SAFE_INTEGER, x: 2 },
|
|
13
|
-
{ y: Number.MAX_SAFE_INTEGER, x: 4 },
|
|
14
|
-
])).toThrow("linear.regression.sum.y.too.big");
|
|
15
|
-
});
|
|
16
|
-
test("throws when sum of x times y values is too big", () => {
|
|
17
|
-
const x = 10_000_000;
|
|
18
|
-
const y = 100_000_000_000_000;
|
|
19
|
-
expect(() => LinearRegression.fromPairs([
|
|
20
|
-
{ x, y },
|
|
21
|
-
{ x, y },
|
|
22
|
-
])).toThrow("linear.regression.sum.x.times.y.too.big");
|
|
23
|
-
});
|
|
24
|
-
test("throws when sum of x squared values is too big", () => {
|
|
25
|
-
const value = Number.MAX_SAFE_INTEGER;
|
|
26
|
-
expect(() => LinearRegression.fromPairs([
|
|
27
|
-
{ x: value, y: 0 },
|
|
28
|
-
{ x: -value, y: 0 },
|
|
29
|
-
])).toThrow("linear.regression.sum.x.squared.too.big");
|
|
30
|
-
});
|
|
31
|
-
test("throws where no min two pairs are provided - empty array", () => {
|
|
32
|
-
expect(() => LinearRegression.fromPairs([])).toThrow("linear.regression.min.pairs");
|
|
33
|
-
});
|
|
34
|
-
test("throws where no min two pairs are provided - one", () => {
|
|
35
|
-
expect(() => LinearRegression.fromPairs([{ x: 1, y: 2 }])).toThrow("linear.regression.min.pairs");
|
|
36
|
-
});
|
|
37
|
-
test("predicts correctly from two pairs", () => {
|
|
38
|
-
const model = LinearRegression.fromPairs([
|
|
39
|
-
{ x: 1, y: 2 },
|
|
40
|
-
{ x: 2, y: 4 },
|
|
41
|
-
]);
|
|
42
|
-
expect(model.predict(4)).toEqual(8);
|
|
43
|
-
});
|
|
44
|
-
test("predicts correctly from three pairs", () => {
|
|
45
|
-
const model = LinearRegression.fromPairs([
|
|
46
|
-
{ x: 1, y: 2 },
|
|
47
|
-
{ x: 2, y: 4 },
|
|
48
|
-
{ x: 3, y: 6 },
|
|
49
|
-
]);
|
|
50
|
-
expect(model.predict(10)).toEqual(20);
|
|
51
|
-
});
|
|
52
|
-
test("predicts correctly for line with non-zero intercept", () => {
|
|
53
|
-
const model = LinearRegression.fromPairs([
|
|
54
|
-
{ x: 1, y: 3 },
|
|
55
|
-
{ x: 2, y: 5 },
|
|
56
|
-
]);
|
|
57
|
-
expect(model.predict(3)).toEqual(7);
|
|
58
|
-
expect(model.inspect()).toEqual({ a: 1, b: 2 });
|
|
59
|
-
});
|
|
60
|
-
test("works the same way when constructed directly", () => {
|
|
61
|
-
const model = LinearRegression.fromPairs([
|
|
62
|
-
{ x: 1, y: 2 },
|
|
63
|
-
{ x: 2, y: 4 },
|
|
64
|
-
{ x: 3, y: 6 },
|
|
65
|
-
]);
|
|
66
|
-
const params = model.inspect();
|
|
67
|
-
const reconstructed = new LinearRegression(params);
|
|
68
|
-
expect(reconstructed.predict(10)).toEqual(20);
|
|
69
|
-
});
|
|
70
|
-
test("works for all zeros in y", () => {
|
|
71
|
-
const model = LinearRegression.fromPairs([
|
|
72
|
-
{ x: 0, y: 0 },
|
|
73
|
-
{ x: 1, y: 0 },
|
|
74
|
-
{ x: 2, y: 0 },
|
|
75
|
-
]);
|
|
76
|
-
const params = model.inspect();
|
|
77
|
-
const reconstructed = new LinearRegression(params);
|
|
78
|
-
expect(reconstructed.predict(10)).toEqual(0);
|
|
79
|
-
});
|
|
80
|
-
test("fails for all zeros (x has zero variance)", () => {
|
|
81
|
-
expect(() => LinearRegression.fromPairs([
|
|
82
|
-
{ x: 0, y: 0 },
|
|
83
|
-
{ x: 0, y: 0 },
|
|
84
|
-
{ x: 0, y: 0 },
|
|
85
|
-
])).toThrow("linear.regression.model.creation");
|
|
86
|
-
});
|
|
87
|
-
test("incalculable result with identical x values", () => {
|
|
88
|
-
expect(() => LinearRegression.fromPairs([
|
|
89
|
-
{ x: 0, y: 0 },
|
|
90
|
-
{ x: 0, y: 0 },
|
|
91
|
-
])).toThrow("linear.regression.model.creation");
|
|
92
|
-
});
|
|
93
|
-
test("throws when sum of x is max safe integer", () => {
|
|
94
|
-
expect(() => LinearRegression.fromPairs([
|
|
95
|
-
{ x: Number.MAX_SAFE_INTEGER, y: 0 },
|
|
96
|
-
{ x: 0, y: 0 },
|
|
97
|
-
])).toThrow("linear.regression.sum.x.too.big");
|
|
98
|
-
});
|
|
99
|
-
test("throws when sum of y is max safe integer", () => {
|
|
100
|
-
expect(() => LinearRegression.fromPairs([
|
|
101
|
-
{ x: 0, y: Number.MAX_SAFE_INTEGER },
|
|
102
|
-
{ x: 0, y: 0 },
|
|
103
|
-
])).toThrow("linear.regression.sum.y.too.big");
|
|
104
|
-
});
|
|
105
|
-
test("throws when sum of xy is max safe integer", () => {
|
|
106
|
-
expect(() => LinearRegression.fromPairs([
|
|
107
|
-
{ x: Number.MAX_SAFE_INTEGER - 2, y: 2 },
|
|
108
|
-
{ x: 0, y: 0 },
|
|
109
|
-
])).toThrow("linear.regression.sum.x.times.y.too.big");
|
|
110
|
-
});
|
|
111
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import { Mean } from "../src/mean.service";
|
|
3
|
-
import { RoundingToNearestStrategy } from "../src/rounding-to-nearest.strategy";
|
|
4
|
-
describe("Mean", () => {
|
|
5
|
-
test("throws for empty values array", () => {
|
|
6
|
-
expect(() => Mean.calculate([])).toThrow("mean.not.enough.values");
|
|
7
|
-
});
|
|
8
|
-
test("works for one value", () => {
|
|
9
|
-
expect(Mean.calculate([1])).toEqual(1);
|
|
10
|
-
});
|
|
11
|
-
test("works for two values", () => {
|
|
12
|
-
expect(Mean.calculate([1, 2])).toEqual(1.5);
|
|
13
|
-
});
|
|
14
|
-
test("works for three values", () => {
|
|
15
|
-
expect(Mean.calculate([1, 3, 6])).toEqual(3.33);
|
|
16
|
-
});
|
|
17
|
-
test("works for all zeros", () => {
|
|
18
|
-
expect(Mean.calculate([0, 0, 0])).toEqual(0);
|
|
19
|
-
});
|
|
20
|
-
test("non-default rounding", () => {
|
|
21
|
-
expect(Mean.calculate([1, 3, 6], new RoundingToNearestStrategy())).toEqual(3);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import * as v from "valibot";
|
|
3
|
-
import { Extension } from "../src/extension.vo";
|
|
4
|
-
import { Mime } from "../src/mime.vo";
|
|
5
|
-
import { MimeRegistryEntry } from "../src/mime-registry-entry.vo";
|
|
6
|
-
describe("MimeRegistryEntry", () => {
|
|
7
|
-
test("happy path", () => {
|
|
8
|
-
const jpegMime = Mime.fromString("image/jpeg");
|
|
9
|
-
const jpgExtension = v.parse(Extension, "jpg");
|
|
10
|
-
const jpegExtension = v.parse(Extension, "jpeg");
|
|
11
|
-
const entry = new MimeRegistryEntry(jpegMime, [jpgExtension, jpegExtension]);
|
|
12
|
-
expect(entry.mime.isSatisfiedBy(jpegMime)).toEqual(true);
|
|
13
|
-
expect(entry.extensions).toEqual([jpgExtension, jpegExtension]);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import * as v from "valibot";
|
|
3
|
-
import { Extension } from "../src/extension.vo";
|
|
4
|
-
import { Mime } from "../src/mime.vo";
|
|
5
|
-
import { MimeRegistry } from "../src/mime-registry.service";
|
|
6
|
-
const jpegMime = Mime.fromString("image/jpeg");
|
|
7
|
-
const jpgExtension = v.parse(Extension, "jpg");
|
|
8
|
-
const jpegExtension = v.parse(Extension, "jpeg");
|
|
9
|
-
const pngMime = Mime.fromString("image/png");
|
|
10
|
-
const pngExtension = v.parse(Extension, "png");
|
|
11
|
-
const pdfMime = Mime.fromString("application/pdf");
|
|
12
|
-
const csvExtension = v.parse(Extension, "csv");
|
|
13
|
-
const registry = new MimeRegistry([
|
|
14
|
-
{ mime: jpegMime, extensions: [jpgExtension, jpegExtension] },
|
|
15
|
-
{ mime: pngMime, extensions: [pngExtension] },
|
|
16
|
-
]);
|
|
17
|
-
describe("MimeRegistry", () => {
|
|
18
|
-
test("fromExtension - canonical", () => {
|
|
19
|
-
expect(registry.fromExtension(pngExtension)).toEqual(pngMime);
|
|
20
|
-
});
|
|
21
|
-
test("fromExtension - aliases", () => {
|
|
22
|
-
expect(registry.fromExtension(jpgExtension)).toEqual(jpegMime);
|
|
23
|
-
expect(registry.fromExtension(jpegExtension)).toEqual(jpegMime);
|
|
24
|
-
});
|
|
25
|
-
test("fromExtension - unknown extension", () => {
|
|
26
|
-
expect(registry.fromExtension(csvExtension)).toEqual(undefined);
|
|
27
|
-
});
|
|
28
|
-
test("toExtension", () => {
|
|
29
|
-
expect(registry.toExtension(jpegMime)).toEqual(jpgExtension);
|
|
30
|
-
expect(registry.toExtension(pngMime)).toEqual(pngExtension);
|
|
31
|
-
});
|
|
32
|
-
test("toExtension - unknown mime", () => {
|
|
33
|
-
expect(registry.toExtension(pdfMime)).toEqual(undefined);
|
|
34
|
-
});
|
|
35
|
-
test("hasExtension", () => {
|
|
36
|
-
expect(registry.hasExtension(jpgExtension)).toEqual(true);
|
|
37
|
-
expect(registry.hasExtension(jpgExtension)).toEqual(true);
|
|
38
|
-
expect(registry.hasExtension(csvExtension)).toEqual(false);
|
|
39
|
-
});
|
|
40
|
-
test("hasMime", () => {
|
|
41
|
-
expect(registry.hasMime(jpegMime)).toEqual(true);
|
|
42
|
-
expect(registry.hasMime(pngMime)).toEqual(true);
|
|
43
|
-
expect(registry.hasMime(pdfMime)).toEqual(false);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import * as v from "valibot";
|
|
3
|
-
import { MimeValue } from "../src/mime-value.vo";
|
|
4
|
-
describe("MimeValue", () => {
|
|
5
|
-
test("happy path", () => {
|
|
6
|
-
expect(v.safeParse(MimeValue, "text/plain").success).toEqual(true);
|
|
7
|
-
expect(v.safeParse(MimeValue, "*/*").success).toEqual(true);
|
|
8
|
-
expect(v.safeParse(MimeValue, "image/*").success).toEqual(true);
|
|
9
|
-
expect(v.safeParse(MimeValue, "application/octet-stream").success).toEqual(true);
|
|
10
|
-
expect(v.safeParse(MimeValue, "video/mp4").success).toEqual(true);
|
|
11
|
-
expect(v.safeParse(MimeValue, "application/ace+json").success).toEqual(true);
|
|
12
|
-
expect(v.safeParse(MimeValue, "video/vnd.planar").success).toEqual(true);
|
|
13
|
-
expect(v.safeParse(MimeValue, `${"a".repeat(24)}/${"a".repeat(72)}`).success).toEqual(true);
|
|
14
|
-
expect(v.safeParse(MimeValue, "application/clue_info+xml").success).toEqual(true);
|
|
15
|
-
});
|
|
16
|
-
test("rejects prefix", () => {
|
|
17
|
-
expect(() => v.parse(MimeValue, "!text/plain")).toThrow("mime.value.invalid");
|
|
18
|
-
});
|
|
19
|
-
test("rejects suffix", () => {
|
|
20
|
-
expect(() => v.parse(MimeValue, "text/plain!")).toThrow("mime.value.invalid");
|
|
21
|
-
});
|
|
22
|
-
test("rejects empty", () => {
|
|
23
|
-
expect(() => v.parse(MimeValue, "")).toThrow("mime.value.invalid");
|
|
24
|
-
});
|
|
25
|
-
test("rejects non-string - null", () => {
|
|
26
|
-
expect(() => v.parse(MimeValue, null)).toThrow("mime.value.type");
|
|
27
|
-
});
|
|
28
|
-
test("rejects non-string - number", () => {
|
|
29
|
-
expect(() => v.parse(MimeValue, 123)).toThrow("mime.value.type");
|
|
30
|
-
});
|
|
31
|
-
test("rejects missing type", () => {
|
|
32
|
-
expect(() => v.parse(MimeValue, "/plain")).toThrow("mime.value.invalid");
|
|
33
|
-
});
|
|
34
|
-
test("rejects too long type", () => {
|
|
35
|
-
expect(() => v.parse(MimeValue, `${"a".repeat(25)}/plain`)).toThrow("mime.value.invalid");
|
|
36
|
-
});
|
|
37
|
-
test("rejects missing subtype", () => {
|
|
38
|
-
expect(() => v.parse(MimeValue, "text/")).toThrow("mime.value.invalid");
|
|
39
|
-
});
|
|
40
|
-
test("rejects too long subtype", () => {
|
|
41
|
-
expect(() => v.parse(MimeValue, `text/${"a".repeat(73)}`)).toThrow("mime.value.invalid");
|
|
42
|
-
});
|
|
43
|
-
test("rejects no slash", () => {
|
|
44
|
-
expect(() => v.parse(MimeValue, "text")).toThrow("mime.value.invalid");
|
|
45
|
-
});
|
|
46
|
-
test("rejects only *", () => {
|
|
47
|
-
expect(() => v.parse(MimeValue, "*")).toThrow("mime.value.invalid");
|
|
48
|
-
});
|
|
49
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import { Mime } from "../src/mime.vo";
|
|
3
|
-
describe("Mime", () => {
|
|
4
|
-
test("fromString", () => {
|
|
5
|
-
const mime = Mime.fromString("text/plain");
|
|
6
|
-
expect(mime.type).toEqual("text");
|
|
7
|
-
expect(mime.subtype).toEqual("plain");
|
|
8
|
-
});
|
|
9
|
-
test("fromString - trimmed", () => {
|
|
10
|
-
const mime = Mime.fromString("text/plain ");
|
|
11
|
-
expect(mime.type).toEqual("text");
|
|
12
|
-
expect(mime.subtype).toEqual("plain");
|
|
13
|
-
});
|
|
14
|
-
test("strips semicolon separated mime metadata", () => {
|
|
15
|
-
expect(Mime.fromString("text/plain; charset=UTF-8").toString()).toEqual("text/plain");
|
|
16
|
-
});
|
|
17
|
-
test("throws InvalidMimeError for invalid input", () => {
|
|
18
|
-
expect(() => Mime.fromString("")).toThrow("mime.value.invalid");
|
|
19
|
-
expect(() => Mime.fromString("/subtype")).toThrow("mime.value.invalid");
|
|
20
|
-
expect(() => Mime.fromString("type/")).toThrow("mime.value.invalid");
|
|
21
|
-
expect(() => Mime.fromString("no-slash")).toThrow("mime.value.invalid");
|
|
22
|
-
});
|
|
23
|
-
test("isSatisfiedBy - happy path", () => {
|
|
24
|
-
const textPlain = Mime.fromString("text/plain");
|
|
25
|
-
const textHtml = Mime.fromString("text/html");
|
|
26
|
-
const applicationJson = Mime.fromString("application/json");
|
|
27
|
-
const textWildcard = Mime.fromString("text/*");
|
|
28
|
-
const anyWildcard = Mime.fromString("*/*");
|
|
29
|
-
expect(textPlain.isSatisfiedBy(textHtml)).toEqual(false);
|
|
30
|
-
expect(textPlain.isSatisfiedBy(applicationJson)).toEqual(false);
|
|
31
|
-
expect(textPlain.isSatisfiedBy(textPlain)).toEqual(true);
|
|
32
|
-
expect(textWildcard.isSatisfiedBy(textPlain)).toEqual(true);
|
|
33
|
-
expect(anyWildcard.isSatisfiedBy(textPlain)).toEqual(true);
|
|
34
|
-
});
|
|
35
|
-
test("isSatisfiedBy - failures", () => {
|
|
36
|
-
const textPlain = Mime.fromString("text/plain");
|
|
37
|
-
const imageWildcard = Mime.fromString("image/*");
|
|
38
|
-
const wildcardPlain = Mime.fromString("*/plain");
|
|
39
|
-
const anyWildcard = Mime.fromString("*/*");
|
|
40
|
-
expect(textPlain.isSatisfiedBy(imageWildcard)).toEqual(false);
|
|
41
|
-
expect(textPlain.isSatisfiedBy(wildcardPlain)).toEqual(false);
|
|
42
|
-
expect(textPlain.isSatisfiedBy(anyWildcard)).toEqual(false);
|
|
43
|
-
expect(imageWildcard.isSatisfiedBy(wildcardPlain)).toEqual(false);
|
|
44
|
-
expect(imageWildcard.isSatisfiedBy(anyWildcard)).toEqual(false);
|
|
45
|
-
expect(wildcardPlain.isSatisfiedBy(anyWildcard)).toEqual(false);
|
|
46
|
-
});
|
|
47
|
-
test("toString", () => {
|
|
48
|
-
expect(Mime.fromString("text/plain").toString()).toEqual("text/plain");
|
|
49
|
-
});
|
|
50
|
-
test("toJSON", () => {
|
|
51
|
-
expect(Mime.fromString("text/plain").toJSON()).toEqual({ type: "text", subtype: "plain" });
|
|
52
|
-
});
|
|
53
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/tests/mimes.test.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import * as v from "valibot";
|
|
3
|
-
import { Extension } from "../src/extension.vo";
|
|
4
|
-
import { Mimes } from "../src/mimes";
|
|
5
|
-
describe("Mimes", () => {
|
|
6
|
-
test("map", () => {
|
|
7
|
-
expect(Mimes.csv.mime.toString()).toEqual("text/csv");
|
|
8
|
-
expect(Mimes.csv.extensions).toEqual([v.parse(Extension, "csv")]);
|
|
9
|
-
expect(Mimes.jpg.mime.toString()).toEqual("image/jpeg");
|
|
10
|
-
expect(Mimes.jpg.extensions).toEqual([v.parse(Extension, "jpg"), v.parse(Extension, "jpeg")]);
|
|
11
|
-
expect(Mimes.markdown.mime.toString()).toEqual("text/markdown");
|
|
12
|
-
expect(Mimes.markdown.extensions).toEqual([v.parse(Extension, "md")]);
|
|
13
|
-
expect(Mimes.mp4.mime.toString()).toEqual("video/mp4");
|
|
14
|
-
expect(Mimes.mp4.extensions).toEqual([v.parse(Extension, "mp4")]);
|
|
15
|
-
expect(Mimes.pdf.mime.toString()).toEqual("application/pdf");
|
|
16
|
-
expect(Mimes.pdf.extensions).toEqual([v.parse(Extension, "pdf")]);
|
|
17
|
-
expect(Mimes.png.mime.toString()).toEqual("image/png");
|
|
18
|
-
expect(Mimes.png.extensions).toEqual([v.parse(Extension, "png")]);
|
|
19
|
-
expect(Mimes.text.mime.toString()).toEqual("text/plain");
|
|
20
|
-
expect(Mimes.text.extensions).toEqual([v.parse(Extension, "txt")]);
|
|
21
|
-
expect(Mimes.webp.mime.toString()).toEqual("image/webp");
|
|
22
|
-
expect(Mimes.webp.extensions).toEqual([v.parse(Extension, "webp")]);
|
|
23
|
-
expect(Mimes.wav.mime.toString()).toEqual("audio/wav");
|
|
24
|
-
expect(Mimes.wav.extensions).toEqual([v.parse(Extension, "wav")]);
|
|
25
|
-
expect(Mimes.zip.mime.toString()).toEqual("application/zip");
|
|
26
|
-
expect(Mimes.zip.extensions).toEqual([v.parse(Extension, "zip")]);
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|