value-object
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -1,1 +0,1 @@ | ||
{"/Users/joshchisholm/projects/value-object.js/src/valueObject.js":{"path":"/Users/joshchisholm/projects/value-object.js/src/valueObject.js","statementMap":{"0":{"start":{"line":3,"column":31},"end":{"line":3,"column":54}},"1":{"start":{"line":7,"column":18},"end":{"line":7,"column":88}},"2":{"start":{"line":8,"column":18},"end":{"line":8,"column":60}},"3":{"start":{"line":9,"column":4},"end":{"line":9,"column":28}},"4":{"start":{"line":10,"column":4},"end":{"line":10,"column":16}},"5":{"start":{"line":14,"column":15},"end":{"line":14,"column":19}},"6":{"start":{"line":15,"column":24},"end":{"line":15,"column":64}},"7":{"start":{"line":16,"column":4},"end":{"line":22,"column":5}},"8":{"start":{"line":17,"column":6},"end":{"line":20,"column":53}},"9":{"start":{"line":18,"column":8},"end":{"line":18,"column":82}},"10":{"start":{"line":20,"column":8},"end":{"line":20,"column":53}},"11":{"start":{"line":21,"column":6},"end":{"line":21,"column":40}},"12":{"start":{"line":23,"column":4},"end":{"line":23,"column":24}},"13":{"start":{"line":27,"column":4},"end":{"line":27,"column":113}},"14":{"start":{"line":27,"column":45},"end":{"line":27,"column":113}},"15":{"start":{"line":28,"column":4},"end":{"line":32,"column":5}},"16":{"start":{"line":29,"column":6},"end":{"line":29,"column":81}},"17":{"start":{"line":31,"column":6},"end":{"line":31,"column":76}},"18":{"start":{"line":33,"column":4},"end":{"line":33,"column":16}},"19":{"start":{"line":34,"column":4},"end":{"line":34,"column":23}},"20":{"start":{"line":45,"column":4},"end":{"line":48,"column":5}},"21":{"start":{"line":46,"column":22},"end":{"line":46,"column":111}},"22":{"start":{"line":47,"column":6},"end":{"line":47,"column":34}},"23":{"start":{"line":50,"column":4},"end":{"line":61,"column":6}},"24":{"start":{"line":51,"column":23},"end":{"line":51,"column":37}},"25":{"start":{"line":52,"column":6},"end":{"line":55,"column":7}},"26":{"start":{"line":53,"column":24},"end":{"line":53,"column":135}},"27":{"start":{"line":54,"column":8},"end":{"line":54,"column":36}},"28":{"start":{"line":56,"column":6},"end":{"line":60,"column":8}},"29":{"start":{"line":66,"column":27},"end":{"line":66,"column":40}},"30":{"start":{"line":67,"column":34},"end":{"line":67,"column":57}},"31":{"start":{"line":68,"column":32},"end":{"line":68,"column":59}},"32":{"start":{"line":69,"column":4},"end":{"line":69,"column":149}},"33":{"start":{"line":69,"column":26},"end":{"line":69,"column":149}},"34":{"start":{"line":71,"column":30},"end":{"line":71,"column":167}},"35":{"start":{"line":71,"column":136},"end":{"line":71,"column":166}},"36":{"start":{"line":72,"column":4},"end":{"line":72,"column":162}},"37":{"start":{"line":72,"column":28},"end":{"line":72,"column":162}},"38":{"start":{"line":75,"column":26},"end":{"line":75,"column":30}},"39":{"start":{"line":76,"column":37},"end":{"line":76,"column":39}},"40":{"start":{"line":77,"column":37},"end":{"line":77,"column":39}},"41":{"start":{"line":78,"column":4},"end":{"line":82,"column":5}},"42":{"start":{"line":80,"column":27},"end":{"line":80,"column":51}},"43":{"start":{"line":81,"column":6},"end":{"line":81,"column":131}},"44":{"start":{"line":84,"column":4},"end":{"line":105,"column":5}},"45":{"start":{"line":86,"column":27},"end":{"line":86,"column":51}},"46":{"start":{"line":87,"column":23},"end":{"line":87,"column":51}},"47":{"start":{"line":88,"column":31},"end":{"line":88,"column":46}},"48":{"start":{"line":90,"column":6},"end":{"line":104,"column":7}},"49":{"start":{"line":91,"column":29},"end":{"line":91,"column":158}},"50":{"start":{"line":91,"column":87},"end":{"line":91,"column":146}},"51":{"start":{"line":92,"column":24},"end":{"line":92,"column":113}},"52":{"start":{"line":93,"column":8},"end":{"line":93,"column":36}},"53":{"start":{"line":94,"column":13},"end":{"line":104,"column":7}},"54":{"start":{"line":95,"column":8},"end":{"line":95,"column":53}},"55":{"start":{"line":97,"column":8},"end":{"line":97,"column":136}},"56":{"start":{"line":98,"column":8},"end":{"line":103,"column":9}},"57":{"start":{"line":99,"column":10},"end":{"line":100,"column":35}},"58":{"start":{"line":100,"column":12},"end":{"line":100,"column":35}},"59":{"start":{"line":101,"column":15},"end":{"line":103,"column":9}},"60":{"start":{"line":102,"column":10},"end":{"line":102,"column":33}},"61":{"start":{"line":107,"column":4},"end":{"line":111,"column":5}},"62":{"start":{"line":108,"column":23},"end":{"line":108,"column":152}},"63":{"start":{"line":108,"column":81},"end":{"line":108,"column":140}},"64":{"start":{"line":109,"column":21},"end":{"line":109,"column":150}},"65":{"start":{"line":109,"column":79},"end":{"line":109,"column":138}},"66":{"start":{"line":110,"column":6},"end":{"line":110,"column":102}},"67":{"start":{"line":113,"column":4},"end":{"line":119,"column":5}},"68":{"start":{"line":114,"column":6},"end":{"line":118,"column":8}},"69":{"start":{"line":123,"column":23},"end":{"line":125,"column":5}},"70":{"start":{"line":126,"column":23},"end":{"line":126,"column":25}},"71":{"start":{"line":127,"column":15},"end":{"line":127,"column":31}},"72":{"start":{"line":128,"column":4},"end":{"line":132,"column":5}},"73":{"start":{"line":129,"column":24},"end":{"line":129,"column":103}},"74":{"start":{"line":130,"column":6},"end":{"line":130,"column":50}},"75":{"start":{"line":130,"column":29},"end":{"line":130,"column":49}},"76":{"start":{"line":131,"column":6},"end":{"line":131,"column":40}},"77":{"start":{"line":133,"column":26},"end":{"line":133,"column":49}},"78":{"start":{"line":134,"column":4},"end":{"line":140,"column":5}},"79":{"start":{"line":135,"column":6},"end":{"line":139,"column":7}},"80":{"start":{"line":136,"column":8},"end":{"line":136,"column":67}},"81":{"start":{"line":138,"column":8},"end":{"line":138,"column":53}},"82":{"start":{"line":141,"column":4},"end":{"line":141,"column":21}},"83":{"start":{"line":145,"column":4},"end":{"line":157,"column":5}},"84":{"start":{"line":146,"column":19},"end":{"line":146,"column":76}},"85":{"start":{"line":146,"column":58},"end":{"line":146,"column":75}},"86":{"start":{"line":147,"column":6},"end":{"line":147,"column":30}},"87":{"start":{"line":149,"column":19},"end":{"line":149,"column":41}},"88":{"start":{"line":150,"column":6},"end":{"line":150,"column":26}},"89":{"start":{"line":151,"column":6},"end":{"line":155,"column":7}},"90":{"start":{"line":152,"column":8},"end":{"line":154,"column":9}},"91":{"start":{"line":153,"column":10},"end":{"line":153,"column":59}},"92":{"start":{"line":156,"column":6},"end":{"line":156,"column":27}},"93":{"start":{"line":161,"column":4},"end":{"line":162,"column":80}},"94":{"start":{"line":166,"column":21},"end":{"line":166,"column":45}},"95":{"start":{"line":167,"column":4},"end":{"line":167,"column":40}},"96":{"start":{"line":168,"column":4},"end":{"line":169,"column":41}},"97":{"start":{"line":169,"column":6},"end":{"line":169,"column":41}},"98":{"start":{"line":178,"column":4},"end":{"line":178,"column":82}},"99":{"start":{"line":182,"column":4},"end":{"line":182,"column":85}},"100":{"start":{"line":186,"column":25},"end":{"line":191,"column":10}},"101":{"start":{"line":187,"column":6},"end":{"line":188,"column":63}},"102":{"start":{"line":188,"column":8},"end":{"line":188,"column":63}},"103":{"start":{"line":190,"column":6},"end":{"line":190,"column":44}},"104":{"start":{"line":193,"column":4},"end":{"line":193,"column":45}},"105":{"start":{"line":193,"column":21},"end":{"line":193,"column":45}},"106":{"start":{"line":196,"column":6},"end":{"line":196,"column":49}},"107":{"start":{"line":196,"column":37},"end":{"line":196,"column":49}},"108":{"start":{"line":198,"column":26},"end":{"line":198,"column":54}},"109":{"start":{"line":200,"column":6},"end":{"line":201,"column":156}},"110":{"start":{"line":201,"column":8},"end":{"line":201,"column":156}},"111":{"start":{"line":202,"column":6},"end":{"line":203,"column":146}},"112":{"start":{"line":203,"column":8},"end":{"line":203,"column":146}},"113":{"start":{"line":205,"column":6},"end":{"line":205,"column":40}},"114":{"start":{"line":217,"column":4},"end":{"line":220,"column":18}},"115":{"start":{"line":218,"column":6},"end":{"line":218,"column":22}},"116":{"start":{"line":220,"column":6},"end":{"line":220,"column":18}},"117":{"start":{"line":224,"column":4},"end":{"line":224,"column":21}},"118":{"start":{"line":228,"column":4},"end":{"line":231,"column":66}},"119":{"start":{"line":229,"column":6},"end":{"line":229,"column":93}},"120":{"start":{"line":231,"column":6},"end":{"line":231,"column":66}},"121":{"start":{"line":235,"column":4},"end":{"line":235,"column":32}},"122":{"start":{"line":239,"column":4},"end":{"line":239,"column":41}},"123":{"start":{"line":243,"column":4},"end":{"line":243,"column":56}},"124":{"start":{"line":247,"column":0},"end":{"line":247,"column":27}},"125":{"start":{"line":249,"column":0},"end":{"line":249,"column":28}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":6,"column":2},"end":{"line":6,"column":3}},"loc":{"start":{"line":6,"column":28},"end":{"line":11,"column":3}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":13,"column":2},"end":{"line":13,"column":3}},"loc":{"start":{"line":13,"column":29},"end":{"line":24,"column":3}}},"2":{"name":"(anonymous_2)","decl":{"start":{"line":26,"column":2},"end":{"line":26,"column":3}},"loc":{"start":{"line":26,"column":16},"end":{"line":35,"column":3}}},"3":{"name":"(anonymous_3)","decl":{"start":{"line":41,"column":2},"end":{"line":41,"column":3}},"loc":{"start":{"line":41,"column":10},"end":{"line":42,"column":3}}},"4":{"name":"(anonymous_4)","decl":{"start":{"line":44,"column":2},"end":{"line":44,"column":3}},"loc":{"start":{"line":44,"column":48},"end":{"line":62,"column":3}}},"5":{"name":"(anonymous_5)","decl":{"start":{"line":50,"column":23},"end":{"line":50,"column":24}},"loc":{"start":{"line":50,"column":51},"end":{"line":61,"column":5}}},"6":{"name":"(anonymous_6)","decl":{"start":{"line":64,"column":2},"end":{"line":64,"column":3}},"loc":{"start":{"line":64,"column":43},"end":{"line":120,"column":3}}},"7":{"name":"(anonymous_7)","decl":{"start":{"line":71,"column":120},"end":{"line":71,"column":121}},"loc":{"start":{"line":71,"column":136},"end":{"line":71,"column":166}}},"8":{"name":"(anonymous_8)","decl":{"start":{"line":91,"column":71},"end":{"line":91,"column":72}},"loc":{"start":{"line":91,"column":87},"end":{"line":91,"column":146}}},"9":{"name":"(anonymous_9)","decl":{"start":{"line":108,"column":65},"end":{"line":108,"column":66}},"loc":{"start":{"line":108,"column":81},"end":{"line":108,"column":140}}},"10":{"name":"(anonymous_10)","decl":{"start":{"line":109,"column":63},"end":{"line":109,"column":64}},"loc":{"start":{"line":109,"column":79},"end":{"line":109,"column":138}}},"11":{"name":"(anonymous_11)","decl":{"start":{"line":122,"column":2},"end":{"line":122,"column":3}},"loc":{"start":{"line":122,"column":11},"end":{"line":142,"column":3}}},"12":{"name":"(anonymous_12)","decl":{"start":{"line":130,"column":24},"end":{"line":130,"column":25}},"loc":{"start":{"line":130,"column":29},"end":{"line":130,"column":49}}},"13":{"name":"(anonymous_13)","decl":{"start":{"line":144,"column":2},"end":{"line":144,"column":3}},"loc":{"start":{"line":144,"column":23},"end":{"line":158,"column":3}}},"14":{"name":"(anonymous_14)","decl":{"start":{"line":146,"column":42},"end":{"line":146,"column":43}},"loc":{"start":{"line":146,"column":58},"end":{"line":146,"column":75}}},"15":{"name":"(anonymous_15)","decl":{"start":{"line":160,"column":2},"end":{"line":160,"column":3}},"loc":{"start":{"line":160,"column":30},"end":{"line":163,"column":3}}},"16":{"name":"(anonymous_16)","decl":{"start":{"line":165,"column":2},"end":{"line":165,"column":3}},"loc":{"start":{"line":165,"column":13},"end":{"line":170,"column":3}}},"17":{"name":"(anonymous_17)","decl":{"start":{"line":172,"column":2},"end":{"line":172,"column":3}},"loc":{"start":{"line":172,"column":40},"end":{"line":175,"column":3}}},"18":{"name":"(anonymous_18)","decl":{"start":{"line":177,"column":2},"end":{"line":177,"column":3}},"loc":{"start":{"line":177,"column":33},"end":{"line":179,"column":3}}},"19":{"name":"(anonymous_19)","decl":{"start":{"line":181,"column":2},"end":{"line":181,"column":3}},"loc":{"start":{"line":181,"column":26},"end":{"line":183,"column":3}}},"20":{"name":"(anonymous_20)","decl":{"start":{"line":185,"column":2},"end":{"line":185,"column":3}},"loc":{"start":{"line":185,"column":46},"end":{"line":207,"column":3}}},"21":{"name":"(anonymous_21)","decl":{"start":{"line":186,"column":43},"end":{"line":186,"column":44}},"loc":{"start":{"line":186,"column":65},"end":{"line":191,"column":5}}},"22":{"name":"(anonymous_22)","decl":{"start":{"line":193,"column":11},"end":{"line":193,"column":12}},"loc":{"start":{"line":193,"column":21},"end":{"line":193,"column":45}}},"23":{"name":"revive","decl":{"start":{"line":195,"column":13},"end":{"line":195,"column":19}},"loc":{"start":{"line":195,"column":32},"end":{"line":206,"column":5}}},"24":{"name":"(anonymous_24)","decl":{"start":{"line":216,"column":2},"end":{"line":216,"column":3}},"loc":{"start":{"line":216,"column":21},"end":{"line":221,"column":3}}},"25":{"name":"(anonymous_25)","decl":{"start":{"line":223,"column":2},"end":{"line":223,"column":3}},"loc":{"start":{"line":223,"column":12},"end":{"line":225,"column":3}}},"26":{"name":"(anonymous_26)","decl":{"start":{"line":227,"column":2},"end":{"line":227,"column":3}},"loc":{"start":{"line":227,"column":22},"end":{"line":232,"column":3}}},"27":{"name":"(anonymous_27)","decl":{"start":{"line":234,"column":2},"end":{"line":234,"column":3}},"loc":{"start":{"line":234,"column":19},"end":{"line":236,"column":3}}},"28":{"name":"(anonymous_28)","decl":{"start":{"line":238,"column":2},"end":{"line":238,"column":3}},"loc":{"start":{"line":238,"column":28},"end":{"line":240,"column":3}}},"29":{"name":"(anonymous_29)","decl":{"start":{"line":242,"column":2},"end":{"line":242,"column":3}},"loc":{"start":{"line":242,"column":21},"end":{"line":244,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":7,"column":18},"end":{"line":7,"column":88}},"type":"cond-expr","locations":[{"start":{"line":7,"column":50},"end":{"line":7,"column":60}},{"start":{"line":7,"column":63},"end":{"line":7,"column":88}}]},"1":{"loc":{"start":{"line":15,"column":24},"end":{"line":15,"column":64}},"type":"cond-expr","locations":[{"start":{"line":15,"column":57},"end":{"line":15,"column":59}},{"start":{"line":15,"column":62},"end":{"line":15,"column":64}}]},"2":{"loc":{"start":{"line":17,"column":6},"end":{"line":20,"column":53}},"type":"if","locations":[{"start":{"line":17,"column":6},"end":{"line":20,"column":53}},{"start":{"line":17,"column":6},"end":{"line":20,"column":53}}]},"3":{"loc":{"start":{"line":27,"column":4},"end":{"line":27,"column":113}},"type":"if","locations":[{"start":{"line":27,"column":4},"end":{"line":27,"column":113}},{"start":{"line":27,"column":4},"end":{"line":27,"column":113}}]},"4":{"loc":{"start":{"line":28,"column":4},"end":{"line":32,"column":5}},"type":"if","locations":[{"start":{"line":28,"column":4},"end":{"line":32,"column":5}},{"start":{"line":28,"column":4},"end":{"line":32,"column":5}}]},"5":{"loc":{"start":{"line":45,"column":4},"end":{"line":48,"column":5}},"type":"if","locations":[{"start":{"line":45,"column":4},"end":{"line":48,"column":5}},{"start":{"line":45,"column":4},"end":{"line":48,"column":5}}]},"6":{"loc":{"start":{"line":52,"column":6},"end":{"line":55,"column":7}},"type":"if","locations":[{"start":{"line":52,"column":6},"end":{"line":55,"column":7}},{"start":{"line":52,"column":6},"end":{"line":55,"column":7}}]},"7":{"loc":{"start":{"line":66,"column":27},"end":{"line":66,"column":40}},"type":"binary-expr","locations":[{"start":{"line":66,"column":27},"end":{"line":66,"column":34}},{"start":{"line":66,"column":38},"end":{"line":66,"column":40}}]},"8":{"loc":{"start":{"line":69,"column":4},"end":{"line":69,"column":149}},"type":"if","locations":[{"start":{"line":69,"column":4},"end":{"line":69,"column":149}},{"start":{"line":69,"column":4},"end":{"line":69,"column":149}}]},"9":{"loc":{"start":{"line":71,"column":30},"end":{"line":71,"column":167}},"type":"binary-expr","locations":[{"start":{"line":71,"column":30},"end":{"line":71,"column":88}},{"start":{"line":71,"column":92},"end":{"line":71,"column":167}}]},"10":{"loc":{"start":{"line":72,"column":4},"end":{"line":72,"column":162}},"type":"if","locations":[{"start":{"line":72,"column":4},"end":{"line":72,"column":162}},{"start":{"line":72,"column":4},"end":{"line":72,"column":162}}]},"11":{"loc":{"start":{"line":81,"column":47},"end":{"line":81,"column":131}},"type":"cond-expr","locations":[{"start":{"line":81,"column":83},"end":{"line":81,"column":116}},{"start":{"line":81,"column":119},"end":{"line":81,"column":131}}]},"12":{"loc":{"start":{"line":90,"column":6},"end":{"line":104,"column":7}},"type":"if","locations":[{"start":{"line":90,"column":6},"end":{"line":104,"column":7}},{"start":{"line":90,"column":6},"end":{"line":104,"column":7}}]},"13":{"loc":{"start":{"line":94,"column":13},"end":{"line":104,"column":7}},"type":"if","locations":[{"start":{"line":94,"column":13},"end":{"line":104,"column":7}},{"start":{"line":94,"column":13},"end":{"line":104,"column":7}}]},"14":{"loc":{"start":{"line":97,"column":49},"end":{"line":97,"column":136}},"type":"cond-expr","locations":[{"start":{"line":97,"column":80},"end":{"line":97,"column":117}},{"start":{"line":97,"column":120},"end":{"line":97,"column":136}}]},"15":{"loc":{"start":{"line":98,"column":8},"end":{"line":103,"column":9}},"type":"if","locations":[{"start":{"line":98,"column":8},"end":{"line":103,"column":9}},{"start":{"line":98,"column":8},"end":{"line":103,"column":9}}]},"16":{"loc":{"start":{"line":99,"column":10},"end":{"line":100,"column":35}},"type":"if","locations":[{"start":{"line":99,"column":10},"end":{"line":100,"column":35}},{"start":{"line":99,"column":10},"end":{"line":100,"column":35}}]},"17":{"loc":{"start":{"line":101,"column":15},"end":{"line":103,"column":9}},"type":"if","locations":[{"start":{"line":101,"column":15},"end":{"line":103,"column":9}},{"start":{"line":101,"column":15},"end":{"line":103,"column":9}}]},"18":{"loc":{"start":{"line":107,"column":4},"end":{"line":111,"column":5}},"type":"if","locations":[{"start":{"line":107,"column":4},"end":{"line":111,"column":5}},{"start":{"line":107,"column":4},"end":{"line":111,"column":5}}]},"19":{"loc":{"start":{"line":129,"column":24},"end":{"line":129,"column":103}},"type":"cond-expr","locations":[{"start":{"line":129,"column":57},"end":{"line":129,"column":72}},{"start":{"line":129,"column":75},"end":{"line":129,"column":103}}]},"20":{"loc":{"start":{"line":135,"column":6},"end":{"line":139,"column":7}},"type":"if","locations":[{"start":{"line":135,"column":6},"end":{"line":139,"column":7}},{"start":{"line":135,"column":6},"end":{"line":139,"column":7}}]},"21":{"loc":{"start":{"line":145,"column":4},"end":{"line":157,"column":5}},"type":"if","locations":[{"start":{"line":145,"column":4},"end":{"line":157,"column":5}},{"start":{"line":145,"column":4},"end":{"line":157,"column":5}}]},"22":{"loc":{"start":{"line":152,"column":8},"end":{"line":154,"column":9}},"type":"if","locations":[{"start":{"line":152,"column":8},"end":{"line":154,"column":9}},{"start":{"line":152,"column":8},"end":{"line":154,"column":9}}]},"23":{"loc":{"start":{"line":161,"column":11},"end":{"line":162,"column":80}},"type":"binary-expr","locations":[{"start":{"line":161,"column":11},"end":{"line":161,"column":55}},{"start":{"line":162,"column":6},"end":{"line":162,"column":80}}]},"24":{"loc":{"start":{"line":168,"column":4},"end":{"line":169,"column":41}},"type":"if","locations":[{"start":{"line":168,"column":4},"end":{"line":169,"column":41}},{"start":{"line":168,"column":4},"end":{"line":169,"column":41}}]},"25":{"loc":{"start":{"line":187,"column":6},"end":{"line":188,"column":63}},"type":"if","locations":[{"start":{"line":187,"column":6},"end":{"line":188,"column":63}},{"start":{"line":187,"column":6},"end":{"line":188,"column":63}}]},"26":{"loc":{"start":{"line":196,"column":6},"end":{"line":196,"column":49}},"type":"if","locations":[{"start":{"line":196,"column":6},"end":{"line":196,"column":49}},{"start":{"line":196,"column":6},"end":{"line":196,"column":49}}]},"27":{"loc":{"start":{"line":196,"column":10},"end":{"line":196,"column":35}},"type":"binary-expr","locations":[{"start":{"line":196,"column":10},"end":{"line":196,"column":16}},{"start":{"line":196,"column":20},"end":{"line":196,"column":35}}]},"28":{"loc":{"start":{"line":200,"column":6},"end":{"line":201,"column":156}},"type":"if","locations":[{"start":{"line":200,"column":6},"end":{"line":201,"column":156}},{"start":{"line":200,"column":6},"end":{"line":201,"column":156}}]},"29":{"loc":{"start":{"line":202,"column":6},"end":{"line":203,"column":146}},"type":"if","locations":[{"start":{"line":202,"column":6},"end":{"line":203,"column":146}},{"start":{"line":202,"column":6},"end":{"line":203,"column":146}}]},"30":{"loc":{"start":{"line":217,"column":4},"end":{"line":220,"column":18}},"type":"if","locations":[{"start":{"line":217,"column":4},"end":{"line":220,"column":18}},{"start":{"line":217,"column":4},"end":{"line":220,"column":18}}]},"31":{"loc":{"start":{"line":228,"column":4},"end":{"line":231,"column":66}},"type":"if","locations":[{"start":{"line":228,"column":4},"end":{"line":231,"column":66}},{"start":{"line":228,"column":4},"end":{"line":231,"column":66}}]}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":0,"117":0,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":1,"125":1},"f":{"0":1,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0},"b":{"0":[1,0],"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"fd97ec1bb72c93d02511a1005ef66f70c2aa62ff"},"/Users/joshchisholm/projects/value-object.js/src/validation.js":{"path":"/Users/joshchisholm/projects/value-object.js/src/validation.js","statementMap":{"0":{"start":{"line":5,"column":4},"end":{"line":5,"column":22}},"1":{"start":{"line":9,"column":4},"end":{"line":9,"column":60}},"2":{"start":{"line":13,"column":4},"end":{"line":13,"column":89}},"3":{"start":{"line":14,"column":4},"end":{"line":14,"column":15}},"4":{"start":{"line":18,"column":4},"end":{"line":18,"column":35}},"5":{"start":{"line":22,"column":4},"end":{"line":22,"column":60}},"6":{"start":{"line":26,"column":4},"end":{"line":26,"column":61}},"7":{"start":{"line":26,"column":31},"end":{"line":26,"column":49}},"8":{"start":{"line":32,"column":4},"end":{"line":32,"column":28}},"9":{"start":{"line":33,"column":4},"end":{"line":33,"column":28}},"10":{"start":{"line":37,"column":4},"end":{"line":37,"column":66}},"11":{"start":{"line":38,"column":4},"end":{"line":38,"column":15}},"12":{"start":{"line":44,"column":4},"end":{"line":44,"column":26}},"13":{"start":{"line":48,"column":4},"end":{"line":48,"column":23}},"14":{"start":{"line":54,"column":4},"end":{"line":54,"column":28}},"15":{"start":{"line":55,"column":4},"end":{"line":55,"column":26}},"16":{"start":{"line":59,"column":4},"end":{"line":59,"column":45}},"17":{"start":{"line":63,"column":0},"end":{"line":65,"column":1}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":4,"column":2},"end":{"line":4,"column":3}},"loc":{"start":{"line":4,"column":16},"end":{"line":6,"column":3}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":8,"column":2},"end":{"line":8,"column":3}},"loc":{"start":{"line":8,"column":16},"end":{"line":10,"column":3}}},"2":{"name":"(anonymous_2)","decl":{"start":{"line":12,"column":2},"end":{"line":12,"column":3}},"loc":{"start":{"line":12,"column":15},"end":{"line":15,"column":3}}},"3":{"name":"(anonymous_3)","decl":{"start":{"line":17,"column":2},"end":{"line":17,"column":3}},"loc":{"start":{"line":17,"column":8},"end":{"line":19,"column":3}}},"4":{"name":"(anonymous_4)","decl":{"start":{"line":21,"column":2},"end":{"line":21,"column":3}},"loc":{"start":{"line":21,"column":8},"end":{"line":23,"column":3}}},"5":{"name":"(anonymous_5)","decl":{"start":{"line":25,"column":2},"end":{"line":25,"column":3}},"loc":{"start":{"line":25,"column":13},"end":{"line":27,"column":3}}},"6":{"name":"(anonymous_6)","decl":{"start":{"line":26,"column":20},"end":{"line":26,"column":21}},"loc":{"start":{"line":26,"column":31},"end":{"line":26,"column":49}}},"7":{"name":"(anonymous_7)","decl":{"start":{"line":31,"column":2},"end":{"line":31,"column":3}},"loc":{"start":{"line":31,"column":34},"end":{"line":34,"column":3}}},"8":{"name":"(anonymous_8)","decl":{"start":{"line":36,"column":2},"end":{"line":36,"column":3}},"loc":{"start":{"line":36,"column":15},"end":{"line":39,"column":3}}},"9":{"name":"(anonymous_9)","decl":{"start":{"line":43,"column":2},"end":{"line":43,"column":3}},"loc":{"start":{"line":43,"column":23},"end":{"line":45,"column":3}}},"10":{"name":"(anonymous_10)","decl":{"start":{"line":47,"column":2},"end":{"line":47,"column":3}},"loc":{"start":{"line":47,"column":13},"end":{"line":49,"column":3}}},"11":{"name":"(anonymous_11)","decl":{"start":{"line":53,"column":2},"end":{"line":53,"column":3}},"loc":{"start":{"line":53,"column":33},"end":{"line":56,"column":3}}},"12":{"name":"(anonymous_12)","decl":{"start":{"line":58,"column":2},"end":{"line":58,"column":3}},"loc":{"start":{"line":58,"column":13},"end":{"line":60,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":13,"column":23},"end":{"line":13,"column":88}},"type":"cond-expr","locations":[{"start":{"line":13,"column":52},"end":{"line":13,"column":59}},{"start":{"line":13,"column":62},"end":{"line":13,"column":88}}]}},"s":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":1},"f":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0},"b":{"0":[0,0]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"ffbb5d501cbb598110be9e2398a8086637cf074d"}} | ||
{"/Users/joshchisholm/projects/value-object.js/src/valueObject.js":{"path":"/Users/joshchisholm/projects/value-object.js/src/valueObject.js","statementMap":{"0":{"start":{"line":3,"column":31},"end":{"line":3,"column":54}},"1":{"start":{"line":7,"column":2},"end":{"line":13,"column":3}},"2":{"start":{"line":8,"column":4},"end":{"line":8,"column":50}},"3":{"start":{"line":9,"column":9},"end":{"line":13,"column":3}},"4":{"start":{"line":10,"column":4},"end":{"line":10,"column":120}},"5":{"start":{"line":12,"column":4},"end":{"line":12,"column":29}},"6":{"start":{"line":16,"column":2},"end":{"line":31,"column":3}},"7":{"start":{"line":17,"column":28},"end":{"line":17,"column":132}},"8":{"start":{"line":17,"column":62},"end":{"line":17,"column":129}},"9":{"start":{"line":18,"column":4},"end":{"line":22,"column":5}},"10":{"start":{"line":19,"column":6},"end":{"line":19,"column":40}},"11":{"start":{"line":21,"column":6},"end":{"line":21,"column":40}},"12":{"start":{"line":23,"column":9},"end":{"line":31,"column":3}},"13":{"start":{"line":24,"column":4},"end":{"line":28,"column":5}},"14":{"start":{"line":25,"column":6},"end":{"line":25,"column":19}},"15":{"start":{"line":27,"column":6},"end":{"line":27,"column":53}},"16":{"start":{"line":30,"column":4},"end":{"line":30,"column":25}},"17":{"start":{"line":34,"column":2},"end":{"line":42,"column":3}},"18":{"start":{"line":35,"column":4},"end":{"line":35,"column":16}},"19":{"start":{"line":36,"column":9},"end":{"line":42,"column":3}},"20":{"start":{"line":37,"column":4},"end":{"line":37,"column":60}},"21":{"start":{"line":37,"column":29},"end":{"line":37,"column":59}},"22":{"start":{"line":38,"column":9},"end":{"line":42,"column":3}},"23":{"start":{"line":39,"column":4},"end":{"line":39,"column":43}},"24":{"start":{"line":41,"column":4},"end":{"line":41,"column":31}},"25":{"start":{"line":44,"column":2},"end":{"line":49,"column":3}},"26":{"start":{"line":55,"column":4},"end":{"line":64,"column":5}},"27":{"start":{"line":56,"column":6},"end":{"line":60,"column":8}},"28":{"start":{"line":57,"column":8},"end":{"line":59,"column":9}},"29":{"start":{"line":58,"column":10},"end":{"line":58,"column":84}},"30":{"start":{"line":61,"column":6},"end":{"line":61,"column":24}},"31":{"start":{"line":63,"column":6},"end":{"line":63,"column":39}},"32":{"start":{"line":65,"column":18},"end":{"line":65,"column":60}},"33":{"start":{"line":66,"column":4},"end":{"line":66,"column":28}},"34":{"start":{"line":67,"column":4},"end":{"line":67,"column":16}},"35":{"start":{"line":71,"column":15},"end":{"line":71,"column":19}},"36":{"start":{"line":72,"column":24},"end":{"line":72,"column":64}},"37":{"start":{"line":73,"column":4},"end":{"line":79,"column":5}},"38":{"start":{"line":74,"column":6},"end":{"line":77,"column":53}},"39":{"start":{"line":75,"column":8},"end":{"line":75,"column":82}},"40":{"start":{"line":77,"column":8},"end":{"line":77,"column":53}},"41":{"start":{"line":78,"column":6},"end":{"line":78,"column":40}},"42":{"start":{"line":80,"column":4},"end":{"line":80,"column":24}},"43":{"start":{"line":84,"column":4},"end":{"line":84,"column":113}},"44":{"start":{"line":84,"column":45},"end":{"line":84,"column":113}},"45":{"start":{"line":85,"column":4},"end":{"line":89,"column":5}},"46":{"start":{"line":86,"column":6},"end":{"line":86,"column":81}},"47":{"start":{"line":88,"column":6},"end":{"line":88,"column":76}},"48":{"start":{"line":90,"column":4},"end":{"line":90,"column":16}},"49":{"start":{"line":91,"column":4},"end":{"line":91,"column":23}},"50":{"start":{"line":102,"column":4},"end":{"line":105,"column":5}},"51":{"start":{"line":103,"column":22},"end":{"line":103,"column":111}},"52":{"start":{"line":104,"column":6},"end":{"line":104,"column":34}},"53":{"start":{"line":107,"column":4},"end":{"line":118,"column":6}},"54":{"start":{"line":108,"column":23},"end":{"line":108,"column":37}},"55":{"start":{"line":109,"column":6},"end":{"line":112,"column":7}},"56":{"start":{"line":110,"column":24},"end":{"line":110,"column":135}},"57":{"start":{"line":111,"column":8},"end":{"line":111,"column":36}},"58":{"start":{"line":113,"column":6},"end":{"line":117,"column":8}},"59":{"start":{"line":123,"column":27},"end":{"line":123,"column":40}},"60":{"start":{"line":124,"column":34},"end":{"line":124,"column":57}},"61":{"start":{"line":125,"column":32},"end":{"line":125,"column":59}},"62":{"start":{"line":126,"column":4},"end":{"line":126,"column":149}},"63":{"start":{"line":126,"column":26},"end":{"line":126,"column":149}},"64":{"start":{"line":128,"column":30},"end":{"line":128,"column":167}},"65":{"start":{"line":128,"column":136},"end":{"line":128,"column":166}},"66":{"start":{"line":129,"column":4},"end":{"line":129,"column":162}},"67":{"start":{"line":129,"column":28},"end":{"line":129,"column":162}},"68":{"start":{"line":131,"column":29},"end":{"line":133,"column":6}},"69":{"start":{"line":132,"column":6},"end":{"line":132,"column":92}},"70":{"start":{"line":135,"column":23},"end":{"line":135,"column":63}},"71":{"start":{"line":135,"column":53},"end":{"line":135,"column":62}},"72":{"start":{"line":137,"column":4},"end":{"line":141,"column":5}},"73":{"start":{"line":138,"column":23},"end":{"line":138,"column":97}},"74":{"start":{"line":138,"column":50},"end":{"line":138,"column":85}},"75":{"start":{"line":139,"column":21},"end":{"line":139,"column":93}},"76":{"start":{"line":139,"column":48},"end":{"line":139,"column":81}},"77":{"start":{"line":140,"column":6},"end":{"line":140,"column":104}},"78":{"start":{"line":143,"column":4},"end":{"line":149,"column":5}},"79":{"start":{"line":144,"column":6},"end":{"line":148,"column":8}},"80":{"start":{"line":153,"column":23},"end":{"line":155,"column":5}},"81":{"start":{"line":156,"column":23},"end":{"line":156,"column":25}},"82":{"start":{"line":157,"column":15},"end":{"line":157,"column":31}},"83":{"start":{"line":158,"column":4},"end":{"line":162,"column":5}},"84":{"start":{"line":159,"column":24},"end":{"line":159,"column":103}},"85":{"start":{"line":160,"column":6},"end":{"line":160,"column":50}},"86":{"start":{"line":160,"column":29},"end":{"line":160,"column":49}},"87":{"start":{"line":161,"column":6},"end":{"line":161,"column":40}},"88":{"start":{"line":163,"column":26},"end":{"line":163,"column":49}},"89":{"start":{"line":164,"column":4},"end":{"line":170,"column":5}},"90":{"start":{"line":165,"column":6},"end":{"line":169,"column":7}},"91":{"start":{"line":166,"column":8},"end":{"line":166,"column":67}},"92":{"start":{"line":168,"column":8},"end":{"line":168,"column":53}},"93":{"start":{"line":171,"column":4},"end":{"line":171,"column":21}},"94":{"start":{"line":175,"column":4},"end":{"line":187,"column":5}},"95":{"start":{"line":176,"column":19},"end":{"line":176,"column":76}},"96":{"start":{"line":176,"column":58},"end":{"line":176,"column":75}},"97":{"start":{"line":177,"column":6},"end":{"line":177,"column":30}},"98":{"start":{"line":179,"column":19},"end":{"line":179,"column":41}},"99":{"start":{"line":180,"column":6},"end":{"line":180,"column":26}},"100":{"start":{"line":181,"column":6},"end":{"line":185,"column":7}},"101":{"start":{"line":182,"column":8},"end":{"line":184,"column":9}},"102":{"start":{"line":183,"column":10},"end":{"line":183,"column":59}},"103":{"start":{"line":186,"column":6},"end":{"line":186,"column":27}},"104":{"start":{"line":191,"column":4},"end":{"line":192,"column":80}},"105":{"start":{"line":196,"column":21},"end":{"line":196,"column":45}},"106":{"start":{"line":197,"column":4},"end":{"line":197,"column":40}},"107":{"start":{"line":198,"column":4},"end":{"line":199,"column":41}},"108":{"start":{"line":199,"column":6},"end":{"line":199,"column":41}},"109":{"start":{"line":208,"column":4},"end":{"line":208,"column":82}},"110":{"start":{"line":212,"column":4},"end":{"line":212,"column":85}},"111":{"start":{"line":216,"column":25},"end":{"line":221,"column":10}},"112":{"start":{"line":217,"column":6},"end":{"line":218,"column":63}},"113":{"start":{"line":218,"column":8},"end":{"line":218,"column":63}},"114":{"start":{"line":220,"column":6},"end":{"line":220,"column":44}},"115":{"start":{"line":223,"column":4},"end":{"line":223,"column":45}},"116":{"start":{"line":223,"column":21},"end":{"line":223,"column":45}},"117":{"start":{"line":226,"column":6},"end":{"line":226,"column":49}},"118":{"start":{"line":226,"column":37},"end":{"line":226,"column":49}},"119":{"start":{"line":228,"column":26},"end":{"line":228,"column":54}},"120":{"start":{"line":230,"column":6},"end":{"line":232,"column":78}},"121":{"start":{"line":231,"column":8},"end":{"line":232,"column":78}},"122":{"start":{"line":233,"column":6},"end":{"line":235,"column":68}},"123":{"start":{"line":234,"column":8},"end":{"line":235,"column":68}},"124":{"start":{"line":237,"column":6},"end":{"line":237,"column":40}},"125":{"start":{"line":249,"column":4},"end":{"line":252,"column":18}},"126":{"start":{"line":250,"column":6},"end":{"line":250,"column":22}},"127":{"start":{"line":252,"column":6},"end":{"line":252,"column":18}},"128":{"start":{"line":256,"column":4},"end":{"line":256,"column":21}},"129":{"start":{"line":260,"column":4},"end":{"line":263,"column":66}},"130":{"start":{"line":261,"column":6},"end":{"line":261,"column":93}},"131":{"start":{"line":263,"column":6},"end":{"line":263,"column":66}},"132":{"start":{"line":267,"column":4},"end":{"line":267,"column":32}},"133":{"start":{"line":271,"column":4},"end":{"line":271,"column":41}},"134":{"start":{"line":275,"column":4},"end":{"line":275,"column":56}},"135":{"start":{"line":279,"column":0},"end":{"line":279,"column":27}},"136":{"start":{"line":281,"column":0},"end":{"line":281,"column":28}}},"fnMap":{"0":{"name":"checkType","decl":{"start":{"line":5,"column":9},"end":{"line":5,"column":18}},"loc":{"start":{"line":5,"column":56},"end":{"line":50,"column":1}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":17,"column":57},"end":{"line":17,"column":58}},"loc":{"start":{"line":17,"column":62},"end":{"line":17,"column":129}}},"2":{"name":"(anonymous_2)","decl":{"start":{"line":37,"column":24},"end":{"line":37,"column":25}},"loc":{"start":{"line":37,"column":29},"end":{"line":37,"column":59}}},"3":{"name":"(anonymous_3)","decl":{"start":{"line":53,"column":2},"end":{"line":53,"column":3}},"loc":{"start":{"line":53,"column":28},"end":{"line":68,"column":3}}},"4":{"name":"(anonymous_4)","decl":{"start":{"line":56,"column":40},"end":{"line":56,"column":41}},"loc":{"start":{"line":56,"column":58},"end":{"line":60,"column":7}}},"5":{"name":"(anonymous_5)","decl":{"start":{"line":70,"column":2},"end":{"line":70,"column":3}},"loc":{"start":{"line":70,"column":29},"end":{"line":81,"column":3}}},"6":{"name":"(anonymous_6)","decl":{"start":{"line":83,"column":2},"end":{"line":83,"column":3}},"loc":{"start":{"line":83,"column":16},"end":{"line":92,"column":3}}},"7":{"name":"(anonymous_7)","decl":{"start":{"line":98,"column":2},"end":{"line":98,"column":3}},"loc":{"start":{"line":98,"column":10},"end":{"line":99,"column":3}}},"8":{"name":"(anonymous_8)","decl":{"start":{"line":101,"column":2},"end":{"line":101,"column":3}},"loc":{"start":{"line":101,"column":48},"end":{"line":119,"column":3}}},"9":{"name":"(anonymous_9)","decl":{"start":{"line":107,"column":23},"end":{"line":107,"column":24}},"loc":{"start":{"line":107,"column":51},"end":{"line":118,"column":5}}},"10":{"name":"(anonymous_10)","decl":{"start":{"line":121,"column":2},"end":{"line":121,"column":3}},"loc":{"start":{"line":121,"column":43},"end":{"line":150,"column":3}}},"11":{"name":"(anonymous_11)","decl":{"start":{"line":128,"column":120},"end":{"line":128,"column":121}},"loc":{"start":{"line":128,"column":136},"end":{"line":128,"column":166}}},"12":{"name":"(anonymous_12)","decl":{"start":{"line":131,"column":53},"end":{"line":131,"column":54}},"loc":{"start":{"line":131,"column":69},"end":{"line":133,"column":5}}},"13":{"name":"(anonymous_13)","decl":{"start":{"line":135,"column":47},"end":{"line":135,"column":48}},"loc":{"start":{"line":135,"column":53},"end":{"line":135,"column":62}}},"14":{"name":"(anonymous_14)","decl":{"start":{"line":138,"column":44},"end":{"line":138,"column":45}},"loc":{"start":{"line":138,"column":50},"end":{"line":138,"column":85}}},"15":{"name":"(anonymous_15)","decl":{"start":{"line":139,"column":42},"end":{"line":139,"column":43}},"loc":{"start":{"line":139,"column":48},"end":{"line":139,"column":81}}},"16":{"name":"(anonymous_16)","decl":{"start":{"line":152,"column":2},"end":{"line":152,"column":3}},"loc":{"start":{"line":152,"column":11},"end":{"line":172,"column":3}}},"17":{"name":"(anonymous_17)","decl":{"start":{"line":160,"column":24},"end":{"line":160,"column":25}},"loc":{"start":{"line":160,"column":29},"end":{"line":160,"column":49}}},"18":{"name":"(anonymous_18)","decl":{"start":{"line":174,"column":2},"end":{"line":174,"column":3}},"loc":{"start":{"line":174,"column":23},"end":{"line":188,"column":3}}},"19":{"name":"(anonymous_19)","decl":{"start":{"line":176,"column":42},"end":{"line":176,"column":43}},"loc":{"start":{"line":176,"column":58},"end":{"line":176,"column":75}}},"20":{"name":"(anonymous_20)","decl":{"start":{"line":190,"column":2},"end":{"line":190,"column":3}},"loc":{"start":{"line":190,"column":30},"end":{"line":193,"column":3}}},"21":{"name":"(anonymous_21)","decl":{"start":{"line":195,"column":2},"end":{"line":195,"column":3}},"loc":{"start":{"line":195,"column":13},"end":{"line":200,"column":3}}},"22":{"name":"(anonymous_22)","decl":{"start":{"line":202,"column":2},"end":{"line":202,"column":3}},"loc":{"start":{"line":202,"column":40},"end":{"line":205,"column":3}}},"23":{"name":"(anonymous_23)","decl":{"start":{"line":207,"column":2},"end":{"line":207,"column":3}},"loc":{"start":{"line":207,"column":33},"end":{"line":209,"column":3}}},"24":{"name":"(anonymous_24)","decl":{"start":{"line":211,"column":2},"end":{"line":211,"column":3}},"loc":{"start":{"line":211,"column":26},"end":{"line":213,"column":3}}},"25":{"name":"(anonymous_25)","decl":{"start":{"line":215,"column":2},"end":{"line":215,"column":3}},"loc":{"start":{"line":215,"column":46},"end":{"line":239,"column":3}}},"26":{"name":"(anonymous_26)","decl":{"start":{"line":216,"column":43},"end":{"line":216,"column":44}},"loc":{"start":{"line":216,"column":65},"end":{"line":221,"column":5}}},"27":{"name":"(anonymous_27)","decl":{"start":{"line":223,"column":11},"end":{"line":223,"column":12}},"loc":{"start":{"line":223,"column":21},"end":{"line":223,"column":45}}},"28":{"name":"revive","decl":{"start":{"line":225,"column":13},"end":{"line":225,"column":19}},"loc":{"start":{"line":225,"column":32},"end":{"line":238,"column":5}}},"29":{"name":"(anonymous_29)","decl":{"start":{"line":248,"column":2},"end":{"line":248,"column":3}},"loc":{"start":{"line":248,"column":21},"end":{"line":253,"column":3}}},"30":{"name":"(anonymous_30)","decl":{"start":{"line":255,"column":2},"end":{"line":255,"column":3}},"loc":{"start":{"line":255,"column":12},"end":{"line":257,"column":3}}},"31":{"name":"(anonymous_31)","decl":{"start":{"line":259,"column":2},"end":{"line":259,"column":3}},"loc":{"start":{"line":259,"column":22},"end":{"line":264,"column":3}}},"32":{"name":"(anonymous_32)","decl":{"start":{"line":266,"column":2},"end":{"line":266,"column":3}},"loc":{"start":{"line":266,"column":19},"end":{"line":268,"column":3}}},"33":{"name":"(anonymous_33)","decl":{"start":{"line":270,"column":2},"end":{"line":270,"column":3}},"loc":{"start":{"line":270,"column":28},"end":{"line":272,"column":3}}},"34":{"name":"(anonymous_34)","decl":{"start":{"line":274,"column":2},"end":{"line":274,"column":3}},"loc":{"start":{"line":274,"column":21},"end":{"line":276,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":7,"column":2},"end":{"line":13,"column":3}},"type":"if","locations":[{"start":{"line":7,"column":2},"end":{"line":13,"column":3}},{"start":{"line":7,"column":2},"end":{"line":13,"column":3}}]},"1":{"loc":{"start":{"line":9,"column":9},"end":{"line":13,"column":3}},"type":"if","locations":[{"start":{"line":9,"column":9},"end":{"line":13,"column":3}},{"start":{"line":9,"column":9},"end":{"line":13,"column":3}}]},"2":{"loc":{"start":{"line":10,"column":19},"end":{"line":10,"column":117}},"type":"cond-expr","locations":[{"start":{"line":10,"column":61},"end":{"line":10,"column":97}},{"start":{"line":10,"column":100},"end":{"line":10,"column":117}}]},"3":{"loc":{"start":{"line":16,"column":2},"end":{"line":31,"column":3}},"type":"if","locations":[{"start":{"line":16,"column":2},"end":{"line":31,"column":3}},{"start":{"line":16,"column":2},"end":{"line":31,"column":3}}]},"4":{"loc":{"start":{"line":17,"column":62},"end":{"line":17,"column":129}},"type":"cond-expr","locations":[{"start":{"line":17,"column":86},"end":{"line":17,"column":118}},{"start":{"line":17,"column":121},"end":{"line":17,"column":129}}]},"5":{"loc":{"start":{"line":18,"column":4},"end":{"line":22,"column":5}},"type":"if","locations":[{"start":{"line":18,"column":4},"end":{"line":22,"column":5}},{"start":{"line":18,"column":4},"end":{"line":22,"column":5}}]},"6":{"loc":{"start":{"line":23,"column":9},"end":{"line":31,"column":3}},"type":"if","locations":[{"start":{"line":23,"column":9},"end":{"line":31,"column":3}},{"start":{"line":23,"column":9},"end":{"line":31,"column":3}}]},"7":{"loc":{"start":{"line":24,"column":4},"end":{"line":28,"column":5}},"type":"if","locations":[{"start":{"line":24,"column":4},"end":{"line":28,"column":5}},{"start":{"line":24,"column":4},"end":{"line":28,"column":5}}]},"8":{"loc":{"start":{"line":34,"column":2},"end":{"line":42,"column":3}},"type":"if","locations":[{"start":{"line":34,"column":2},"end":{"line":42,"column":3}},{"start":{"line":34,"column":2},"end":{"line":42,"column":3}}]},"9":{"loc":{"start":{"line":36,"column":9},"end":{"line":42,"column":3}},"type":"if","locations":[{"start":{"line":36,"column":9},"end":{"line":42,"column":3}},{"start":{"line":36,"column":9},"end":{"line":42,"column":3}}]},"10":{"loc":{"start":{"line":36,"column":13},"end":{"line":36,"column":109}},"type":"binary-expr","locations":[{"start":{"line":36,"column":13},"end":{"line":36,"column":33}},{"start":{"line":36,"column":37},"end":{"line":36,"column":66}},{"start":{"line":36,"column":70},"end":{"line":36,"column":109}}]},"11":{"loc":{"start":{"line":38,"column":9},"end":{"line":42,"column":3}},"type":"if","locations":[{"start":{"line":38,"column":9},"end":{"line":42,"column":3}},{"start":{"line":38,"column":9},"end":{"line":42,"column":3}}]},"12":{"loc":{"start":{"line":38,"column":13},"end":{"line":38,"column":78}},"type":"binary-expr","locations":[{"start":{"line":38,"column":13},"end":{"line":38,"column":38}},{"start":{"line":38,"column":42},"end":{"line":38,"column":78}}]},"13":{"loc":{"start":{"line":55,"column":4},"end":{"line":64,"column":5}},"type":"if","locations":[{"start":{"line":55,"column":4},"end":{"line":64,"column":5}},{"start":{"line":55,"column":4},"end":{"line":64,"column":5}}]},"14":{"loc":{"start":{"line":57,"column":8},"end":{"line":59,"column":9}},"type":"if","locations":[{"start":{"line":57,"column":8},"end":{"line":59,"column":9}},{"start":{"line":57,"column":8},"end":{"line":59,"column":9}}]},"15":{"loc":{"start":{"line":57,"column":12},"end":{"line":57,"column":71}},"type":"binary-expr","locations":[{"start":{"line":57,"column":12},"end":{"line":57,"column":41}},{"start":{"line":57,"column":45},"end":{"line":57,"column":71}}]},"16":{"loc":{"start":{"line":72,"column":24},"end":{"line":72,"column":64}},"type":"cond-expr","locations":[{"start":{"line":72,"column":57},"end":{"line":72,"column":59}},{"start":{"line":72,"column":62},"end":{"line":72,"column":64}}]},"17":{"loc":{"start":{"line":74,"column":6},"end":{"line":77,"column":53}},"type":"if","locations":[{"start":{"line":74,"column":6},"end":{"line":77,"column":53}},{"start":{"line":74,"column":6},"end":{"line":77,"column":53}}]},"18":{"loc":{"start":{"line":84,"column":4},"end":{"line":84,"column":113}},"type":"if","locations":[{"start":{"line":84,"column":4},"end":{"line":84,"column":113}},{"start":{"line":84,"column":4},"end":{"line":84,"column":113}}]},"19":{"loc":{"start":{"line":85,"column":4},"end":{"line":89,"column":5}},"type":"if","locations":[{"start":{"line":85,"column":4},"end":{"line":89,"column":5}},{"start":{"line":85,"column":4},"end":{"line":89,"column":5}}]},"20":{"loc":{"start":{"line":102,"column":4},"end":{"line":105,"column":5}},"type":"if","locations":[{"start":{"line":102,"column":4},"end":{"line":105,"column":5}},{"start":{"line":102,"column":4},"end":{"line":105,"column":5}}]},"21":{"loc":{"start":{"line":109,"column":6},"end":{"line":112,"column":7}},"type":"if","locations":[{"start":{"line":109,"column":6},"end":{"line":112,"column":7}},{"start":{"line":109,"column":6},"end":{"line":112,"column":7}}]},"22":{"loc":{"start":{"line":123,"column":27},"end":{"line":123,"column":40}},"type":"binary-expr","locations":[{"start":{"line":123,"column":27},"end":{"line":123,"column":34}},{"start":{"line":123,"column":38},"end":{"line":123,"column":40}}]},"23":{"loc":{"start":{"line":126,"column":4},"end":{"line":126,"column":149}},"type":"if","locations":[{"start":{"line":126,"column":4},"end":{"line":126,"column":149}},{"start":{"line":126,"column":4},"end":{"line":126,"column":149}}]},"24":{"loc":{"start":{"line":128,"column":30},"end":{"line":128,"column":167}},"type":"binary-expr","locations":[{"start":{"line":128,"column":30},"end":{"line":128,"column":88}},{"start":{"line":128,"column":92},"end":{"line":128,"column":167}}]},"25":{"loc":{"start":{"line":129,"column":4},"end":{"line":129,"column":162}},"type":"if","locations":[{"start":{"line":129,"column":4},"end":{"line":129,"column":162}},{"start":{"line":129,"column":4},"end":{"line":129,"column":162}}]},"26":{"loc":{"start":{"line":137,"column":4},"end":{"line":141,"column":5}},"type":"if","locations":[{"start":{"line":137,"column":4},"end":{"line":141,"column":5}},{"start":{"line":137,"column":4},"end":{"line":141,"column":5}}]},"27":{"loc":{"start":{"line":159,"column":24},"end":{"line":159,"column":103}},"type":"cond-expr","locations":[{"start":{"line":159,"column":57},"end":{"line":159,"column":72}},{"start":{"line":159,"column":75},"end":{"line":159,"column":103}}]},"28":{"loc":{"start":{"line":165,"column":6},"end":{"line":169,"column":7}},"type":"if","locations":[{"start":{"line":165,"column":6},"end":{"line":169,"column":7}},{"start":{"line":165,"column":6},"end":{"line":169,"column":7}}]},"29":{"loc":{"start":{"line":175,"column":4},"end":{"line":187,"column":5}},"type":"if","locations":[{"start":{"line":175,"column":4},"end":{"line":187,"column":5}},{"start":{"line":175,"column":4},"end":{"line":187,"column":5}}]},"30":{"loc":{"start":{"line":182,"column":8},"end":{"line":184,"column":9}},"type":"if","locations":[{"start":{"line":182,"column":8},"end":{"line":184,"column":9}},{"start":{"line":182,"column":8},"end":{"line":184,"column":9}}]},"31":{"loc":{"start":{"line":191,"column":11},"end":{"line":192,"column":80}},"type":"binary-expr","locations":[{"start":{"line":191,"column":11},"end":{"line":191,"column":55}},{"start":{"line":192,"column":6},"end":{"line":192,"column":80}}]},"32":{"loc":{"start":{"line":198,"column":4},"end":{"line":199,"column":41}},"type":"if","locations":[{"start":{"line":198,"column":4},"end":{"line":199,"column":41}},{"start":{"line":198,"column":4},"end":{"line":199,"column":41}}]},"33":{"loc":{"start":{"line":217,"column":6},"end":{"line":218,"column":63}},"type":"if","locations":[{"start":{"line":217,"column":6},"end":{"line":218,"column":63}},{"start":{"line":217,"column":6},"end":{"line":218,"column":63}}]},"34":{"loc":{"start":{"line":226,"column":6},"end":{"line":226,"column":49}},"type":"if","locations":[{"start":{"line":226,"column":6},"end":{"line":226,"column":49}},{"start":{"line":226,"column":6},"end":{"line":226,"column":49}}]},"35":{"loc":{"start":{"line":226,"column":10},"end":{"line":226,"column":35}},"type":"binary-expr","locations":[{"start":{"line":226,"column":10},"end":{"line":226,"column":16}},{"start":{"line":226,"column":20},"end":{"line":226,"column":35}}]},"36":{"loc":{"start":{"line":230,"column":6},"end":{"line":232,"column":78}},"type":"if","locations":[{"start":{"line":230,"column":6},"end":{"line":232,"column":78}},{"start":{"line":230,"column":6},"end":{"line":232,"column":78}}]},"37":{"loc":{"start":{"line":233,"column":6},"end":{"line":235,"column":68}},"type":"if","locations":[{"start":{"line":233,"column":6},"end":{"line":235,"column":68}},{"start":{"line":233,"column":6},"end":{"line":235,"column":68}}]},"38":{"loc":{"start":{"line":249,"column":4},"end":{"line":252,"column":18}},"type":"if","locations":[{"start":{"line":249,"column":4},"end":{"line":252,"column":18}},{"start":{"line":249,"column":4},"end":{"line":252,"column":18}}]},"39":{"loc":{"start":{"line":260,"column":4},"end":{"line":263,"column":66}},"type":"if","locations":[{"start":{"line":260,"column":4},"end":{"line":263,"column":66}},{"start":{"line":260,"column":4},"end":{"line":263,"column":66}}]}},"s":{"0":1,"1":83,"2":9,"3":74,"4":8,"5":66,"6":83,"7":6,"8":6,"9":6,"10":5,"11":1,"12":77,"13":12,"14":3,"15":9,"16":65,"17":83,"18":3,"19":80,"20":5,"21":4,"22":75,"23":9,"24":66,"25":83,"26":40,"27":35,"28":53,"29":2,"30":33,"31":5,"32":38,"33":38,"34":38,"35":81,"36":81,"37":81,"38":163,"39":16,"40":147,"41":163,"42":81,"43":61,"44":1,"45":60,"46":6,"47":54,"48":51,"49":51,"50":6,"51":1,"52":1,"53":5,"54":9,"55":9,"56":1,"57":1,"58":8,"59":54,"60":54,"61":54,"62":54,"63":2,"64":52,"65":84,"66":52,"67":2,"68":50,"69":83,"70":50,"71":83,"72":50,"73":3,"74":8,"75":3,"76":8,"77":3,"78":47,"79":75,"80":14,"81":14,"82":14,"83":14,"84":27,"85":27,"86":44,"87":27,"88":14,"89":14,"90":27,"91":2,"92":25,"93":14,"94":5,"95":1,"96":2,"97":1,"98":4,"99":4,"100":4,"101":11,"102":2,"103":4,"104":6,"105":4,"106":4,"107":4,"108":2,"109":1,"110":2,"111":7,"112":7,"113":1,"114":6,"115":6,"116":6,"117":20,"118":13,"119":7,"120":7,"121":1,"122":6,"123":1,"124":5,"125":8,"126":6,"127":2,"128":1,"129":2,"130":1,"131":1,"132":1,"133":2,"134":1,"135":1,"136":1},"f":{"0":83,"1":6,"2":4,"3":40,"4":53,"5":81,"6":61,"7":50,"8":6,"9":9,"10":54,"11":84,"12":83,"13":83,"14":8,"15":8,"16":14,"17":44,"18":5,"19":2,"20":6,"21":4,"22":1,"23":1,"24":2,"25":7,"26":7,"27":6,"28":20,"29":8,"30":1,"31":2,"32":1,"33":2,"34":1},"b":{"0":[9,74],"1":[8,66],"2":[5,3],"3":[6,77],"4":[4,2],"5":[5,1],"6":[12,65],"7":[3,9],"8":[3,80],"9":[5,75],"10":[80,6,6],"11":[9,66],"12":[75,10],"13":[35,5],"14":[2,51],"15":[53,10],"16":[8,73],"17":[16,147],"18":[1,60],"19":[6,54],"20":[1,5],"21":[1,8],"22":[54,1],"23":[2,52],"24":[52,51],"25":[2,50],"26":[3,47],"27":[2,25],"28":[2,25],"29":[1,4],"30":[2,9],"31":[6,2],"32":[2,2],"33":[1,6],"34":[13,7],"35":[20,20],"36":[1,6],"37":[1,5],"38":[6,2],"39":[1,1]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"282f396d86b4ddf3260c5649e50f82f413b96cdf"},"/Users/joshchisholm/projects/value-object.js/src/validation.js":{"path":"/Users/joshchisholm/projects/value-object.js/src/validation.js","statementMap":{"0":{"start":{"line":5,"column":4},"end":{"line":5,"column":22}},"1":{"start":{"line":9,"column":4},"end":{"line":9,"column":60}},"2":{"start":{"line":13,"column":4},"end":{"line":13,"column":89}},"3":{"start":{"line":14,"column":4},"end":{"line":14,"column":15}},"4":{"start":{"line":18,"column":4},"end":{"line":18,"column":35}},"5":{"start":{"line":22,"column":4},"end":{"line":22,"column":60}},"6":{"start":{"line":26,"column":4},"end":{"line":26,"column":61}},"7":{"start":{"line":26,"column":31},"end":{"line":26,"column":49}},"8":{"start":{"line":32,"column":4},"end":{"line":32,"column":28}},"9":{"start":{"line":33,"column":4},"end":{"line":33,"column":28}},"10":{"start":{"line":37,"column":4},"end":{"line":37,"column":66}},"11":{"start":{"line":38,"column":4},"end":{"line":38,"column":15}},"12":{"start":{"line":44,"column":4},"end":{"line":44,"column":26}},"13":{"start":{"line":48,"column":4},"end":{"line":48,"column":23}},"14":{"start":{"line":54,"column":4},"end":{"line":54,"column":28}},"15":{"start":{"line":55,"column":4},"end":{"line":55,"column":26}},"16":{"start":{"line":59,"column":4},"end":{"line":59,"column":45}},"17":{"start":{"line":63,"column":0},"end":{"line":65,"column":1}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":4,"column":2},"end":{"line":4,"column":3}},"loc":{"start":{"line":4,"column":16},"end":{"line":6,"column":3}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":8,"column":2},"end":{"line":8,"column":3}},"loc":{"start":{"line":8,"column":16},"end":{"line":10,"column":3}}},"2":{"name":"(anonymous_2)","decl":{"start":{"line":12,"column":2},"end":{"line":12,"column":3}},"loc":{"start":{"line":12,"column":15},"end":{"line":15,"column":3}}},"3":{"name":"(anonymous_3)","decl":{"start":{"line":17,"column":2},"end":{"line":17,"column":3}},"loc":{"start":{"line":17,"column":8},"end":{"line":19,"column":3}}},"4":{"name":"(anonymous_4)","decl":{"start":{"line":21,"column":2},"end":{"line":21,"column":3}},"loc":{"start":{"line":21,"column":8},"end":{"line":23,"column":3}}},"5":{"name":"(anonymous_5)","decl":{"start":{"line":25,"column":2},"end":{"line":25,"column":3}},"loc":{"start":{"line":25,"column":13},"end":{"line":27,"column":3}}},"6":{"name":"(anonymous_6)","decl":{"start":{"line":26,"column":20},"end":{"line":26,"column":21}},"loc":{"start":{"line":26,"column":31},"end":{"line":26,"column":49}}},"7":{"name":"(anonymous_7)","decl":{"start":{"line":31,"column":2},"end":{"line":31,"column":3}},"loc":{"start":{"line":31,"column":34},"end":{"line":34,"column":3}}},"8":{"name":"(anonymous_8)","decl":{"start":{"line":36,"column":2},"end":{"line":36,"column":3}},"loc":{"start":{"line":36,"column":15},"end":{"line":39,"column":3}}},"9":{"name":"(anonymous_9)","decl":{"start":{"line":43,"column":2},"end":{"line":43,"column":3}},"loc":{"start":{"line":43,"column":23},"end":{"line":45,"column":3}}},"10":{"name":"(anonymous_10)","decl":{"start":{"line":47,"column":2},"end":{"line":47,"column":3}},"loc":{"start":{"line":47,"column":13},"end":{"line":49,"column":3}}},"11":{"name":"(anonymous_11)","decl":{"start":{"line":53,"column":2},"end":{"line":53,"column":3}},"loc":{"start":{"line":53,"column":33},"end":{"line":56,"column":3}}},"12":{"name":"(anonymous_12)","decl":{"start":{"line":58,"column":2},"end":{"line":58,"column":3}},"loc":{"start":{"line":58,"column":13},"end":{"line":60,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":13,"column":23},"end":{"line":13,"column":88}},"type":"cond-expr","locations":[{"start":{"line":13,"column":52},"end":{"line":13,"column":59}},{"start":{"line":13,"column":62},"end":{"line":13,"column":88}}]}},"s":{"0":4,"1":2,"2":4,"3":4,"4":4,"5":2,"6":1,"7":2,"8":2,"9":2,"10":2,"11":2,"12":2,"13":1,"14":2,"15":2,"16":1,"17":1},"f":{"0":4,"1":2,"2":4,"3":4,"4":2,"5":1,"6":2,"7":2,"8":2,"9":2,"10":1,"11":2,"12":1},"b":{"0":[2,2]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"ffbb5d501cbb598110be9e2398a8086637cf074d"}} |
'use strict'; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
@@ -18,2 +18,53 @@ | ||
function checkType(propertyName, value, typeDefinition) { | ||
var expected = void 0; | ||
if (typeof typeDefinition === 'function') { | ||
expected = 'instanceof ' + typeDefinition.name; | ||
} else if (Array.isArray(typeDefinition)) { | ||
expected = '[' + (typeof typeDefinition[0] === 'function' ? 'instanceof ' + typeDefinition[0].name : typeDefinition[0]) + ']'; | ||
} else { | ||
expected = typeDefinition; | ||
} | ||
var actual = void 0; | ||
if (Array.isArray(value)) { | ||
var typesOfElements = Array.from(new Set(value.map(function (v) { | ||
return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' ? 'instanceof ' + v.constructor.name : typeof v === 'undefined' ? 'undefined' : _typeof(v); | ||
}))); | ||
if (typesOfElements.length === 1) { | ||
actual = '[' + typesOfElements[0] + ']'; | ||
} else { | ||
actual = 'array of multiple types'; | ||
} | ||
} else if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') { | ||
if (value === null) { | ||
actual = null; | ||
} else { | ||
actual = 'instanceof ' + value.constructor.name; | ||
} | ||
} else { | ||
actual = typeof value === 'undefined' ? 'undefined' : _typeof(value); | ||
} | ||
var valid = void 0; | ||
if (value === null) { | ||
valid = true; | ||
} else if (Array.isArray(value) && Array.isArray(typeDefinition) && typeof typeDefinition[0] === 'function') { | ||
valid = value.every(function (v) { | ||
return v instanceof typeDefinition[0]; | ||
}); | ||
} else if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && typeof typeDefinition === 'function') { | ||
valid = value instanceof typeDefinition; | ||
} else { | ||
valid = expected === actual; | ||
} | ||
return { | ||
valid: valid, | ||
actual: actual, | ||
expected: expected, | ||
propertyName: propertyName | ||
}; | ||
} | ||
var ValueObject = function () { | ||
@@ -23,3 +74,13 @@ _createClass(ValueObject, null, [{ | ||
value: function define(properties) { | ||
var props = (typeof properties === 'undefined' ? 'undefined' : _typeof(properties)) == 'object' ? properties : [].slice.apply(arguments); | ||
var props = void 0; | ||
if ((typeof properties === 'undefined' ? 'undefined' : _typeof(properties)) === 'object') { | ||
Object.values(properties).forEach(function (typeDefinition) { | ||
if (Array.isArray(typeDefinition) && typeDefinition.length != 1) { | ||
throw new TypeError('Expected an array to contain a single type element.'); | ||
} | ||
}); | ||
props = properties; | ||
} else { | ||
props = [].slice.apply(arguments); | ||
} | ||
var klass = function (_ValueObject) { | ||
@@ -111,6 +172,20 @@ _inherits(MyValueObject, _ValueObject); | ||
// Check that the property values are compatible | ||
var compatibleTypes = true; | ||
var expectedTypeDescriptions = {}; | ||
var argumentTypeDescriptions = {}; | ||
var typeCheckResults = actualPropertyNames.map(function (propertyName) { | ||
return checkType(propertyName, propertyValues[propertyName], properties[propertyName]); | ||
}); | ||
var typeErrors = typeCheckResults.filter(function (tc) { | ||
return !tc.valid; | ||
}); | ||
if (typeErrors.length > 0) { | ||
var expected = typeCheckResults.map(function (tc) { | ||
return tc.propertyName + ':' + tc.expected; | ||
}).join(', '); | ||
var actual = typeCheckResults.map(function (tc) { | ||
return tc.propertyName + ':' + tc.actual; | ||
}).join(', '); | ||
throw new TypeError(this.constructor.name + '({' + expected + '}) called with wrong types {' + actual + '}'); | ||
} | ||
var _iteratorNormalCompletion = true; | ||
@@ -121,8 +196,10 @@ var _didIteratorError = false; | ||
try { | ||
for (var _iterator = expectedPropertyNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
for (var _iterator = Object.keys(properties)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var propertyName = _step.value; | ||
// Build error message for expected type | ||
var expectedType = properties[propertyName]; | ||
expectedTypeDescriptions[propertyName] = typeof expectedType == 'function' ? 'instanceof ' + expectedType.name : expectedType; | ||
Object.defineProperty(this, propertyName, { | ||
value: propertyValues[propertyName], | ||
enumerable: true, | ||
writable: false | ||
}); | ||
} | ||
@@ -143,86 +220,2 @@ } catch (err) { | ||
} | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
try { | ||
for (var _iterator2 = actualPropertyNames[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var _propertyName = _step2.value; | ||
// Build error message for argument type | ||
var _expectedType = properties[_propertyName]; | ||
var argument = propertyValues[_propertyName]; | ||
var argumentTypeName = typeof argument === 'undefined' ? 'undefined' : _typeof(argument); | ||
if (argument === undefined) { | ||
var descriptions = Object.keys(expectedTypeDescriptions).map(function (propertyName) { | ||
return propertyName + ':' + expectedTypeDescriptions[propertyName]; | ||
}).join(', '); | ||
var message = this.constructor.name + ' { ' + descriptions + ' } called with { ' + _propertyName + ': undefined }'; | ||
throw new TypeError(message); | ||
} else if (argument === null) { | ||
argumentTypeDescriptions[_propertyName] = null; | ||
} else { | ||
argumentTypeDescriptions[_propertyName] = argumentTypeName == 'object' ? 'object ' + argument.constructor.name : argumentTypeName; | ||
if (typeof _expectedType == 'function') { | ||
if (!(argument instanceof _expectedType)) compatibleTypes = false; | ||
} else if (_expectedType !== argumentTypeName) { | ||
compatibleTypes = false; | ||
} | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
if (!compatibleTypes) { | ||
var expected = Object.keys(expectedTypeDescriptions).map(function (propertyName) { | ||
return propertyName + ':' + expectedTypeDescriptions[propertyName]; | ||
}).join(', '); | ||
var actual = Object.keys(argumentTypeDescriptions).map(function (propertyName) { | ||
return propertyName + ':' + argumentTypeDescriptions[propertyName]; | ||
}).join(', '); | ||
throw new TypeError(this.constructor.name + '(' + expected + ') called with wrong types (' + actual + ')'); | ||
} | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
try { | ||
for (var _iterator3 = Object.keys(properties)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var _propertyName2 = _step3.value; | ||
Object.defineProperty(this, _propertyName2, { | ||
value: propertyValues[_propertyName2], | ||
enumerable: true, | ||
writable: false | ||
}); | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
} | ||
} | ||
@@ -245,9 +238,9 @@ }, { | ||
var propertyNames = Object.keys(properties); | ||
var _iteratorNormalCompletion4 = true; | ||
var _didIteratorError4 = false; | ||
var _iteratorError4 = undefined; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
try { | ||
for (var _iterator4 = propertyNames[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { | ||
var propertyName = _step4.value; | ||
for (var _iterator2 = propertyNames[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var propertyName = _step2.value; | ||
@@ -261,12 +254,12 @@ if (this[propertyName] instanceof Date) { | ||
} catch (err) { | ||
_didIteratorError4 = true; | ||
_iteratorError4 = err; | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion4 && _iterator4.return) { | ||
_iterator4.return(); | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError4) { | ||
throw _iteratorError4; | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
@@ -343,4 +336,4 @@ } | ||
if (!constructor) throw new Error('Unable to deserialize an object with type "' + value.__type__ + '". Make sure you register that constructor when building deserialize.'); | ||
if (typeof constructor.fromJSON !== 'function') throw new Error('Unable to deserialize an object with type "' + value.__type__ + '". Deserializable types must have a static fromJSON method.'); | ||
if (!constructor) throw new Error('Unable to deserialize an object with type "' + value.__type__ + '".' + " Make sure you register that constructor when building deserialize."); | ||
if (typeof constructor.fromJSON !== 'function') throw new Error('Unable to deserialize an object with type "' + value.__type__ + '".' + " Deserializable types must have a static fromJSON method."); | ||
@@ -347,0 +340,0 @@ return constructor.fromJSON(value); |
{ | ||
"name": "value-object", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "value-object.js - simple value objects", | ||
@@ -31,8 +31,8 @@ "main": "dist/valueObject.js", | ||
"devDependencies": { | ||
"babel-cli": "^6.23.0", | ||
"babel-preset-es2015": "^6.22.0", | ||
"eslint": "^3.15.0", | ||
"eslint-config-eslint": "^3.0.0", | ||
"babel-cli": "^6.24.1", | ||
"babel-preset-es2015": "^6.24.1", | ||
"eslint": "^3.19.0", | ||
"eslint-config-eslint": "^4.0.0", | ||
"istanbul": "1.0.0-alpha.2", | ||
"mocha": "^3.2.0" | ||
"mocha": "^3.4.2" | ||
}, | ||
@@ -39,0 +39,0 @@ "files": [ |
@@ -46,3 +46,3 @@ # value-object.js | ||
new Currency({ code: 'USD', name: 123 }) | ||
// => TypeError: Currency(code:string, name:string) called with wrong types (code:string, name:number) | ||
// => TypeError: Currency({code:string, name:string}) called with wrong types {code:string, name:number} | ||
@@ -52,3 +52,3 @@ new Currency({ code: 'NZD', name: 'New Zealand Dollars', colour: 'All black' }) | ||
> new Money({ amount: 123 }) | ||
new Money({ amount: 123 }) | ||
// => TypeError: Money({currency, amount}) called with {amount} | ||
@@ -67,4 +67,27 @@ ``` | ||
// => false | ||
const gbpPrice = new Money({ amount: 123, currency: gbp }) | ||
const eurPrice = new Money({ amount: 123, currency: eur }) | ||
gbpPrice.isEqualTo(eurPrice) | ||
// => false | ||
eurPrice.isEqualTo(new Money({ amount: 123, currency: eur })) | ||
// => true | ||
``` | ||
## Array values | ||
To specify array values wrap the type definition (e.g. `'number'`, `Date`) in `[]` | ||
```js | ||
class Point extends ValueObject.define({ | ||
x: 'number', | ||
y: 'number' | ||
}) {} | ||
class Polygon extends ValueObject.define({ | ||
vertices: [Point] // instances of Point | ||
}) {} | ||
``` | ||
## Creating new value objects from existing value objects | ||
@@ -103,3 +126,3 @@ | ||
Value objects cannot be updated. Use [strict mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode): | ||
Value objects cannot be updated. Use [strict mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode) | ||
to throw errors when attempts to set property values are made. | ||
@@ -106,0 +129,0 @@ |
@@ -5,5 +5,62 @@ 'use strict' | ||
function checkType(propertyName, value, typeDefinition) { | ||
let expected | ||
if (typeof typeDefinition === 'function') { | ||
expected = `instanceof ${typeDefinition.name}` | ||
} else if (Array.isArray(typeDefinition)) { | ||
expected = `[${typeof typeDefinition[0] === 'function' ? 'instanceof '+typeDefinition[0].name : typeDefinition[0]}]` | ||
} else { | ||
expected = typeDefinition | ||
} | ||
let actual | ||
if (Array.isArray(value)) { | ||
const typesOfElements = Array.from(new Set(value.map(v => typeof v === 'object' ? 'instanceof '+v.constructor.name : typeof v))) | ||
if (typesOfElements.length === 1) { | ||
actual = `[${typesOfElements[0]}]` | ||
} else { | ||
actual = `array of multiple types` | ||
} | ||
} else if (typeof value === 'object') { | ||
if (value === null) { | ||
actual = null | ||
} else { | ||
actual = `instanceof ${value.constructor.name}` | ||
} | ||
} else { | ||
actual = typeof value | ||
} | ||
let valid | ||
if (value === null) { | ||
valid = true | ||
} else if (Array.isArray(value) && Array.isArray(typeDefinition) && typeof typeDefinition[0] === 'function') { | ||
valid = value.every(v => v instanceof typeDefinition[0]) | ||
} else if (typeof value === 'object' && typeof typeDefinition === 'function') { | ||
valid = value instanceof typeDefinition | ||
} else { | ||
valid = expected === actual | ||
} | ||
return { | ||
valid, | ||
actual, | ||
expected, | ||
propertyName | ||
} | ||
} | ||
class ValueObject { | ||
static define(properties) { | ||
const props = typeof properties == 'object' ? properties : [].slice.apply(arguments) | ||
let props | ||
if (typeof properties === 'object') { | ||
Object.values(properties).forEach(typeDefinition => { | ||
if (Array.isArray(typeDefinition) && typeDefinition.length != 1) { | ||
throw new TypeError('Expected an array to contain a single type element.') | ||
} | ||
}) | ||
props = properties | ||
} else { | ||
props = [].slice.apply(arguments) | ||
} | ||
const klass = class MyValueObject extends ValueObject {} | ||
@@ -75,41 +132,14 @@ klass.properties = props | ||
// Check that the property values are compatible | ||
let compatibleTypes = true | ||
const expectedTypeDescriptions = {} | ||
const argumentTypeDescriptions = {} | ||
for (const propertyName of expectedPropertyNames) { | ||
// Build error message for expected type | ||
const expectedType = properties[propertyName] | ||
expectedTypeDescriptions[propertyName] = typeof expectedType == 'function' ? 'instanceof ' + expectedType.name : expectedType | ||
} | ||
const typeCheckResults = actualPropertyNames.map(propertyName => { | ||
return checkType(propertyName, propertyValues[propertyName], properties[propertyName]) | ||
}) | ||
for (const propertyName of actualPropertyNames) { | ||
// Build error message for argument type | ||
const expectedType = properties[propertyName] | ||
const argument = propertyValues[propertyName] | ||
const argumentTypeName = typeof argument | ||
const typeErrors = typeCheckResults.filter(tc => !tc.valid) | ||
if (argument === undefined) { | ||
const descriptions = Object.keys(expectedTypeDescriptions).map(propertyName => `${propertyName}:${expectedTypeDescriptions[propertyName]}`).join(', ') | ||
const message = `${this.constructor.name} { ${descriptions} } called with { ${propertyName}: undefined }` | ||
throw new TypeError(message) | ||
} else if (argument === null) { | ||
argumentTypeDescriptions[propertyName] = null | ||
} else { | ||
argumentTypeDescriptions[propertyName] = argumentTypeName == 'object' ? 'object ' + argument.constructor.name : argumentTypeName | ||
if (typeof expectedType == 'function') { | ||
if (!(argument instanceof expectedType)) | ||
compatibleTypes = false | ||
} else if (expectedType !== argumentTypeName) { | ||
compatibleTypes = false | ||
} | ||
} | ||
if (typeErrors.length > 0) { | ||
const expected = typeCheckResults.map(tc => `${tc.propertyName}:${tc.expected}`).join(', ') | ||
const actual = typeCheckResults.map(tc => `${tc.propertyName}:${tc.actual}`).join(', ') | ||
throw new TypeError(`${this.constructor.name}({${expected}}) called with wrong types {${actual}}`) | ||
} | ||
if (!compatibleTypes) { | ||
const expected = Object.keys(expectedTypeDescriptions).map(propertyName => `${propertyName}:${expectedTypeDescriptions[propertyName]}`).join(', ') | ||
const actual = Object.keys(argumentTypeDescriptions).map(propertyName => `${propertyName}:${argumentTypeDescriptions[propertyName]}`).join(', ') | ||
throw new TypeError(`${this.constructor.name}(${expected}) called with wrong types (${actual})`) | ||
} | ||
for (const propertyName of Object.keys(properties)) { | ||
@@ -203,5 +233,7 @@ Object.defineProperty(this, propertyName, { | ||
if (!constructor) | ||
throw new Error(`Unable to deserialize an object with type "${value.__type__}". Make sure you register that constructor when building deserialize.`) | ||
throw new Error(`Unable to deserialize an object with type "${value.__type__}".` + | ||
" Make sure you register that constructor when building deserialize.") | ||
if (typeof constructor.fromJSON !== 'function') | ||
throw new Error(`Unable to deserialize an object with type "${value.__type__}". Deserializable types must have a static fromJSON method.`) | ||
throw new Error(`Unable to deserialize an object with type "${value.__type__}".` + | ||
" Deserializable types must have a static fromJSON method.") | ||
@@ -208,0 +240,0 @@ return constructor.fromJSON(value) |
@@ -69,4 +69,8 @@ /* eslint-env mocha */ | ||
it('is equal to another value object with the same property values', () => { | ||
class Foo extends ValueObject.define({ prop1: 'string' }) {} | ||
assert(new Foo({ prop1: 'dave' }).isEqualTo(new Foo({ prop1: 'dave' }))) | ||
class Thing extends ValueObject.define({ foo: 'number' }) {} | ||
class Code extends ValueObject.define({ name: 'string' }) {} | ||
class Foo extends ValueObject.define({ prop1: 'string', prop2: Thing, codes: [Code] }) {} | ||
const foo1 = new Foo({ prop1: 'dave', prop2: new Thing({ foo: 2 }), codes: [new Code({ name: 'red' })] }) | ||
const foo2 = new Foo({ prop1: 'dave', prop2: new Thing({ foo: 2 }), codes: [new Code({ name: 'red' })] }) | ||
assert(foo1.isEqualTo(foo2)) | ||
}) | ||
@@ -101,5 +105,5 @@ | ||
it('allows null arguments', () => { | ||
class Named extends ValueObject.define({ value: 'string' }) {} | ||
class Named extends ValueObject.define({ value: 'string', list: ['number'] }) {} | ||
const named = new Named({ value: null }) | ||
const named = new Named({ value: null, list: null }) | ||
assert.equal(named.value, null) | ||
@@ -129,7 +133,7 @@ }) | ||
it('does not allow undefined arguments', () => { | ||
class Named extends ValueObject.define({ ok: 'string', ko: 'string' }) {} | ||
class Named extends ValueObject.define({ ok: 'string', ko: ['string'] }) {} | ||
assertThrows( | ||
() => new Named({ ok: 'yep', ko: undefined }), | ||
'Named { ok:string, ko:string } called with { ko: undefined }' | ||
'Named({ok:string, ko:[string]}) called with wrong types {ok:string, ko:undefined}' | ||
) | ||
@@ -139,3 +143,3 @@ }) | ||
it('fails when instantiated with zero arguments', () => { | ||
class Named extends ValueObject.define({ b: 'string', a: 'string' }) {} | ||
class Named extends ValueObject.define({ b: 'string', a: ['string'] }) {} | ||
assertThrows( | ||
@@ -185,3 +189,3 @@ () => new Named(), | ||
() => new Named({ b, a }), | ||
'Named(a:string, b:string) called with wrong types (b:number, a:string)' | ||
'Named({b:string, a:string}) called with wrong types {b:number, a:string}' | ||
) | ||
@@ -204,4 +208,4 @@ }) | ||
() => new Named({ b, a, c, d }), | ||
'Named(a:string, b:instanceof Child, c:string, d:boolean) ' + | ||
'called with wrong types (b:object WrongChild, a:string, c:null, d:boolean)' | ||
'Named({b:instanceof Child, a:string, c:string, d:boolean}) ' + | ||
'called with wrong types {b:instanceof WrongChild, a:string, c:null, d:boolean}' | ||
) | ||
@@ -229,2 +233,49 @@ }) | ||
context('with array values', function() { | ||
it('can be instantiated with an array of primitives of certain type', () => { | ||
class NamedWithArray extends ValueObject.define({ codes: ['number'] }) {} | ||
const thing = new NamedWithArray({ codes: [2, 3] }) | ||
assert.deepEqual(thing.codes, [2, 3]) | ||
}) | ||
it('can be instantiated with an array of instances of a class', () => { | ||
class Child {} | ||
class NamedWithArray extends ValueObject.define({ children: [Child] }) {} | ||
const children = [new Child()] | ||
const thing = new NamedWithArray({ children }) | ||
assert.deepStrictEqual(thing.children, children) | ||
}) | ||
it('can be instantiated with an array of instances of a subclass of a class', function() { | ||
class Child {} | ||
class Grandchild extends Child {} | ||
class NamedWithArray extends ValueObject.define({ children: [Child] }) {} | ||
const children = [new Grandchild()] | ||
const thing = new NamedWithArray({ children }) | ||
assert.deepStrictEqual(thing.children, children) | ||
}) | ||
it('can be instantiated with an empty array', function() { | ||
class Child {} | ||
class NamedWithArray extends ValueObject.define({ children: [Child] }) {} | ||
const children = [] | ||
const thing = new NamedWithArray({ children }) | ||
assert.deepStrictEqual(thing.children, children) | ||
}) | ||
it('fails if defined with empty array', function() { | ||
assertThrows( | ||
() => class NamedWithEmptyArray extends ValueObject.define({ codes: [] }) {}, | ||
'Expected an array to contain a single type element.' | ||
) | ||
}) | ||
it('fails if definition array has more than one element', function() { | ||
assertThrows( | ||
() => class NamedWithEmptyArray extends ValueObject.define({ codes: ['string', Object] }) {}, | ||
'Expected an array to contain a single type element.' | ||
) | ||
}) | ||
}) | ||
it('can be serialized', () => { | ||
@@ -231,0 +282,0 @@ class Named extends ValueObject.define({ x: 'number', y: 'string' }) {} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1637
130
171007