All files / src op.ts

88.88% Statements 8/9
50% Branches 1/2
100% Functions 1/1
87.5% Lines 7/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1822x 22x 22x   22x             22x 12x       22x  
import fallback from './fallback.js'
import id from './identifier.js'
import raw from './raw.js'
import type S from './sanitised.js'
import tsql from './template.js'
 
/**
 * @internal
 * @param op_ can leak unsanitised string if misused, hence internal.
 */
export const op =
  (l: S | string, op_: S | string, r: unknown): undefined | S =>
    typeof r === 'undefined' ?
      undefined :
      tsql`${fallback(l, id)} ${fallback(op_, raw)} ${r}`
 
export default op