* @since 1.0.0
(s: string)
| 83 | * @since 1.0.0 |
| 84 | */ |
| 85 | static fromStringEncoded(s: string): { |
| 86 | readonly group: string |
| 87 | readonly id: number |
| 88 | } { |
| 89 | const index = s.lastIndexOf(":") |
| 90 | if (index === -1) { |
| 91 | throw new Error(`Invalid ShardId format`) |
| 92 | } |
| 93 | const group = s.substring(0, index) |
| 94 | const id = Number(s.substring(index + 1)) |
| 95 | if (isNaN(id)) { |
| 96 | throw new Error(`ShardId id must be a number`) |
| 97 | } |
| 98 | return { group, id } |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * @since 4.0.0 |
no test coverage detected