MCPcopy
hub / github.com/Effect-TS/effect / fromStringEncoded

Method fromStringEncoded

packages/cluster/src/ShardId.ts:85–99  ·  view source on GitHub ↗

* @since 1.0.0

(s: string)

Source from the content-addressed store, hash-verified

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

Callers 2

fromStringMethod · 0.80
messageFromRowFunction · 0.80

Calls 1

NumberInterface · 0.85

Tested by

no test coverage detected