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

Function paxInteger

packages/effect/src/encoding/Tar.ts:680–686  ·  view source on GitHub ↗
(key: string, value: string)

Source from the content-addressed store, hash-verified

678}
679
680const paxInteger = (key: string, value: string): number => {
681 const n = /^\d+$/.test(value) ? Number(value) : Number.NaN
682 if (!Number.isSafeInteger(n)) {
683 throw invalidHeader(`invalid PAX ${key} ${JSON.stringify(value)}`)
684 }
685 return n
686}
687
688// Parses a PAX time of decimal seconds into milliseconds, rounded down. The
689// digits are added up separately, because `Number(value) * 1000` is inexact.

Callers 1

applyPaxFunction · 0.85

Calls 2

invalidHeaderFunction · 0.70
NumberFunction · 0.50

Tested by

no test coverage detected