react-router-breadcrumbs-hoc
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -1,2 +0,2 @@ | ||
{"/Users/justin/Documents/opensource/react-router-breadcrumbs-hoc/src/index.js": {"path":"/Users/justin/Documents/opensource/react-router-breadcrumbs-hoc/src/index.js","statementMap":{"0":{"start":{"line":5,"column":30},"end":{"line":5,"column":45}},"1":{"start":{"line":6,"column":22},"end":{"line":6,"column":37}},"2":{"start":{"line":9,"column":15},"end":{"line":15,"column":1}},"3":{"start":{"line":10,"column":25},"end":{"line":10,"column":61}},"4":{"start":{"line":11,"column":2},"end":{"line":13,"column":3}},"5":{"start":{"line":12,"column":4},"end":{"line":12,"column":53}},"6":{"start":{"line":14,"column":2},"end":{"line":14,"column":59}},"7":{"start":{"line":19,"column":29},"end":{"line":27,"column":1}},"8":{"start":{"line":20,"column":16},"end":{"line":20,"column":87}},"9":{"start":{"line":22,"column":2},"end":{"line":26,"column":5}},"10":{"start":{"line":31,"column":22},"end":{"line":84,"column":1}},"11":{"start":{"line":42,"column":2},"end":{"line":44,"column":3}},"12":{"start":{"line":43,"column":4},"end":{"line":43,"column":25}},"13":{"start":{"line":47,"column":2},"end":{"line":74,"column":5}},"14":{"start":{"line":48,"column":4},"end":{"line":50,"column":5}},"15":{"start":{"line":49,"column":6},"end":{"line":49,"column":88}},"16":{"start":{"line":52,"column":18},"end":{"line":52,"column":94}},"17":{"start":{"line":57,"column":4},"end":{"line":60,"column":5}},"18":{"start":{"line":58,"column":6},"end":{"line":58,"column":33}},"19":{"start":{"line":59,"column":6},"end":{"line":59,"column":18}},"20":{"start":{"line":62,"column":4},"end":{"line":72,"column":5}},"21":{"start":{"line":63,"column":6},"end":{"line":70,"column":9}},"22":{"start":{"line":71,"column":6},"end":{"line":71,"column":18}},"23":{"start":{"line":73,"column":4},"end":{"line":73,"column":17}},"24":{"start":{"line":77,"column":2},"end":{"line":83,"column":7}},"25":{"start":{"line":86,"column":30},"end":{"line":121,"column":1}},"26":{"start":{"line":87,"column":18},"end":{"line":87,"column":20}},"27":{"start":{"line":88,"column":23},"end":{"line":88,"column":31}},"28":{"start":{"line":90,"column":2},"end":{"line":118,"column":13}},"29":{"start":{"line":101,"column":26},"end":{"line":101,"column":88}},"30":{"start":{"line":103,"column":25},"end":{"line":109,"column":8}},"31":{"start":{"line":113,"column":6},"end":{"line":115,"column":7}},"32":{"start":{"line":114,"column":8},"end":{"line":114,"column":33}},"33":{"start":{"line":117,"column":6},"end":{"line":117,"column":52}},"34":{"start":{"line":120,"column":2},"end":{"line":120,"column":17}},"35":{"start":{"line":125,"column":22},"end":{"line":130,"column":6}},"36":{"start":{"line":125,"column":32},"end":{"line":130,"column":6}},"37":{"start":{"line":126,"column":2},"end":{"line":128,"column":3}},"38":{"start":{"line":127,"column":4},"end":{"line":127,"column":63}},"39":{"start":{"line":129,"column":2},"end":{"line":129,"column":27}},"40":{"start":{"line":132,"column":24},"end":{"line":140,"column":5}},"41":{"start":{"line":132,"column":50},"end":{"line":140,"column":5}},"42":{"start":{"line":132,"column":63},"end":{"line":140,"column":5}},"43":{"start":{"line":133,"column":2},"end":{"line":140,"column":4}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":9,"column":15},"end":{"line":9,"column":16}},"loc":{"start":{"line":9,"column":52},"end":{"line":15,"column":1}},"line":9},"1":{"name":"(anonymous_1)","decl":{"start":{"line":19,"column":29},"end":{"line":19,"column":30}},"loc":{"start":{"line":19,"column":76},"end":{"line":27,"column":1}},"line":19},"2":{"name":"(anonymous_2)","decl":{"start":{"line":31,"column":22},"end":{"line":31,"column":23}},"loc":{"start":{"line":37,"column":6},"end":{"line":84,"column":1}},"line":37},"3":{"name":"(anonymous_3)","decl":{"start":{"line":47,"column":14},"end":{"line":47,"column":15}},"loc":{"start":{"line":47,"column":78},"end":{"line":74,"column":3}},"line":47},"4":{"name":"(anonymous_4)","decl":{"start":{"line":86,"column":30},"end":{"line":86,"column":31}},"loc":{"start":{"line":86,"column":70},"end":{"line":121,"column":1}},"line":86},"5":{"name":"(anonymous_5)","decl":{"start":{"line":97,"column":12},"end":{"line":97,"column":13}},"loc":{"start":{"line":97,"column":49},"end":{"line":118,"column":5}},"line":97},"6":{"name":"(anonymous_6)","decl":{"start":{"line":125,"column":22},"end":{"line":125,"column":23}},"loc":{"start":{"line":125,"column":32},"end":{"line":130,"column":6}},"line":125},"7":{"name":"(anonymous_7)","decl":{"start":{"line":125,"column":46},"end":{"line":125,"column":47}},"loc":{"start":{"line":125,"column":62},"end":{"line":130,"column":1}},"line":125},"8":{"name":"(anonymous_8)","decl":{"start":{"line":132,"column":24},"end":{"line":132,"column":25}},"loc":{"start":{"line":132,"column":50},"end":{"line":140,"column":5}},"line":132},"9":{"name":"(anonymous_9)","decl":{"start":{"line":132,"column":50},"end":{"line":132,"column":51}},"loc":{"start":{"line":132,"column":63},"end":{"line":140,"column":5}},"line":132},"10":{"name":"(anonymous_10)","decl":{"start":{"line":132,"column":74},"end":{"line":132,"column":75}},"loc":{"start":{"line":133,"column":2},"end":{"line":140,"column":4}},"line":133}},"branchMap":{"0":{"loc":{"start":{"line":11,"column":2},"end":{"line":13,"column":3}},"type":"if","locations":[{"start":{"line":11,"column":2},"end":{"line":13,"column":3}},{"start":{"line":11,"column":2},"end":{"line":13,"column":3}}],"line":11},"1":{"loc":{"start":{"line":42,"column":2},"end":{"line":44,"column":3}},"type":"if","locations":[{"start":{"line":42,"column":2},"end":{"line":44,"column":3}},{"start":{"line":42,"column":2},"end":{"line":44,"column":3}}],"line":42},"2":{"loc":{"start":{"line":42,"column":6},"end":{"line":42,"column":56}},"type":"binary-expr","locations":[{"start":{"line":42,"column":6},"end":{"line":42,"column":18}},{"start":{"line":42,"column":22},"end":{"line":42,"column":56}}],"line":42},"3":{"loc":{"start":{"line":48,"column":4},"end":{"line":50,"column":5}},"type":"if","locations":[{"start":{"line":48,"column":4},"end":{"line":50,"column":5}},{"start":{"line":48,"column":4},"end":{"line":50,"column":5}}],"line":48},"4":{"loc":{"start":{"line":52,"column":47},"end":{"line":52,"column":84}},"type":"binary-expr","locations":[{"start":{"line":52,"column":47},"end":{"line":52,"column":59}},{"start":{"line":52,"column":63},"end":{"line":52,"column":84}}],"line":52},"5":{"loc":{"start":{"line":57,"column":4},"end":{"line":60,"column":5}},"type":"if","locations":[{"start":{"line":57,"column":4},"end":{"line":60,"column":5}},{"start":{"line":57,"column":4},"end":{"line":60,"column":5}}],"line":57},"6":{"loc":{"start":{"line":57,"column":8},"end":{"line":57,"column":78}},"type":"binary-expr","locations":[{"start":{"line":57,"column":9},"end":{"line":57,"column":14}},{"start":{"line":57,"column":18},"end":{"line":57,"column":49}},{"start":{"line":57,"column":55},"end":{"line":57,"column":61}},{"start":{"line":57,"column":65},"end":{"line":57,"column":77}}],"line":57},"7":{"loc":{"start":{"line":62,"column":4},"end":{"line":72,"column":5}},"type":"if","locations":[{"start":{"line":62,"column":4},"end":{"line":72,"column":5}},{"start":{"line":62,"column":4},"end":{"line":72,"column":5}}],"line":62},"8":{"loc":{"start":{"line":67,"column":20},"end":{"line":67,"column":76}},"type":"binary-expr","locations":[{"start":{"line":67,"column":20},"end":{"line":67,"column":42}},{"start":{"line":67,"column":46},"end":{"line":67,"column":76}}],"line":67},"9":{"loc":{"start":{"line":77,"column":9},"end":{"line":83,"column":6}},"type":"binary-expr","locations":[{"start":{"line":77,"column":9},"end":{"line":77,"column":19}},{"start":{"line":78,"column":7},"end":{"line":83,"column":6}}],"line":77},"10":{"loc":{"start":{"line":81,"column":22},"end":{"line":81,"column":67}},"type":"cond-expr","locations":[{"start":{"line":81,"column":44},"end":{"line":81,"column":50}},{"start":{"line":81,"column":53},"end":{"line":81,"column":67}}],"line":81},"11":{"loc":{"start":{"line":86,"column":51},"end":{"line":86,"column":63}},"type":"default-arg","locations":[{"start":{"line":86,"column":61},"end":{"line":86,"column":63}}],"line":86},"12":{"loc":{"start":{"line":101,"column":26},"end":{"line":101,"column":88}},"type":"cond-expr","locations":[{"start":{"line":101,"column":44},"end":{"line":101,"column":47}},{"start":{"line":101,"column":50},"end":{"line":101,"column":88}}],"line":101},"13":{"loc":{"start":{"line":113,"column":6},"end":{"line":115,"column":7}},"type":"if","locations":[{"start":{"line":113,"column":6},"end":{"line":115,"column":7}},{"start":{"line":113,"column":6},"end":{"line":115,"column":7}}],"line":113},"14":{"loc":{"start":{"line":117,"column":13},"end":{"line":117,"column":51}},"type":"cond-expr","locations":[{"start":{"line":117,"column":35},"end":{"line":117,"column":37}},{"start":{"line":117,"column":40},"end":{"line":117,"column":51}}],"line":117},"15":{"loc":{"start":{"line":126,"column":2},"end":{"line":128,"column":3}},"type":"if","locations":[{"start":{"line":126,"column":2},"end":{"line":128,"column":3}},{"start":{"line":126,"column":2},"end":{"line":128,"column":3}}],"line":126},"16":{"loc":{"start":{"line":132,"column":25},"end":{"line":132,"column":36}},"type":"default-arg","locations":[{"start":{"line":132,"column":34},"end":{"line":132,"column":36}}],"line":132}},"s":{"0":1,"1":1,"2":1,"3":35,"4":35,"5":4,"6":31,"7":1,"8":21,"9":21,"10":1,"11":42,"12":2,"13":40,"14":53,"15":1,"16":52,"17":52,"18":4,"19":4,"20":48,"21":14,"22":14,"23":34,"24":39,"25":1,"26":15,"27":15,"28":15,"29":42,"30":42,"31":41,"32":35,"33":41,"34":14,"35":1,"36":16,"37":20,"38":2,"39":18,"40":1,"41":14,"42":14,"43":14},"f":{"0":35,"1":21,"2":42,"3":53,"4":15,"5":42,"6":16,"7":20,"8":14,"9":14,"10":14},"b":{"0":[4,31],"1":[2,40],"2":[42,3],"3":[1,52],"4":[52,50],"5":[4,48],"6":[52,16,50,36],"7":[14,34],"8":[14,2],"9":[39,21],"10":[10,11],"11":[14],"12":[15,27],"13":[35,6],"14":[14,27],"15":[2,18],"16":[4]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"bdf4825412c399833df0c42d6d99bdde05dde2bb"} | ||
{"/Users/justin/Documents/opensource/react-router-breadcrumbs-hoc/src/index.js": {"path":"/Users/justin/Documents/opensource/react-router-breadcrumbs-hoc/src/index.js","statementMap":{"0":{"start":{"line":5,"column":30},"end":{"line":5,"column":45}},"1":{"start":{"line":6,"column":22},"end":{"line":6,"column":37}},"2":{"start":{"line":9,"column":15},"end":{"line":15,"column":1}},"3":{"start":{"line":10,"column":25},"end":{"line":10,"column":61}},"4":{"start":{"line":11,"column":2},"end":{"line":13,"column":3}},"5":{"start":{"line":12,"column":4},"end":{"line":12,"column":53}},"6":{"start":{"line":14,"column":2},"end":{"line":14,"column":59}},"7":{"start":{"line":19,"column":29},"end":{"line":27,"column":1}},"8":{"start":{"line":20,"column":16},"end":{"line":20,"column":87}},"9":{"start":{"line":22,"column":2},"end":{"line":26,"column":5}},"10":{"start":{"line":31,"column":22},"end":{"line":100,"column":1}},"11":{"start":{"line":43,"column":2},"end":{"line":45,"column":3}},"12":{"start":{"line":44,"column":4},"end":{"line":44,"column":25}},"13":{"start":{"line":48,"column":2},"end":{"line":83,"column":5}},"14":{"start":{"line":49,"column":4},"end":{"line":51,"column":5}},"15":{"start":{"line":50,"column":6},"end":{"line":50,"column":88}},"16":{"start":{"line":53,"column":18},"end":{"line":53,"column":94}},"17":{"start":{"line":58,"column":4},"end":{"line":61,"column":5}},"18":{"start":{"line":59,"column":6},"end":{"line":59,"column":33}},"19":{"start":{"line":60,"column":6},"end":{"line":60,"column":18}},"20":{"start":{"line":63,"column":4},"end":{"line":81,"column":5}},"21":{"start":{"line":67,"column":6},"end":{"line":70,"column":7}},"22":{"start":{"line":68,"column":8},"end":{"line":68,"column":35}},"23":{"start":{"line":69,"column":8},"end":{"line":69,"column":20}},"24":{"start":{"line":72,"column":6},"end":{"line":79,"column":9}},"25":{"start":{"line":80,"column":6},"end":{"line":80,"column":18}},"26":{"start":{"line":82,"column":4},"end":{"line":82,"column":17}},"27":{"start":{"line":85,"column":2},"end":{"line":91,"column":3}},"28":{"start":{"line":87,"column":4},"end":{"line":87,"column":22}},"29":{"start":{"line":88,"column":9},"end":{"line":91,"column":3}},"30":{"start":{"line":90,"column":4},"end":{"line":90,"column":25}},"31":{"start":{"line":94,"column":2},"end":{"line":99,"column":5}},"32":{"start":{"line":102,"column":30},"end":{"line":137,"column":1}},"33":{"start":{"line":103,"column":18},"end":{"line":103,"column":20}},"34":{"start":{"line":104,"column":23},"end":{"line":104,"column":31}},"35":{"start":{"line":106,"column":2},"end":{"line":134,"column":13}},"36":{"start":{"line":117,"column":26},"end":{"line":117,"column":88}},"37":{"start":{"line":119,"column":25},"end":{"line":125,"column":8}},"38":{"start":{"line":129,"column":6},"end":{"line":131,"column":7}},"39":{"start":{"line":130,"column":8},"end":{"line":130,"column":33}},"40":{"start":{"line":133,"column":6},"end":{"line":133,"column":52}},"41":{"start":{"line":136,"column":2},"end":{"line":136,"column":17}},"42":{"start":{"line":141,"column":22},"end":{"line":146,"column":6}},"43":{"start":{"line":141,"column":32},"end":{"line":146,"column":6}},"44":{"start":{"line":142,"column":2},"end":{"line":144,"column":3}},"45":{"start":{"line":143,"column":4},"end":{"line":143,"column":63}},"46":{"start":{"line":145,"column":2},"end":{"line":145,"column":27}},"47":{"start":{"line":148,"column":24},"end":{"line":156,"column":5}},"48":{"start":{"line":148,"column":50},"end":{"line":156,"column":5}},"49":{"start":{"line":148,"column":63},"end":{"line":156,"column":5}},"50":{"start":{"line":149,"column":2},"end":{"line":156,"column":4}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":9,"column":15},"end":{"line":9,"column":16}},"loc":{"start":{"line":9,"column":52},"end":{"line":15,"column":1}},"line":9},"1":{"name":"(anonymous_1)","decl":{"start":{"line":19,"column":29},"end":{"line":19,"column":30}},"loc":{"start":{"line":19,"column":76},"end":{"line":27,"column":1}},"line":19},"2":{"name":"(anonymous_2)","decl":{"start":{"line":31,"column":22},"end":{"line":31,"column":23}},"loc":{"start":{"line":38,"column":6},"end":{"line":100,"column":1}},"line":38},"3":{"name":"(anonymous_3)","decl":{"start":{"line":48,"column":14},"end":{"line":48,"column":15}},"loc":{"start":{"line":48,"column":78},"end":{"line":83,"column":3}},"line":48},"4":{"name":"(anonymous_4)","decl":{"start":{"line":102,"column":30},"end":{"line":102,"column":31}},"loc":{"start":{"line":102,"column":70},"end":{"line":137,"column":1}},"line":102},"5":{"name":"(anonymous_5)","decl":{"start":{"line":113,"column":12},"end":{"line":113,"column":13}},"loc":{"start":{"line":113,"column":49},"end":{"line":134,"column":5}},"line":113},"6":{"name":"(anonymous_6)","decl":{"start":{"line":141,"column":22},"end":{"line":141,"column":23}},"loc":{"start":{"line":141,"column":32},"end":{"line":146,"column":6}},"line":141},"7":{"name":"(anonymous_7)","decl":{"start":{"line":141,"column":46},"end":{"line":141,"column":47}},"loc":{"start":{"line":141,"column":62},"end":{"line":146,"column":1}},"line":141},"8":{"name":"(anonymous_8)","decl":{"start":{"line":148,"column":24},"end":{"line":148,"column":25}},"loc":{"start":{"line":148,"column":50},"end":{"line":156,"column":5}},"line":148},"9":{"name":"(anonymous_9)","decl":{"start":{"line":148,"column":50},"end":{"line":148,"column":51}},"loc":{"start":{"line":148,"column":63},"end":{"line":156,"column":5}},"line":148},"10":{"name":"(anonymous_10)","decl":{"start":{"line":148,"column":74},"end":{"line":148,"column":75}},"loc":{"start":{"line":149,"column":2},"end":{"line":156,"column":4}},"line":149}},"branchMap":{"0":{"loc":{"start":{"line":11,"column":2},"end":{"line":13,"column":3}},"type":"if","locations":[{"start":{"line":11,"column":2},"end":{"line":13,"column":3}},{"start":{"line":11,"column":2},"end":{"line":13,"column":3}}],"line":11},"1":{"loc":{"start":{"line":43,"column":2},"end":{"line":45,"column":3}},"type":"if","locations":[{"start":{"line":43,"column":2},"end":{"line":45,"column":3}},{"start":{"line":43,"column":2},"end":{"line":45,"column":3}}],"line":43},"2":{"loc":{"start":{"line":43,"column":6},"end":{"line":43,"column":56}},"type":"binary-expr","locations":[{"start":{"line":43,"column":6},"end":{"line":43,"column":18}},{"start":{"line":43,"column":22},"end":{"line":43,"column":56}}],"line":43},"3":{"loc":{"start":{"line":49,"column":4},"end":{"line":51,"column":5}},"type":"if","locations":[{"start":{"line":49,"column":4},"end":{"line":51,"column":5}},{"start":{"line":49,"column":4},"end":{"line":51,"column":5}}],"line":49},"4":{"loc":{"start":{"line":53,"column":47},"end":{"line":53,"column":84}},"type":"binary-expr","locations":[{"start":{"line":53,"column":47},"end":{"line":53,"column":59}},{"start":{"line":53,"column":63},"end":{"line":53,"column":84}}],"line":53},"5":{"loc":{"start":{"line":58,"column":4},"end":{"line":61,"column":5}},"type":"if","locations":[{"start":{"line":58,"column":4},"end":{"line":61,"column":5}},{"start":{"line":58,"column":4},"end":{"line":61,"column":5}}],"line":58},"6":{"loc":{"start":{"line":58,"column":8},"end":{"line":58,"column":78}},"type":"binary-expr","locations":[{"start":{"line":58,"column":9},"end":{"line":58,"column":14}},{"start":{"line":58,"column":18},"end":{"line":58,"column":49}},{"start":{"line":58,"column":55},"end":{"line":58,"column":61}},{"start":{"line":58,"column":65},"end":{"line":58,"column":77}}],"line":58},"7":{"loc":{"start":{"line":63,"column":4},"end":{"line":81,"column":5}},"type":"if","locations":[{"start":{"line":63,"column":4},"end":{"line":81,"column":5}},{"start":{"line":63,"column":4},"end":{"line":81,"column":5}}],"line":63},"8":{"loc":{"start":{"line":67,"column":6},"end":{"line":70,"column":7}},"type":"if","locations":[{"start":{"line":67,"column":6},"end":{"line":70,"column":7}},{"start":{"line":67,"column":6},"end":{"line":70,"column":7}}],"line":67},"9":{"loc":{"start":{"line":67,"column":10},"end":{"line":67,"column":52}},"type":"binary-expr","locations":[{"start":{"line":67,"column":10},"end":{"line":67,"column":33}},{"start":{"line":67,"column":37},"end":{"line":67,"column":52}}],"line":67},"10":{"loc":{"start":{"line":76,"column":20},"end":{"line":76,"column":76}},"type":"binary-expr","locations":[{"start":{"line":76,"column":20},"end":{"line":76,"column":42}},{"start":{"line":76,"column":46},"end":{"line":76,"column":76}}],"line":76},"11":{"loc":{"start":{"line":85,"column":2},"end":{"line":91,"column":3}},"type":"if","locations":[{"start":{"line":85,"column":2},"end":{"line":91,"column":3}},{"start":{"line":85,"column":2},"end":{"line":91,"column":3}}],"line":85},"12":{"loc":{"start":{"line":88,"column":9},"end":{"line":91,"column":3}},"type":"if","locations":[{"start":{"line":88,"column":9},"end":{"line":91,"column":3}},{"start":{"line":88,"column":9},"end":{"line":91,"column":3}}],"line":88},"13":{"loc":{"start":{"line":97,"column":20},"end":{"line":97,"column":65}},"type":"cond-expr","locations":[{"start":{"line":97,"column":42},"end":{"line":97,"column":48}},{"start":{"line":97,"column":51},"end":{"line":97,"column":65}}],"line":97},"14":{"loc":{"start":{"line":102,"column":51},"end":{"line":102,"column":63}},"type":"default-arg","locations":[{"start":{"line":102,"column":61},"end":{"line":102,"column":63}}],"line":102},"15":{"loc":{"start":{"line":117,"column":26},"end":{"line":117,"column":88}},"type":"cond-expr","locations":[{"start":{"line":117,"column":44},"end":{"line":117,"column":47}},{"start":{"line":117,"column":50},"end":{"line":117,"column":88}}],"line":117},"16":{"loc":{"start":{"line":129,"column":6},"end":{"line":131,"column":7}},"type":"if","locations":[{"start":{"line":129,"column":6},"end":{"line":131,"column":7}},{"start":{"line":129,"column":6},"end":{"line":131,"column":7}}],"line":129},"17":{"loc":{"start":{"line":133,"column":13},"end":{"line":133,"column":51}},"type":"cond-expr","locations":[{"start":{"line":133,"column":35},"end":{"line":133,"column":37}},{"start":{"line":133,"column":40},"end":{"line":133,"column":51}}],"line":133},"18":{"loc":{"start":{"line":142,"column":2},"end":{"line":144,"column":3}},"type":"if","locations":[{"start":{"line":142,"column":2},"end":{"line":144,"column":3}},{"start":{"line":142,"column":2},"end":{"line":144,"column":3}}],"line":142},"19":{"loc":{"start":{"line":148,"column":25},"end":{"line":148,"column":36}},"type":"default-arg","locations":[{"start":{"line":148,"column":34},"end":{"line":148,"column":36}}],"line":148}},"s":{"0":1,"1":1,"2":1,"3":36,"4":36,"5":4,"6":32,"7":1,"8":21,"9":21,"10":1,"11":45,"12":2,"13":43,"14":58,"15":1,"16":57,"17":57,"18":4,"19":4,"20":53,"21":16,"22":1,"23":1,"24":15,"25":15,"26":37,"27":42,"28":20,"29":22,"30":1,"31":21,"32":1,"33":16,"34":16,"35":16,"36":45,"37":45,"38":44,"39":36,"40":44,"41":15,"42":1,"43":17,"44":22,"45":2,"46":20,"47":1,"48":15,"49":15,"50":15},"f":{"0":36,"1":21,"2":45,"3":58,"4":16,"5":45,"6":17,"7":22,"8":15,"9":15,"10":15},"b":{"0":[4,32],"1":[2,43],"2":[45,3],"3":[1,57],"4":[57,55],"5":[4,53],"6":[57,18,55,39],"7":[16,37],"8":[1,15],"9":[16,3],"10":[15,2],"11":[20,22],"12":[1,21],"13":[10,11],"14":[14],"15":[16,29],"16":[36,8],"17":[15,29],"18":[2,20],"19":[4]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"0e455c7a3bec4e02434b36e69dc6837464eed850"} | ||
} |
@@ -89,2 +89,3 @@ import { createElement } from 'react'; | ||
var currentSection = _ref3.currentSection, | ||
disableDefaults = _ref3.disableDefaults, | ||
excludePaths = _ref3.excludePaths, | ||
@@ -124,2 +125,10 @@ location = _ref3.location, | ||
if (match) { | ||
// this covers the case where a user may be extending their react-router route | ||
// config with breadcrumbs, but also does not want default breadcrumbs to be | ||
// automatically generated (opt-in) | ||
if (!userProvidedBreadcrumb && disableDefaults) { | ||
breadcrumb = NO_BREADCRUMB; | ||
return true; | ||
} | ||
breadcrumb = render({ | ||
@@ -138,4 +147,12 @@ // although we have a match, the user may be passing their react-router config object | ||
// if there are no breadcrumbs provided in the routes array we return a default breadcrumb instead | ||
return breadcrumb || getDefaultBreadcrumb({ | ||
if (breadcrumb) { | ||
// user provided a breadcrumb prop, or we generated one via humanizeString above ~L75 | ||
return breadcrumb; | ||
} else if (disableDefaults) { | ||
// if there was no breadcrumb provided and user has disableDefaults turned on | ||
return NO_BREADCRUMB; | ||
} | ||
// if the above conditionals don't fire, generate a default breadcrumb based on the path | ||
return getDefaultBreadcrumb({ | ||
pathSection: pathSection, | ||
@@ -170,9 +187,8 @@ // include a "Home" breadcrumb by default (can be overrode or disabled in config) | ||
var breadcrumb = getBreadcrumb({ | ||
var breadcrumb = getBreadcrumb(_extends({ | ||
currentSection: currentSection, | ||
excludePaths: options.excludePaths, | ||
location: location, | ||
pathSection: pathSection, | ||
routes: routes | ||
}); | ||
}, options)); | ||
@@ -179,0 +195,0 @@ // add the breadcrumb to the matches array |
@@ -7,218 +7,234 @@ (function (global, factory) { | ||
var decamelize = function (str, sep) { | ||
if (typeof str !== 'string') { | ||
throw new TypeError('Expected a string'); | ||
} | ||
var decamelize = function (str, sep) { | ||
if (typeof str !== 'string') { | ||
throw new TypeError('Expected a string'); | ||
} | ||
sep = typeof sep === 'undefined' ? '_' : sep; | ||
sep = typeof sep === 'undefined' ? '_' : sep; | ||
return str | ||
.replace(/([a-z\d])([A-Z])/g, '$1' + sep + '$2') | ||
.replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + sep + '$2') | ||
.toLowerCase(); | ||
}; | ||
return str | ||
.replace(/([a-z\d])([A-Z])/g, '$1' + sep + '$2') | ||
.replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + sep + '$2') | ||
.toLowerCase(); | ||
}; | ||
var humanizeString = function (str) { | ||
if (typeof str !== 'string') { | ||
throw new TypeError('Expected a string'); | ||
} | ||
var humanizeString = function (str) { | ||
if (typeof str !== 'string') { | ||
throw new TypeError('Expected a string'); | ||
} | ||
str = decamelize(str); | ||
str = str.toLowerCase().replace(/[_-]+/g, ' ').replace(/\s{2,}/g, ' ').trim(); | ||
str = str.charAt(0).toUpperCase() + str.slice(1); | ||
str = decamelize(str); | ||
str = str.toLowerCase().replace(/[_-]+/g, ' ').replace(/\s{2,}/g, ' ').trim(); | ||
str = str.charAt(0).toUpperCase() + str.slice(1); | ||
return str; | ||
}; | ||
return str; | ||
}; | ||
var _extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
var _extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return target; | ||
}; | ||
var toConsumableArray = function (arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
var toConsumableArray = function (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); | ||
} | ||
}; | ||
return arr2; | ||
} else { | ||
return Array.from(arr); | ||
} | ||
}; | ||
var DEFAULT_MATCH_OPTIONS = { exact: true }; | ||
var NO_BREADCRUMB = 'NO_BREADCRUMB'; | ||
var DEFAULT_MATCH_OPTIONS = { exact: true }; | ||
var NO_BREADCRUMB = 'NO_BREADCRUMB'; | ||
// renders and returns the breadcrumb complete with `match`, `location`, and `key` props | ||
var render = function render(_ref) { | ||
var breadcrumb = _ref.breadcrumb, | ||
match = _ref.match, | ||
location = _ref.location; | ||
// renders and returns the breadcrumb complete with `match`, `location`, and `key` props | ||
var render = function render(_ref) { | ||
var breadcrumb = _ref.breadcrumb, | ||
match = _ref.match, | ||
location = _ref.location; | ||
var componentProps = { match: match, location: location, key: match.path }; | ||
if (typeof breadcrumb === 'function') { | ||
return react.createElement(breadcrumb, componentProps); | ||
} | ||
return react.createElement('span', componentProps, breadcrumb); | ||
}; | ||
var componentProps = { match: match, location: location, key: match.path }; | ||
if (typeof breadcrumb === 'function') { | ||
return react.createElement(breadcrumb, componentProps); | ||
} | ||
return react.createElement('span', componentProps, breadcrumb); | ||
}; | ||
// small helper method to get a default `humanize-string` breadcrumb if the | ||
// user hasn't provided one | ||
var getDefaultBreadcrumb = function getDefaultBreadcrumb(_ref2) { | ||
var pathSection = _ref2.pathSection, | ||
currentSection = _ref2.currentSection, | ||
location = _ref2.location; | ||
// small helper method to get a default `humanize-string` breadcrumb if the | ||
// user hasn't provided one | ||
var getDefaultBreadcrumb = function getDefaultBreadcrumb(_ref2) { | ||
var pathSection = _ref2.pathSection, | ||
currentSection = _ref2.currentSection, | ||
location = _ref2.location; | ||
var match = reactRouter.matchPath(pathSection, _extends({}, DEFAULT_MATCH_OPTIONS, { path: pathSection })); | ||
var match = reactRouter.matchPath(pathSection, _extends({}, DEFAULT_MATCH_OPTIONS, { path: pathSection })); | ||
return render({ | ||
breadcrumb: humanizeString(currentSection), | ||
match: match, | ||
location: location | ||
}); | ||
}; | ||
return render({ | ||
breadcrumb: humanizeString(currentSection), | ||
match: match, | ||
location: location | ||
}); | ||
}; | ||
// loops through the route array (if provided) and returns either | ||
// a user-provided breadcrumb OR a sensible default via `humanize-string` | ||
var getBreadcrumb = function getBreadcrumb(_ref3) { | ||
var currentSection = _ref3.currentSection, | ||
excludePaths = _ref3.excludePaths, | ||
location = _ref3.location, | ||
pathSection = _ref3.pathSection, | ||
routes = _ref3.routes; | ||
// loops through the route array (if provided) and returns either | ||
// a user-provided breadcrumb OR a sensible default via `humanize-string` | ||
var getBreadcrumb = function getBreadcrumb(_ref3) { | ||
var currentSection = _ref3.currentSection, | ||
disableDefaults = _ref3.disableDefaults, | ||
excludePaths = _ref3.excludePaths, | ||
location = _ref3.location, | ||
pathSection = _ref3.pathSection, | ||
routes = _ref3.routes; | ||
var breadcrumb = void 0; | ||
var breadcrumb = void 0; | ||
// check the optional `exludePaths` option in `options` to see if the | ||
// current path should not include a breadcrumb | ||
if (excludePaths && excludePaths.includes(pathSection)) { | ||
return NO_BREADCRUMB; | ||
} | ||
// check the optional `exludePaths` option in `options` to see if the | ||
// current path should not include a breadcrumb | ||
if (excludePaths && excludePaths.includes(pathSection)) { | ||
return NO_BREADCRUMB; | ||
} | ||
// loop through the route array and see if the user has provided a custom breadcrumb | ||
routes.some(function (_ref4) { | ||
var userProvidedBreadcrumb = _ref4.breadcrumb, | ||
matchOptions = _ref4.matchOptions, | ||
path = _ref4.path; | ||
// loop through the route array and see if the user has provided a custom breadcrumb | ||
routes.some(function (_ref4) { | ||
var userProvidedBreadcrumb = _ref4.breadcrumb, | ||
matchOptions = _ref4.matchOptions, | ||
path = _ref4.path; | ||
if (!path) { | ||
throw new Error('withBreadcrumbs: `path` must be provided in every route object'); | ||
} | ||
if (!path) { | ||
throw new Error('withBreadcrumbs: `path` must be provided in every route object'); | ||
} | ||
var match = reactRouter.matchPath(pathSection, _extends({}, matchOptions || DEFAULT_MATCH_OPTIONS, { path: path })); | ||
var match = reactRouter.matchPath(pathSection, _extends({}, matchOptions || DEFAULT_MATCH_OPTIONS, { path: path })); | ||
// if user passed breadcrumb: null OR custom match options to suppress a breadcrumb | ||
// we need to know NOT to add it to the matches array | ||
// see: `if (breadcrumb !== NO_BREADCRUMB)` below | ||
if (match && userProvidedBreadcrumb === null || !match && matchOptions) { | ||
breadcrumb = NO_BREADCRUMB; | ||
return true; | ||
} | ||
// if user passed breadcrumb: null OR custom match options to suppress a breadcrumb | ||
// we need to know NOT to add it to the matches array | ||
// see: `if (breadcrumb !== NO_BREADCRUMB)` below | ||
if (match && userProvidedBreadcrumb === null || !match && matchOptions) { | ||
breadcrumb = NO_BREADCRUMB; | ||
return true; | ||
} | ||
if (match) { | ||
breadcrumb = render({ | ||
// although we have a match, the user may be passing their react-router config object | ||
// which we support. The route config object may not have a `breadcrumb` param specified. | ||
// If this is the case, we should provide a default via `humanizeString` | ||
breadcrumb: userProvidedBreadcrumb || humanizeString(currentSection), | ||
match: match, | ||
location: location | ||
}); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
if (match) { | ||
// this covers the case where a user may be extending their react-router route | ||
// config with breadcrumbs, but also does not want default breadcrumbs to be | ||
// automatically generated (opt-in) | ||
if (!userProvidedBreadcrumb && disableDefaults) { | ||
breadcrumb = NO_BREADCRUMB; | ||
return true; | ||
} | ||
// if there are no breadcrumbs provided in the routes array we return a default breadcrumb instead | ||
return breadcrumb || getDefaultBreadcrumb({ | ||
pathSection: pathSection, | ||
// include a "Home" breadcrumb by default (can be overrode or disabled in config) | ||
currentSection: pathSection === '/' ? 'Home' : currentSection, | ||
location: location | ||
}); | ||
}; | ||
breadcrumb = render({ | ||
// although we have a match, the user may be passing their react-router config object | ||
// which we support. The route config object may not have a `breadcrumb` param specified. | ||
// If this is the case, we should provide a default via `humanizeString` | ||
breadcrumb: userProvidedBreadcrumb || humanizeString(currentSection), | ||
match: match, | ||
location: location | ||
}); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
var getBreadcrumbs = function getBreadcrumbs(_ref5) { | ||
var routes = _ref5.routes, | ||
location = _ref5.location, | ||
_ref5$options = _ref5.options, | ||
options = _ref5$options === undefined ? {} : _ref5$options; | ||
if (breadcrumb) { | ||
// user provided a breadcrumb prop, or we generated one via humanizeString above ~L75 | ||
return breadcrumb; | ||
} else if (disableDefaults) { | ||
// if there was no breadcrumb provided and user has disableDefaults turned on | ||
return NO_BREADCRUMB; | ||
} | ||
var matches = []; | ||
var pathname = location.pathname; | ||
// if the above conditionals don't fire, generate a default breadcrumb based on the path | ||
return getDefaultBreadcrumb({ | ||
pathSection: pathSection, | ||
// include a "Home" breadcrumb by default (can be overrode or disabled in config) | ||
currentSection: pathSection === '/' ? 'Home' : currentSection, | ||
location: location | ||
}); | ||
}; | ||
var getBreadcrumbs = function getBreadcrumbs(_ref5) { | ||
var routes = _ref5.routes, | ||
location = _ref5.location, | ||
_ref5$options = _ref5.options, | ||
options = _ref5$options === undefined ? {} : _ref5$options; | ||
pathname.split('?')[0] | ||
// remove trailing slash "/" from pathname | ||
.replace(/\/$/, '') | ||
// split pathname into sections | ||
.split('/') | ||
// reduce over the sections and find matches from `routes` prop | ||
.reduce(function (previousSection, currentSection) { | ||
// combine the last route section with the currentSection | ||
// ex `pathname = /1/2/3 results in match checks for | ||
// `/1`, `/1/2`, `/1/2/3` | ||
var pathSection = !currentSection ? '/' : previousSection + '/' + currentSection; | ||
var matches = []; | ||
var pathname = location.pathname; | ||
var breadcrumb = getBreadcrumb({ | ||
currentSection: currentSection, | ||
excludePaths: options.excludePaths, | ||
location: location, | ||
pathSection: pathSection, | ||
routes: routes | ||
}); | ||
// add the breadcrumb to the matches array | ||
// unless the user has explicitly passed { path: x, breadcrumb: null } to disable | ||
if (breadcrumb !== NO_BREADCRUMB) { | ||
matches.push(breadcrumb); | ||
} | ||
pathname.split('?')[0] | ||
// remove trailing slash "/" from pathname | ||
.replace(/\/$/, '') | ||
// split pathname into sections | ||
.split('/') | ||
// reduce over the sections and find matches from `routes` prop | ||
.reduce(function (previousSection, currentSection) { | ||
// combine the last route section with the currentSection | ||
// ex `pathname = /1/2/3 results in match checks for | ||
// `/1`, `/1/2`, `/1/2/3` | ||
var pathSection = !currentSection ? '/' : previousSection + '/' + currentSection; | ||
return pathSection === '/' ? '' : pathSection; | ||
}, null); | ||
var breadcrumb = getBreadcrumb(_extends({ | ||
currentSection: currentSection, | ||
location: location, | ||
pathSection: pathSection, | ||
routes: routes | ||
}, options)); | ||
return matches; | ||
}; | ||
// add the breadcrumb to the matches array | ||
// unless the user has explicitly passed { path: x, breadcrumb: null } to disable | ||
if (breadcrumb !== NO_BREADCRUMB) { | ||
matches.push(breadcrumb); | ||
} | ||
// takes a route array and recursively flattens it IF there are | ||
// nested routes in the config | ||
var flattenRoutes = function flattenRoutes(routes) { | ||
return routes.reduce(function (arr, route) { | ||
if (route.routes) { | ||
return arr.concat([route].concat(toConsumableArray(flattenRoutes(route.routes)))); | ||
} | ||
return arr.concat(route); | ||
}, []); | ||
}; | ||
return pathSection === '/' ? '' : pathSection; | ||
}, null); | ||
var withBreadcrumbs = function withBreadcrumbs() { | ||
var routes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
var options = arguments[1]; | ||
return function (Component) { | ||
return reactRouter.withRouter(function (props) { | ||
return react.createElement(Component, _extends({}, props, { | ||
breadcrumbs: getBreadcrumbs({ | ||
routes: flattenRoutes(routes), | ||
location: props.location, | ||
options: options | ||
}) | ||
})); | ||
}); | ||
}; | ||
}; | ||
return matches; | ||
}; | ||
exports.getBreadcrumbs = getBreadcrumbs; | ||
exports.default = withBreadcrumbs; | ||
// takes a route array and recursively flattens it IF there are | ||
// nested routes in the config | ||
var flattenRoutes = function flattenRoutes(routes) { | ||
return routes.reduce(function (arr, route) { | ||
if (route.routes) { | ||
return arr.concat([route].concat(toConsumableArray(flattenRoutes(route.routes)))); | ||
} | ||
return arr.concat(route); | ||
}, []); | ||
}; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var withBreadcrumbs = function withBreadcrumbs() { | ||
var routes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
var options = arguments[1]; | ||
return function (Component) { | ||
return reactRouter.withRouter(function (props) { | ||
return react.createElement(Component, _extends({}, props, { | ||
breadcrumbs: getBreadcrumbs({ | ||
routes: flattenRoutes(routes), | ||
location: props.location, | ||
options: options | ||
}) | ||
})); | ||
}); | ||
}; | ||
}; | ||
exports.getBreadcrumbs = getBreadcrumbs; | ||
exports.default = withBreadcrumbs; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "react-router-breadcrumbs-hoc", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Just a tiny, flexible, higher order component for rendering breadcrumbs with react-router 4.x", | ||
@@ -38,3 +38,3 @@ "repository": "icd2k3/react-router-breadcrumbs-hoc", | ||
"enzyme-adapter-react-16": "^1.1.0", | ||
"eslint": "^4.18.2", | ||
"eslint": "^4.19.0", | ||
"eslint-config-airbnb": "^16.1.0", | ||
@@ -50,5 +50,5 @@ "eslint-plugin-import": "^2.9.0", | ||
"react-router-dom": "^4.2.2", | ||
"rollup": "^0.56.5", | ||
"rollup": "^0.57.1", | ||
"rollup-plugin-babel": "^3.0.3", | ||
"rollup-plugin-commonjs": "^9.0.0", | ||
"rollup-plugin-commonjs": "^9.1.0", | ||
"rollup-plugin-node-resolve": "^3.2.0" | ||
@@ -55,0 +55,0 @@ }, |
112
README.md
@@ -42,3 +42,3 @@ <h3 align="center"> | ||
## Simple example | ||
## Example | ||
@@ -86,47 +86,62 @@ ```js | ||
## Disabling default breadcrumbs for paths | ||
## Already using a [route config](https://reacttraining.com/react-router/web/example/route-config) array with react-router? | ||
This package will attempt to create breadcrumbs for you based on the route section via [humanize-string](https://github.com/sindresorhus/humanize-string). For example `/users` will auotmatically create the breadcrumb `"Users"`. There are two ways to disable default breadcrumbs for a path: | ||
Just add a `breadcrumb` prop to your routes that require custom breadcrumbs. | ||
Pass `breadcrumb: null` in the routes config: | ||
## Dynamic breadcrumbs | ||
`{ path: '/a/b', breadcrumb: null }` | ||
If you pass a component as the `breadcrumb` prop it will be injected with react-router's [match](https://reacttraining.com/react-router/web/api/match) and [location](https://reacttraining.com/react-router/web/api/location) objects as props. These objects contain ids, hashes, queries, etc from the route that will allow you to map back to whatever you want to display in the breadcrumb. | ||
Or, Pass an `excludePaths` array in the `options` object | ||
Let's use Redux as an example with the [match](https://reacttraining.com/react-router/web/api/match) object: | ||
`withBreadcrumbs(routes, { excludePaths: ['/', '/no-breadcrumb/for-this-route'] })` | ||
```js | ||
// UserBreadcrumb.jsx | ||
const PureUserBreadcrumb = ({ firstName }) => <span>{firstName}</span>; | ||
in your routes array. | ||
// find the user in the store with the `id` from the route | ||
const mapStateToProps = (state, props) => ({ | ||
firstName: state.userReducer.usersById[props.match.params.id].firstName, | ||
}); | ||
## Already using a [route config](https://reacttraining.com/react-router/web/example/route-config) array with react-router? | ||
export default connect(mapStateToProps)(PureUserBreadcrumb); | ||
Just add a `breadcrumb` prop to your routes that require custom breadcrumbs. | ||
// routes = [{ path: '/users/:id', breadcrumb: UserBreadcrumb }] | ||
// example.com/users/123 --> Home / Users / John | ||
``` | ||
> Note: currently, nested `route`s arrays are _not_ supported, but will be soon (see: https://github.com/icd2k3/react-router-breadcrumbs-hoc/issues/24) | ||
---- | ||
## API | ||
Similarly, the [location](https://reacttraining.com/react-router/web/api/location) object could be useful for displaying dynamic breadcrumbs based on the route's state: | ||
```js | ||
Route = { | ||
path: String | ||
breadcrumb: String|Function? // note: if not provided, a default breadcrumb will be returned | ||
matchOptions?: Object | ||
} | ||
```jsx | ||
// dynamically update EditorBreadcrumb based on state info | ||
const EditorBreadcrumb = ({ location: { state: { isNew } } }) => ( | ||
<span>{isNew ? 'Add New' : 'Update'}</span> | ||
); | ||
Options = { | ||
excludePaths: Array | ||
} | ||
// routes = [{ path: '/editor', breadcrumb: EditorBreadcrumb }] | ||
// if routes are not passed, default breadcrumbs will be returned | ||
withBreadcrumbs(routes?: Array<Route>, options? Object<Options>): HigherOrderComponent | ||
// upon navigation, breadcrumb will display: Update | ||
<Link to={{ pathname: '/editor' }}>Edit</Link> | ||
// you shouldn't ever really have to use `getBreadcrumbs`, but it's | ||
// exported for convenience if you don't want to use the HOC | ||
getBreadcrumbs({ | ||
routes: Array<Route>, | ||
location: Object<Location>, // react-router's location object: https://reacttraining.com/react-router/web/api/location | ||
options: Object<Options>, | ||
}): Array<Breadcrumb> | ||
// upon navigation, breadcrumb will display: Add New | ||
<Link to={{ pathname: '/editor', state: { isNew: true } }}>Add</Link> | ||
``` | ||
## Disabling default breadcrumbs for paths | ||
This package will attempt to create breadcrumbs for you based on the route section via [humanize-string](https://github.com/sindresorhus/humanize-string). For example `/users` will auotmatically create the breadcrumb `"Users"`. There are two ways to disable default breadcrumbs for a path: | ||
**Option 1:** Disable _all_ default breadcrumb generation by passing `disableDefaults: true` in the `options` object | ||
`withBreadcrumbs(routes, { disableDefaults: true })` | ||
**Option 2:** Disable _individual_ default breadcrumbs by passing `breadcrumb: null` in route config: | ||
`{ path: '/a/b', breadcrumb: null }` | ||
**Option 3:** Disable _individual_ default breadcrumbs by passing an `excludePaths` array in the `options` object | ||
`withBreadcrumbs(routes, { excludePaths: ['/', '/no-breadcrumb/for-this-route'] })` | ||
## Order matters! | ||
@@ -158,26 +173,25 @@ | ||
## Using the location object | ||
## API | ||
React Router's [location](https://reacttraining.com/react-router/web/api/location) object lets you pass `state` property. Using the `state` allows one to update the Breadcrumb to display dynamic info at runtime. Consider this example: | ||
```js | ||
Route = { | ||
path: String | ||
breadcrumb: String|Function? // note: if not provided, a default breadcrumb will be returned | ||
matchOptions?: Object | ||
} | ||
```jsx | ||
// dynamically update Breadcrumb based on state info | ||
const Breadcrumb = ({ location: { state: { isNew } } }) => ( | ||
<span>{isNew ? 'Add New' : 'Update'}</span> | ||
); | ||
// routes | ||
{ | ||
pathname: '/editor', | ||
breadcrumb: Breadcrumb | ||
... | ||
Options = { | ||
excludePaths: Array | ||
} | ||
// upon navigation, breadcrumb will display: Update | ||
<Link to={{ pathname: '/editor' }}>Edit</Link> | ||
// if routes are not passed, default breadcrumbs will be returned | ||
withBreadcrumbs(routes?: Array<Route>, options? Object<Options>): HigherOrderComponent | ||
// upon navigation, breadcrumb will display: Add New | ||
<Link to={{ pathname: '/editor', state: { isNew: true } }}>Add</Link> | ||
// you shouldn't ever really have to use `getBreadcrumbs`, but it's | ||
// exported for convenience if you don't want to use the HOC | ||
getBreadcrumbs({ | ||
routes: Array<Route>, | ||
location: Object<Location>, | ||
options: Object<Options>, | ||
}): Array<Breadcrumb> | ||
``` | ||
Now, based on what you pass in the `state` prop, the Breadcrumb will display dynamic values at runtime! |
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
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
453646
919
195