Skip to content

Commit

Permalink
📝 Use random alphanum examples not to suggest sequential IDs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwojnowski committed Apr 2, 2024
1 parent c89514f commit 86c4e36
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ val InvoiceId = new HumanIdOps["inv", String]
type CustomerId = HumanId["cus", String]
val CustomerId = new HumanIdOps["cus", String]

val invoiceId1: Either[String, InvoiceId] = InvoiceId.parseRequirePrefix("inv_1234")
val invoiceId2: InvoiceId = InvoiceId.fromId("2345")
val invoiceId1: Either[String, InvoiceId] = InvoiceId.parseRequirePrefix("inv_q6CQPBY4yscNnHLan9dJyhLt")
val invoiceId2: InvoiceId = InvoiceId.fromId("H2ggLQjE3txWzIAGstc6nmmn")

val customerId1: Either[String, CustomerId] = CustomerId.parseRequirePrefix("cus_1234").toOption.get
val customerId1: Either[String, CustomerId] = CustomerId.parseRequirePrefix("cus_E366DWqKWTaCrDeDmU31Xk2C").toOption.get

// val customerId2: CustomerId = invoiceId2 // ⚠️ compile error, as different prefixes mean different types
```
Expand Down

0 comments on commit 86c4e36

Please sign in to comment.