@washingtonpost/red-react-lib
Advanced tools
Comparing version 2.0.7 to 2.0.8
{"/Users/rabolinil/Documents/WP/red-react-lib/packages/red-react-lib/src/index.js": {"path":"/Users/rabolinil/Documents/WP/red-react-lib/packages/red-react-lib/src/index.js","statementMap":{},"fnMap":{},"branchMap":{},"s":{},"f":{},"b":{},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"6ad992d2a497a71026a3830cf02ac4c2f79f633a"} | ||
,"/Users/rabolinil/Documents/WP/red-react-lib/packages/red-react-lib/src/hooks/index.js": {"path":"/Users/rabolinil/Documents/WP/red-react-lib/packages/red-react-lib/src/hooks/index.js","statementMap":{},"fnMap":{},"branchMap":{},"s":{},"f":{},"b":{},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"b7a07f219cf4f2dd585bf9890aed43245bbe3461"} | ||
,"/Users/rabolinil/Documents/WP/red-react-lib/packages/red-react-lib/src/hooks/usePrevious.js": {"path":"/Users/rabolinil/Documents/WP/red-react-lib/packages/red-react-lib/src/hooks/usePrevious.js","statementMap":{"0":{"start":{"line":18,"column":16},"end":{"line":18,"column":24}},"1":{"start":{"line":21,"column":4},"end":{"line":23,"column":15}},"2":{"start":{"line":22,"column":8},"end":{"line":22,"column":27}},"3":{"start":{"line":26,"column":4},"end":{"line":26,"column":22}}},"fnMap":{"0":{"name":"usePrevious","decl":{"start":{"line":15,"column":16},"end":{"line":15,"column":27}},"loc":{"start":{"line":15,"column":35},"end":{"line":27,"column":1}},"line":15},"1":{"name":"(anonymous_1)","decl":{"start":{"line":21,"column":14},"end":{"line":21,"column":15}},"loc":{"start":{"line":21,"column":20},"end":{"line":23,"column":5}},"line":21}},"branchMap":{},"s":{"0":2,"1":2,"2":1,"3":2},"f":{"0":2,"1":1},"b":{},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"85ac808b38197362af72d15826177012333cafb7"} | ||
,"/Users/rabolinil/Documents/WP/red-react-lib/packages/red-react-lib/src/hooks/usePromise.js": {"path":"/Users/rabolinil/Documents/WP/red-react-lib/packages/red-react-lib/src/hooks/usePromise.js","statementMap":{"0":{"start":{"line":22,"column":30},"end":{"line":22,"column":42}},"1":{"start":{"line":23,"column":23},"end":{"line":23,"column":32}},"2":{"start":{"line":24,"column":19},"end":{"line":24,"column":28}},"3":{"start":{"line":26,"column":21},"end":{"line":45,"column":12}},"4":{"start":{"line":29,"column":27},"end":{"line":29,"column":77}},"5":{"start":{"line":29,"column":37},"end":{"line":29,"column":76}},"6":{"start":{"line":32,"column":8},"end":{"line":37,"column":9}},"7":{"start":{"line":33,"column":12},"end":{"line":33,"column":44}},"8":{"start":{"line":34,"column":12},"end":{"line":34,"column":80}},"9":{"start":{"line":34,"column":50},"end":{"line":34,"column":70}},"10":{"start":{"line":36,"column":12},"end":{"line":36,"column":32}},"11":{"start":{"line":40,"column":30},"end":{"line":40,"column":46}},"12":{"start":{"line":41,"column":8},"end":{"line":44,"column":96}},"13":{"start":{"line":42,"column":28},"end":{"line":42,"column":84}},"14":{"start":{"line":43,"column":26},"end":{"line":43,"column":79}},"15":{"start":{"line":44,"column":27},"end":{"line":44,"column":95}},"16":{"start":{"line":48,"column":4},"end":{"line":54,"column":5}},"17":{"start":{"line":49,"column":14},"end":{"line":52,"column":9}},"18":{"start":{"line":50,"column":12},"end":{"line":50,"column":30}},"19":{"start":{"line":51,"column":12},"end":{"line":51,"column":44}},"20":{"start":{"line":57,"column":4},"end":{"line":60,"column":26}},"21":{"start":{"line":58,"column":8},"end":{"line":58,"column":24}},"22":{"start":{"line":59,"column":8},"end":{"line":59,"column":40}},"23":{"start":{"line":62,"column":4},"end":{"line":62,"column":61}},"24":{"start":{"line":82,"column":28},"end":{"line":82,"column":70}},"25":{"start":{"line":83,"column":27},"end":{"line":83,"column":42}},"26":{"start":{"line":85,"column":21},"end":{"line":85,"column":57}},"27":{"start":{"line":85,"column":39},"end":{"line":85,"column":50}},"28":{"start":{"line":87,"column":4},"end":{"line":89,"column":18}},"29":{"start":{"line":88,"column":8},"end":{"line":88,"column":18}},"30":{"start":{"line":91,"column":4},"end":{"line":91,"column":31}}},"fnMap":{"0":{"name":"usePromiseCallback","decl":{"start":{"line":21,"column":16},"end":{"line":21,"column":34}},"loc":{"start":{"line":21,"column":68},"end":{"line":63,"column":1}},"line":21},"1":{"name":"(anonymous_1)","decl":{"start":{"line":26,"column":33},"end":{"line":26,"column":34}},"loc":{"start":{"line":26,"column":48},"end":{"line":45,"column":5}},"line":26},"2":{"name":"(anonymous_2)","decl":{"start":{"line":29,"column":27},"end":{"line":29,"column":28}},"loc":{"start":{"line":29,"column":37},"end":{"line":29,"column":76}},"line":29},"3":{"name":"(anonymous_3)","decl":{"start":{"line":34,"column":44},"end":{"line":34,"column":45}},"loc":{"start":{"line":34,"column":50},"end":{"line":34,"column":70}},"line":34},"4":{"name":"(anonymous_4)","decl":{"start":{"line":42,"column":18},"end":{"line":42,"column":19}},"loc":{"start":{"line":42,"column":28},"end":{"line":42,"column":84}},"line":42},"5":{"name":"(anonymous_5)","decl":{"start":{"line":43,"column":19},"end":{"line":43,"column":20}},"loc":{"start":{"line":43,"column":26},"end":{"line":43,"column":79}},"line":43},"6":{"name":"(anonymous_6)","decl":{"start":{"line":44,"column":21},"end":{"line":44,"column":22}},"loc":{"start":{"line":44,"column":27},"end":{"line":44,"column":95}},"line":44},"7":{"name":"(anonymous_7)","decl":{"start":{"line":49,"column":8},"end":{"line":49,"column":9}},"loc":{"start":{"line":49,"column":14},"end":{"line":52,"column":9}},"line":49},"8":{"name":"(anonymous_8)","decl":{"start":{"line":49,"column":14},"end":{"line":49,"column":15}},"loc":{"start":{"line":49,"column":20},"end":{"line":52,"column":9}},"line":49},"9":{"name":"(anonymous_9)","decl":{"start":{"line":57,"column":14},"end":{"line":57,"column":15}},"loc":{"start":{"line":57,"column":20},"end":{"line":60,"column":5}},"line":57},"10":{"name":"usePromise","decl":{"start":{"line":81,"column":16},"end":{"line":81,"column":26}},"loc":{"start":{"line":81,"column":60},"end":{"line":92,"column":1}},"line":81},"11":{"name":"(anonymous_11)","decl":{"start":{"line":85,"column":33},"end":{"line":85,"column":34}},"loc":{"start":{"line":85,"column":39},"end":{"line":85,"column":50}},"line":85},"12":{"name":"(anonymous_12)","decl":{"start":{"line":87,"column":14},"end":{"line":87,"column":15}},"loc":{"start":{"line":87,"column":20},"end":{"line":89,"column":5}},"line":87}},"branchMap":{"0":{"loc":{"start":{"line":21,"column":44},"end":{"line":21,"column":53}},"type":"default-arg","locations":[{"start":{"line":21,"column":51},"end":{"line":21,"column":53}}],"line":21},"1":{"loc":{"start":{"line":21,"column":55},"end":{"line":21,"column":66}},"type":"default-arg","locations":[{"start":{"line":21,"column":65},"end":{"line":21,"column":66}}],"line":21},"2":{"loc":{"start":{"line":32,"column":8},"end":{"line":37,"column":9}},"type":"if","locations":[{"start":{"line":32,"column":8},"end":{"line":37,"column":9}},{"start":{"line":32,"column":8},"end":{"line":37,"column":9}}],"line":32},"3":{"loc":{"start":{"line":42,"column":28},"end":{"line":42,"column":84}},"type":"binary-expr","locations":[{"start":{"line":42,"column":28},"end":{"line":42,"column":60}},{"start":{"line":42,"column":64},"end":{"line":42,"column":84}}],"line":42},"4":{"loc":{"start":{"line":43,"column":26},"end":{"line":43,"column":79}},"type":"binary-expr","locations":[{"start":{"line":43,"column":26},"end":{"line":43,"column":58}},{"start":{"line":43,"column":62},"end":{"line":43,"column":79}}],"line":43},"5":{"loc":{"start":{"line":44,"column":27},"end":{"line":44,"column":95}},"type":"binary-expr","locations":[{"start":{"line":44,"column":27},"end":{"line":44,"column":59}},{"start":{"line":44,"column":63},"end":{"line":44,"column":95}}],"line":44},"6":{"loc":{"start":{"line":81,"column":36},"end":{"line":81,"column":45}},"type":"default-arg","locations":[{"start":{"line":81,"column":43},"end":{"line":81,"column":45}}],"line":81},"7":{"loc":{"start":{"line":81,"column":47},"end":{"line":81,"column":58}},"type":"default-arg","locations":[{"start":{"line":81,"column":57},"end":{"line":81,"column":58}}],"line":81}},"s":{"0":23,"1":23,"2":23,"3":23,"4":10,"5":7,"6":10,"7":7,"8":7,"9":4,"10":3,"11":10,"12":10,"13":9,"14":1,"15":10,"16":23,"17":7,"18":1,"19":1,"20":23,"21":8,"22":8,"23":23,"24":3,"25":3,"26":3,"27":1,"28":3,"29":1,"30":3},"f":{"0":23,"1":10,"2":7,"3":4,"4":9,"5":1,"6":10,"7":7,"8":1,"9":8,"10":3,"11":1,"12":1},"b":{"0":[16],"1":[6],"2":[7,3],"3":[9,7],"4":[1,1],"5":[10,8],"6":[3],"7":[3]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"7986d632150751de4578744c188098c623c08954"} | ||
,"/Users/rabolinil/Documents/WP/red-react-lib/packages/red-react-lib/src/hooks/usePromise.js": {"path":"/Users/rabolinil/Documents/WP/red-react-lib/packages/red-react-lib/src/hooks/usePromise.js","statementMap":{"0":{"start":{"line":22,"column":30},"end":{"line":22,"column":42}},"1":{"start":{"line":23,"column":23},"end":{"line":23,"column":32}},"2":{"start":{"line":24,"column":19},"end":{"line":24,"column":28}},"3":{"start":{"line":26,"column":21},"end":{"line":45,"column":12}},"4":{"start":{"line":29,"column":27},"end":{"line":29,"column":77}},"5":{"start":{"line":29,"column":37},"end":{"line":29,"column":76}},"6":{"start":{"line":32,"column":8},"end":{"line":37,"column":9}},"7":{"start":{"line":33,"column":12},"end":{"line":33,"column":44}},"8":{"start":{"line":34,"column":12},"end":{"line":34,"column":80}},"9":{"start":{"line":34,"column":50},"end":{"line":34,"column":70}},"10":{"start":{"line":36,"column":12},"end":{"line":36,"column":32}},"11":{"start":{"line":40,"column":30},"end":{"line":40,"column":46}},"12":{"start":{"line":41,"column":8},"end":{"line":44,"column":96}},"13":{"start":{"line":42,"column":28},"end":{"line":42,"column":84}},"14":{"start":{"line":43,"column":26},"end":{"line":43,"column":79}},"15":{"start":{"line":44,"column":27},"end":{"line":44,"column":95}},"16":{"start":{"line":48,"column":4},"end":{"line":54,"column":5}},"17":{"start":{"line":49,"column":14},"end":{"line":52,"column":9}},"18":{"start":{"line":50,"column":12},"end":{"line":50,"column":30}},"19":{"start":{"line":51,"column":12},"end":{"line":51,"column":44}},"20":{"start":{"line":57,"column":4},"end":{"line":61,"column":26}},"21":{"start":{"line":58,"column":8},"end":{"line":58,"column":24}},"22":{"start":{"line":59,"column":8},"end":{"line":59,"column":40}},"23":{"start":{"line":60,"column":8},"end":{"line":60,"column":46}},"24":{"start":{"line":60,"column":34},"end":{"line":60,"column":44}},"25":{"start":{"line":63,"column":4},"end":{"line":63,"column":61}},"26":{"start":{"line":83,"column":28},"end":{"line":83,"column":70}},"27":{"start":{"line":84,"column":27},"end":{"line":84,"column":42}},"28":{"start":{"line":86,"column":21},"end":{"line":86,"column":57}},"29":{"start":{"line":86,"column":39},"end":{"line":86,"column":50}},"30":{"start":{"line":88,"column":4},"end":{"line":90,"column":18}},"31":{"start":{"line":89,"column":8},"end":{"line":89,"column":18}},"32":{"start":{"line":92,"column":4},"end":{"line":92,"column":31}}},"fnMap":{"0":{"name":"usePromiseCallback","decl":{"start":{"line":21,"column":16},"end":{"line":21,"column":34}},"loc":{"start":{"line":21,"column":68},"end":{"line":64,"column":1}},"line":21},"1":{"name":"(anonymous_1)","decl":{"start":{"line":26,"column":33},"end":{"line":26,"column":34}},"loc":{"start":{"line":26,"column":48},"end":{"line":45,"column":5}},"line":26},"2":{"name":"(anonymous_2)","decl":{"start":{"line":29,"column":27},"end":{"line":29,"column":28}},"loc":{"start":{"line":29,"column":37},"end":{"line":29,"column":76}},"line":29},"3":{"name":"(anonymous_3)","decl":{"start":{"line":34,"column":44},"end":{"line":34,"column":45}},"loc":{"start":{"line":34,"column":50},"end":{"line":34,"column":70}},"line":34},"4":{"name":"(anonymous_4)","decl":{"start":{"line":42,"column":18},"end":{"line":42,"column":19}},"loc":{"start":{"line":42,"column":28},"end":{"line":42,"column":84}},"line":42},"5":{"name":"(anonymous_5)","decl":{"start":{"line":43,"column":19},"end":{"line":43,"column":20}},"loc":{"start":{"line":43,"column":26},"end":{"line":43,"column":79}},"line":43},"6":{"name":"(anonymous_6)","decl":{"start":{"line":44,"column":21},"end":{"line":44,"column":22}},"loc":{"start":{"line":44,"column":27},"end":{"line":44,"column":95}},"line":44},"7":{"name":"(anonymous_7)","decl":{"start":{"line":49,"column":8},"end":{"line":49,"column":9}},"loc":{"start":{"line":49,"column":14},"end":{"line":52,"column":9}},"line":49},"8":{"name":"(anonymous_8)","decl":{"start":{"line":49,"column":14},"end":{"line":49,"column":15}},"loc":{"start":{"line":49,"column":20},"end":{"line":52,"column":9}},"line":49},"9":{"name":"(anonymous_9)","decl":{"start":{"line":57,"column":14},"end":{"line":57,"column":15}},"loc":{"start":{"line":57,"column":20},"end":{"line":61,"column":5}},"line":57},"10":{"name":"(anonymous_10)","decl":{"start":{"line":60,"column":17},"end":{"line":60,"column":18}},"loc":{"start":{"line":60,"column":34},"end":{"line":60,"column":44}},"line":60},"11":{"name":"usePromise","decl":{"start":{"line":82,"column":16},"end":{"line":82,"column":26}},"loc":{"start":{"line":82,"column":60},"end":{"line":93,"column":1}},"line":82},"12":{"name":"(anonymous_12)","decl":{"start":{"line":86,"column":33},"end":{"line":86,"column":34}},"loc":{"start":{"line":86,"column":39},"end":{"line":86,"column":50}},"line":86},"13":{"name":"(anonymous_13)","decl":{"start":{"line":88,"column":14},"end":{"line":88,"column":15}},"loc":{"start":{"line":88,"column":20},"end":{"line":90,"column":5}},"line":88}},"branchMap":{"0":{"loc":{"start":{"line":21,"column":44},"end":{"line":21,"column":53}},"type":"default-arg","locations":[{"start":{"line":21,"column":51},"end":{"line":21,"column":53}}],"line":21},"1":{"loc":{"start":{"line":21,"column":55},"end":{"line":21,"column":66}},"type":"default-arg","locations":[{"start":{"line":21,"column":65},"end":{"line":21,"column":66}}],"line":21},"2":{"loc":{"start":{"line":32,"column":8},"end":{"line":37,"column":9}},"type":"if","locations":[{"start":{"line":32,"column":8},"end":{"line":37,"column":9}},{"start":{"line":32,"column":8},"end":{"line":37,"column":9}}],"line":32},"3":{"loc":{"start":{"line":42,"column":28},"end":{"line":42,"column":84}},"type":"binary-expr","locations":[{"start":{"line":42,"column":28},"end":{"line":42,"column":60}},{"start":{"line":42,"column":64},"end":{"line":42,"column":84}}],"line":42},"4":{"loc":{"start":{"line":43,"column":26},"end":{"line":43,"column":79}},"type":"binary-expr","locations":[{"start":{"line":43,"column":26},"end":{"line":43,"column":58}},{"start":{"line":43,"column":62},"end":{"line":43,"column":79}}],"line":43},"5":{"loc":{"start":{"line":44,"column":27},"end":{"line":44,"column":95}},"type":"binary-expr","locations":[{"start":{"line":44,"column":27},"end":{"line":44,"column":59}},{"start":{"line":44,"column":63},"end":{"line":44,"column":95}}],"line":44},"6":{"loc":{"start":{"line":82,"column":36},"end":{"line":82,"column":45}},"type":"default-arg","locations":[{"start":{"line":82,"column":43},"end":{"line":82,"column":45}}],"line":82},"7":{"loc":{"start":{"line":82,"column":47},"end":{"line":82,"column":58}},"type":"default-arg","locations":[{"start":{"line":82,"column":57},"end":{"line":82,"column":58}}],"line":82}},"s":{"0":37,"1":37,"2":37,"3":37,"4":12,"5":9,"6":12,"7":7,"8":7,"9":4,"10":5,"11":12,"12":12,"13":11,"14":1,"15":12,"16":37,"17":8,"18":1,"19":1,"20":37,"21":10,"22":10,"23":10,"24":10,"25":37,"26":3,"27":3,"28":3,"29":1,"30":3,"31":1,"32":3},"f":{"0":37,"1":12,"2":9,"3":4,"4":11,"5":1,"6":12,"7":8,"8":1,"9":10,"10":10,"11":3,"12":1,"13":1},"b":{"0":[24],"1":[15],"2":[7,5],"3":[11,8],"4":[1,1],"5":[12,9],"6":[3],"7":[3]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"ee69b4d76157f25cf714e07ea54a5917cc5452bd"} | ||
,"/Users/rabolinil/Documents/WP/red-react-lib/packages/red-react-lib/src/hooks/useRouter.js": {"path":"/Users/rabolinil/Documents/WP/red-react-lib/packages/red-react-lib/src/hooks/useRouter.js","statementMap":{"0":{"start":{"line":5,"column":23},"end":{"line":8,"column":1}},"1":{"start":{"line":11,"column":19},"end":{"line":11,"column":30}},"2":{"start":{"line":12,"column":21},"end":{"line":12,"column":34}},"3":{"start":{"line":13,"column":20},"end":{"line":13,"column":32}},"4":{"start":{"line":14,"column":18},"end":{"line":14,"column":33}},"5":{"start":{"line":18,"column":4},"end":{"line":39,"column":51}},"6":{"start":{"line":19,"column":22},"end":{"line":19,"column":56}},"7":{"start":{"line":20,"column":8},"end":{"line":38,"column":9}},"8":{"start":{"line":27,"column":44},"end":{"line":27,"column":51}},"9":{"start":{"line":28,"column":27},"end":{"line":28,"column":86}},"10":{"start":{"line":28,"column":67},"end":{"line":28,"column":85}},"11":{"start":{"line":29,"column":28},"end":{"line":29,"column":51}},"12":{"start":{"line":30,"column":16},"end":{"line":30,"column":42}}},"fnMap":{"0":{"name":"useRouter","decl":{"start":{"line":10,"column":16},"end":{"line":10,"column":25}},"loc":{"start":{"line":10,"column":52},"end":{"line":40,"column":1}},"line":10},"1":{"name":"(anonymous_1)","decl":{"start":{"line":18,"column":25},"end":{"line":18,"column":26}},"loc":{"start":{"line":18,"column":31},"end":{"line":39,"column":5}},"line":18},"2":{"name":"(anonymous_2)","decl":{"start":{"line":26,"column":22},"end":{"line":26,"column":23}},"loc":{"start":{"line":26,"column":43},"end":{"line":31,"column":13}},"line":26},"3":{"name":"(anonymous_3)","decl":{"start":{"line":28,"column":57},"end":{"line":28,"column":58}},"loc":{"start":{"line":28,"column":67},"end":{"line":28,"column":85}},"line":28}},"branchMap":{"0":{"loc":{"start":{"line":10,"column":26},"end":{"line":10,"column":50}},"type":"default-arg","locations":[{"start":{"line":10,"column":36},"end":{"line":10,"column":50}}],"line":10},"1":{"loc":{"start":{"line":26,"column":26},"end":{"line":26,"column":38}},"type":"default-arg","locations":[{"start":{"line":26,"column":36},"end":{"line":26,"column":38}}],"line":26},"2":{"loc":{"start":{"line":27,"column":24},"end":{"line":27,"column":39}},"type":"default-arg","locations":[{"start":{"line":27,"column":33},"end":{"line":27,"column":39}}],"line":27},"3":{"loc":{"start":{"line":28,"column":27},"end":{"line":28,"column":86}},"type":"cond-expr","locations":[{"start":{"line":28,"column":53},"end":{"line":28,"column":54}},{"start":{"line":28,"column":57},"end":{"line":28,"column":86}}],"line":28}},"s":{"0":2,"1":3,"2":3,"3":3,"4":3,"5":3,"6":3,"7":3,"8":2,"9":2,"10":1,"11":2,"12":2},"f":{"0":3,"1":3,"2":2,"3":1},"b":{"0":[3],"1":[2],"2":[2],"3":[1,1]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"810c4b7f867f6156382ea7cf472bb9d88e13cf1a"} | ||
,"/Users/rabolinil/Documents/WP/red-react-lib/packages/red-react-lib/src/hooks/useStorage.js": {"path":"/Users/rabolinil/Documents/WP/red-react-lib/packages/red-react-lib/src/hooks/useStorage.js","statementMap":{"0":{"start":{"line":5,"column":21},"end":{"line":16,"column":5}},"1":{"start":{"line":6,"column":8},"end":{"line":15,"column":9}},"2":{"start":{"line":8,"column":25},"end":{"line":8,"column":45}},"3":{"start":{"line":10,"column":12},"end":{"line":10,"column":57}},"4":{"start":{"line":13,"column":12},"end":{"line":13,"column":30}},"5":{"start":{"line":14,"column":12},"end":{"line":14,"column":31}},"6":{"start":{"line":19,"column":42},"end":{"line":19,"column":85}},"7":{"start":{"line":19,"column":57},"end":{"line":19,"column":84}},"8":{"start":{"line":21,"column":4},"end":{"line":24,"column":13}},"9":{"start":{"line":22,"column":20},"end":{"line":22,"column":47}},"10":{"start":{"line":23,"column":8},"end":{"line":23,"column":27}},"11":{"start":{"line":28,"column":21},"end":{"line":40,"column":5}},"12":{"start":{"line":29,"column":8},"end":{"line":39,"column":9}},"13":{"start":{"line":31,"column":33},"end":{"line":31,"column":87}},"14":{"start":{"line":33,"column":12},"end":{"line":33,"column":62}},"15":{"start":{"line":35,"column":12},"end":{"line":35,"column":40}},"16":{"start":{"line":38,"column":12},"end":{"line":38,"column":30}},"17":{"start":{"line":42,"column":4},"end":{"line":42,"column":34}}},"fnMap":{"0":{"name":"useStorage","decl":{"start":{"line":4,"column":16},"end":{"line":4,"column":26}},"loc":{"start":{"line":4,"column":77},"end":{"line":43,"column":1}},"line":4},"1":{"name":"(anonymous_1)","decl":{"start":{"line":5,"column":21},"end":{"line":5,"column":22}},"loc":{"start":{"line":5,"column":44},"end":{"line":16,"column":5}},"line":5},"2":{"name":"(anonymous_2)","decl":{"start":{"line":19,"column":51},"end":{"line":19,"column":52}},"loc":{"start":{"line":19,"column":57},"end":{"line":19,"column":84}},"line":19},"3":{"name":"(anonymous_3)","decl":{"start":{"line":21,"column":14},"end":{"line":21,"column":15}},"loc":{"start":{"line":21,"column":20},"end":{"line":24,"column":5}},"line":21},"4":{"name":"(anonymous_4)","decl":{"start":{"line":28,"column":21},"end":{"line":28,"column":22}},"loc":{"start":{"line":28,"column":30},"end":{"line":40,"column":5}},"line":28}},"branchMap":{"0":{"loc":{"start":{"line":4,"column":46},"end":{"line":4,"column":75}},"type":"default-arg","locations":[{"start":{"line":4,"column":56},"end":{"line":4,"column":75}}],"line":4},"1":{"loc":{"start":{"line":10,"column":19},"end":{"line":10,"column":57}},"type":"cond-expr","locations":[{"start":{"line":10,"column":26},"end":{"line":10,"column":42}},{"start":{"line":10,"column":45},"end":{"line":10,"column":57}}],"line":10},"2":{"loc":{"start":{"line":31,"column":33},"end":{"line":31,"column":87}},"type":"cond-expr","locations":[{"start":{"line":31,"column":61},"end":{"line":31,"column":79}},{"start":{"line":31,"column":82},"end":{"line":31,"column":87}}],"line":31}},"s":{"0":9,"1":6,"2":6,"3":5,"4":1,"5":1,"6":9,"7":2,"8":9,"9":4,"10":4,"11":9,"12":2,"13":2,"14":2,"15":1,"16":1,"17":9},"f":{"0":9,"1":6,"2":2,"3":4,"4":2},"b":{"0":[5],"1":[4,1],"2":[1,1]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"c20e02c68cd66f1e521ad04864e9c55dcc25df0b"} | ||
} |
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),React__default=_interopDefault(React),reactRouterDom=require("react-router-dom"),qs=_interopDefault(require("qs"));function usePrevious(e){var r=React.useRef();return React.useEffect(function(){r.current=e},[e]),r.current}function _defineProperty(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _objectSpread(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(e){_defineProperty(r,e,t[e])})}return r}function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_nonIterableRest()}function _toArray(e){return _arrayWithHoles(e)||_iterableToArray(e)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e)){for(var r=0,t=new Array(e.length);r<e.length;r++)t[r]=e[r];return t}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function _iterableToArrayLimit(e,r){var t=[],n=!0,o=!1,u=void 0;try{for(var a,c=e[Symbol.iterator]();!(n=(a=c.next()).done)&&(t.push(a.value),!r||t.length!==r);n=!0);}catch(e){o=!0,u=e}finally{try{n||null==c.return||c.return()}finally{if(o)throw u}}return t}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function usePromiseCallback(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=_slicedToArray(React.useState({}),2),o=r[0],u=r[1],a=React.useRef(0),c=React.useRef(0),i=React.useCallback(function(){function e(e){return{result:e.result,loading:!0}}n?(clearTimeout(a.current),a.current=setTimeout(function(){return u(e)},n)):u(e);var r=++c.current;return t.apply(void 0,arguments).then(function(e){return r===c.current&&u({result:e})}).catch(function(e){return r===c.current&&u({err:e})}).finally(function(){return r===c.current&&clearTimeout(a.current)})},e);return React.useEffect(function(){return function(){c.current=0,clearTimeout(a.current)}},[]),React.useEffect(function(){c.current++,clearTimeout(a.current)},[].concat(_toConsumableArray(e),[n])),[i,o.result,o.loading,o.err]}function usePromise(e){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],t=_toArray(usePromiseCallback(e,r,2<arguments.length&&void 0!==arguments[2]?arguments[2]:0)),n=t[0],o=t.slice(1),u=React.useCallback(function(){return n.apply(void 0,_toConsumableArray(r))},[n]);return React.useEffect(function(){u()},[u]),[u].concat(_toConsumableArray(o))}function useStorage(t,r){function n(e,r){try{var t=o.getItem(e);return t?JSON.parse(t):r}catch(e){return console.log(e),r}}var o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:window.localStorage,e=_slicedToArray(React.useState(function(){return n(t,r)}),2),u=e[0],a=e[1];React.useEffect(function(){var e=n(t,r);a(e)},[t]);return[u,function(e){try{var r=e instanceof Function?e(u):e;o.setItem(t,JSON.stringify(r)),a(r)}catch(e){console.log(e)}}]}var defaultOptions={ignoreQueryPrefix:!0,interpretNumericEntities:!0};function useRouter(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:defaultOptions,r=reactRouterDom.useParams(),t=reactRouterDom.useLocation(),c=reactRouterDom.useHistory(),n=reactRouterDom.useRouteMatch();return React__default.useMemo(function(){var a=qs.parse(t.search,e);return{push:c.push,replace:c.replace,pathname:t.pathname,query:a,setQuery:function(r,e){var t=(1<arguments.length&&void 0!==e?e:{}).method,n=void 0===t?"push":t,o="function"==typeof r?r:function(e){return _objectSpread({},e,r)},u=qs.stringify(o(a));c[n]("?".concat(u))},params:r,match:n,location:t,history:c}},[r,n,t,c,e])}var index=Object.freeze({usePrevious:usePrevious,usePromise:usePromise,usePromiseCallback:usePromiseCallback,useStorage:useStorage,useRouter:useRouter});exports.hooks=index; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),React__default=_interopDefault(React),reactRouterDom=require("react-router-dom"),qs=_interopDefault(require("qs"));function usePrevious(e){var r=React.useRef();return React.useEffect(function(){r.current=e},[e]),r.current}function _defineProperty(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _objectSpread(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(e){_defineProperty(r,e,t[e])})}return r}function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_nonIterableRest()}function _toArray(e){return _arrayWithHoles(e)||_iterableToArray(e)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e)){for(var r=0,t=new Array(e.length);r<e.length;r++)t[r]=e[r];return t}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function _iterableToArrayLimit(e,r){var t=[],n=!0,o=!1,u=void 0;try{for(var a,c=e[Symbol.iterator]();!(n=(a=c.next()).done)&&(t.push(a.value),!r||t.length!==r);n=!0);}catch(e){o=!0,u=e}finally{try{n||null==c.return||c.return()}finally{if(o)throw u}}return t}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function usePromiseCallback(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=_slicedToArray(React.useState({}),2),o=r[0],u=r[1],a=React.useRef(0),c=React.useRef(0),i=React.useCallback(function(){function e(e){return{result:e.result,loading:!0}}n?(clearTimeout(a.current),a.current=setTimeout(function(){return u(e)},n)):u(e);var r=++c.current;return t.apply(void 0,arguments).then(function(e){return r===c.current&&u({result:e})}).catch(function(e){return r===c.current&&u({err:e})}).finally(function(){return r===c.current&&clearTimeout(a.current)})},e);return React.useEffect(function(){return function(){c.current=0,clearTimeout(a.current)}},[]),React.useEffect(function(){c.current++,clearTimeout(a.current),u(function(e){return{result:e.result}})},[].concat(_toConsumableArray(e),[n])),[i,o.result,o.loading,o.err]}function usePromise(e){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],t=_toArray(usePromiseCallback(e,r,2<arguments.length&&void 0!==arguments[2]?arguments[2]:0)),n=t[0],o=t.slice(1),u=React.useCallback(function(){return n.apply(void 0,_toConsumableArray(r))},[n]);return React.useEffect(function(){u()},[u]),[u].concat(_toConsumableArray(o))}function useStorage(t,r){function n(e,r){try{var t=o.getItem(e);return t?JSON.parse(t):r}catch(e){return console.log(e),r}}var o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:window.localStorage,e=_slicedToArray(React.useState(function(){return n(t,r)}),2),u=e[0],a=e[1];React.useEffect(function(){var e=n(t,r);a(e)},[t]);return[u,function(e){try{var r=e instanceof Function?e(u):e;o.setItem(t,JSON.stringify(r)),a(r)}catch(e){console.log(e)}}]}var defaultOptions={ignoreQueryPrefix:!0,interpretNumericEntities:!0};function useRouter(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:defaultOptions,r=reactRouterDom.useParams(),t=reactRouterDom.useLocation(),c=reactRouterDom.useHistory(),n=reactRouterDom.useRouteMatch();return React__default.useMemo(function(){var a=qs.parse(t.search,e);return{push:c.push,replace:c.replace,pathname:t.pathname,query:a,setQuery:function(r,e){var t=(1<arguments.length&&void 0!==e?e:{}).method,n=void 0===t?"push":t,o="function"==typeof r?r:function(e){return _objectSpread({},e,r)},u=qs.stringify(o(a));c[n]("?".concat(u))},params:r,match:n,location:t,history:c}},[r,n,t,c,e])}var index=Object.freeze({usePrevious:usePrevious,usePromise:usePromise,usePromiseCallback:usePromiseCallback,useStorage:useStorage,useRouter:useRouter});exports.hooks=index; |
@@ -98,3 +98,4 @@ { | ||
}, | ||
"version": "2.0.7" | ||
"version": "2.0.8", | ||
"gitHead": "2c0b5e851b77298582711934b6735a56d46735f8" | ||
} |
@@ -71,2 +71,52 @@ /* eslint-disable max-lines */ | ||
test("<TestUsePromiseCallbackComponent/> doesn't stall in loading state", async done => { | ||
const promise = jest.fn( | ||
() => | ||
new Promise(resolve => { | ||
setTimeout(() => resolve("it works"), 1000) | ||
}) | ||
) | ||
act(() => { | ||
ReactDOM.render(<TestUsePromiseCallbackComponent promise={promise} />, container) | ||
}) | ||
await wait(100) | ||
expect(promise).not.toHaveBeenCalled() | ||
expect(container.textContent).toBe(`{}`) | ||
const button = container.querySelector("button") | ||
act(() => { | ||
button.dispatchEvent(new MouseEvent("click", { bubbles: true })) | ||
}) | ||
await wait(100) | ||
expect(promise).toHaveBeenCalled() | ||
expect(container.textContent).toBe(`{"loading":true}`) | ||
act(() => { | ||
ReactDOM.render( | ||
<TestUsePromiseCallbackComponent promise={promise} deps={["hello"]} />, | ||
container | ||
) | ||
}) | ||
await wait() | ||
expect(container.textContent).toBe(`{}`) | ||
await wait(2000) | ||
expect(container.textContent).toBe(`{}`) | ||
act(() => { | ||
button.dispatchEvent(new MouseEvent("click", { bubbles: true })) | ||
}) | ||
await wait(100) | ||
expect(container.textContent).toBe(`{"loading":true}`) | ||
await wait(2000) | ||
expect(container.textContent).toBe('{"result":"it works"}') | ||
done() | ||
}) | ||
test("<TestUsePromiseCallbackComponent/> renders correctly on error", async done => { | ||
@@ -73,0 +123,0 @@ const promise = jest.fn(() => Promise.reject("this is an error")) |
@@ -60,2 +60,3 @@ import { useState, useCallback, useEffect, useRef } from "react" | ||
clearTimeout(timeoutRef.current) | ||
setState(({ result }) => ({ result })) | ||
}, [...deps, delayMS]) | ||
@@ -62,0 +63,0 @@ |
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
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
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
272039
1114