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

Function parseValue

packages/sql/sqlite-do/test/Client.test.ts:163–176  ·  view source on GitHub ↗
(
  value: string,
  params: ReadonlyArray<unknown>,
  nextParamIndex: () => number
)

Source from the content-addressed store, hash-verified

161 values.match(/\(([^)]*)\)/g)?.map((group) => group.slice(1, -1)) ?? []
162
163const parseValue = (
164 value: string,
165 params: ReadonlyArray<unknown>,
166 nextParamIndex: () => number
167): unknown => {
168 if (value === "?") {
169 return params[nextParamIndex()]
170 }
171 if (/^'.*'$/.test(value)) {
172 return value.slice(1, -1)
173 }
174 const number = Number(value)
175 return Number.isNaN(number) ? value : number
176}
177
178const makeClient = (config: SqliteClient.SqliteClientConfig) =>
179 SqliteClient.make(config).pipe(

Callers 1

execMethod · 0.70

Calls 2

sliceMethod · 0.80
NumberFunction · 0.50

Tested by

no test coverage detected