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

Function allIntegersInRange

packages/effect/src/net/NetAddress.ts:856–862  ·  view source on GitHub ↗
(values: ReadonlyArray<number>, max: number)

Source from the content-addressed store, hash-verified

854
855// Checks by index because `every` skips holes in sparse arrays.
856const allIntegersInRange = (values: ReadonlyArray<number>, max: number): boolean => {
857 for (let i = 0; i < values.length; i++) {
858 const n = values[i]
859 if (!Number.isInteger(n) || n < 0 || n > max) return false
860 }
861 return true
862}
863
864/**
865 * Creates an IPv4 address from four checked octets.

Callers 3

ipv4FromOctetsFunction · 0.85
ipv6FromSegmentsFunction · 0.85
macAddressFromOctetsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected