MCPcopy
hub / github.com/ajv-validator/ajv / str

Function str

lib/compile/codegen/code.ts:88–98  ·  view source on GitHub ↗
(strs: TemplateStringsArray, ...args: (CodeArg | string[])[])

Source from the content-addressed store, hash-verified

86const plus = new _Code("+")
87
88export function str(strs: TemplateStringsArray, ...args: (CodeArg | string[])[]): _Code {
89 const expr: CodeItem[] = [safeStringify(strs[0])]
90 let i = 0
91 while (i < args.length) {
92 expr.push(plus)
93 addCodeArg(expr, args[i])
94 expr.push(plus, safeStringify(strs[++i]))
95 }
96 optimize(expr)
97 return new _Code(expr)
98}
99
100export function addCodeArg(code: CodeItem[], arg: CodeArg | string[]): void {
101 if (arg instanceof _Code) code.push(...arg._items)

Callers 15

dependencies.tsFile · 0.90
if.tsFile · 0.90
additionalItems.tsFile · 0.90
items2020.tsFile · 0.90
contains.tsFile · 0.90
required.tsFile · 0.90
limitNumber.tsFile · 0.90
multipleOf.tsFile · 0.90
messageFunction · 0.90
uniqueItems.tsFile · 0.90
pattern.tsFile · 0.90
messageFunction · 0.90

Calls 3

safeStringifyFunction · 0.85
addCodeArgFunction · 0.85
optimizeFunction · 0.85

Tested by

no test coverage detected