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

Function parseValue

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

Source from the content-addressed store, hash-verified

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

Callers 1

execMethod · 0.70

Calls 1

NumberInterface · 0.50

Tested by

no test coverage detected