All files / src nstring.ts

85.71% Statements 6/7
50% Branches 2/4
100% Functions 1/1
83.33% Lines 5/6

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 1422x 22x       22x 4264x           4264x  
import quotedNstring from './quoted-nstring.js'
import S from './sanitised.js'
 
// TODO: Add SanitisedValue type?
export const nstring =
  (value: undefined | null | string | S): S =>
    value instanceof S ?
      value :
      value == null ?
        new S('null') :
        new S(quotedNstring(String(value)))
 
export default nstring