MCPcopy Index your code
hub / github.com/Effect-TS/effect / port

Function port

packages/effect/src/internal/config.ts:198–222  ·  view source on GitHub ↗
(name?: string)

Source from the content-addressed store, hash-verified

196
197/** @internal */
198export const port = (name?: string): Config.Config<number> => {
199 const config = primitive(
200 "a network port property",
201 (text) => {
202 const result = Number(text)
203
204 if (
205 Number.isNaN(result) ||
206 result.toString() !== text.toString() ||
207 !Number.isInteger(result) ||
208 result < 1 ||
209 result > 65535
210 ) {
211 return Either.left(
212 configError.InvalidData(
213 [],
214 `Expected a network port value but received ${formatUnknown(text)}`
215 )
216 )
217 }
218 return Either.right(result)
219 }
220 )
221 return name === undefined ? config : nested(config, name)
222}
223
224/** @internal */
225export const array = <A>(config: Config.Config<A>, name?: string): Config.Config<Array<A>> => {

Callers

nothing calls this directly

Calls 4

primitiveFunction · 0.85
NumberInterface · 0.85
formatUnknownFunction · 0.85
toStringMethod · 0.65

Tested by

no test coverage detected