BasketballJerseyNumber

1.0.0

Custom data type for representing basketball player numbers with additional validation rules.
paulpela/BasketballJerseyNumber

What's New

2020-10-04T22:58:50Z

BasketballJerseyNumber

Custom data type for representing basketball player numbers with additional validation rules.

Basic usage

init?(number: String) - initializes correctly with a positive number comprised of one or two digits.

Allowed numbers: 00, 01...09, 0...99.

Additional validation rules

You can use init?(number: String, validationRules: Set<JerseyNumberValidationRule>) to restrict valid numbers.

JerseyNumberValidationRule

.only0to5 - returns nil if number contains digits in range of 6...9 in any place

.doubleZeroNotAllowed - returns nil if number is "00"

.noLeadingZeros - returns nil for values like 01...09

Protocol conformance

Conforms to Hashable and CustomStringConvertible.

Description

  • Swift Tools 5.3.0

Dependencies

  • None
Last updated: Thu Oct 15 2020 17:41:27 GMT-0500 (GMT-05:00)