MCPcopy Create free account
hub / github.com/Effect-TS/effect / port

Function port

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

Source from the content-addressed store, hash-verified

205
206/** @internal */
207export const port = (name?: string): Config.Config<number> => {
208 const config = primitive(
209 "a network port property",
210 (text) => {
211 const result = Number(text)
212
213 if (
214 Number.isNaN(result) ||
215 result.toString() !== text.toString() ||
216 !Number.isInteger(result) ||
217 result < 1 ||
218 result > 65535
219 ) {
220 return Either.left(
221 configError.InvalidData(
222 [],
223 `Expected a network port value but received ${formatUnknown(text)}`
224 )
225 )
226 }
227 return Either.right(result)
228 }
229 )
230 return name === undefined ? config : nested(config, name)
231}
232
233/** @internal */
234export 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