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

Function twoDigitsAt

packages/sql/pg/src/PgTypes.ts:548–552  ·  view source on GitHub ↗
(text: string, at: number)

Source from the content-addressed store, hash-verified

546
547/** The two-digit number at `at`, or `-1` when those characters are not digits. */
548const twoDigitsAt = (text: string, at: number): number => {
549 const tens = text.charCodeAt(at) - 48
550 const units = text.charCodeAt(at + 1) - 48
551 return tens >= 0 && tens <= 9 && units >= 0 && units <= 9 ? tens * 10 + units : -1
552}
553
554/** Parses `[-]YYYY-MM-DD`, with as many year digits as the caller likes. */
555const parseDate = (text: string): number => {

Callers 1

parseDateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected