All files / src/datatypes logic.coffee

100% Statements 10/10
50% Branches 3/6
100% Functions 5/5
100% Lines 6/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 14 15 16 17 181x 2076x         412x         27x       1x 516x  
module.exports.ThreeValuedLogic = class ThreeValuedLogic
  @and: (val...) ->
    if false in val then false
    else if null in val then null
    else true
 
  @or: (val...) ->
    if true in val then true
    else if null in val then null
    else false
 
  @xor: (val...) ->
    if null in val then null
    else val.reduce (a,b) -> (!a ^ !b) is 1
 
  @not: (val) ->
    if val? then return not val else return null