react-children-utilities
Advanced tools
Comparing version 2.0.0-rc.0 to 2.0.0-rc.1
@@ -7,6 +7,5 @@ { | ||
"plugin:jest/all", | ||
"prettier", | ||
"plugin:prettier/recommended", | ||
"prettier/@typescript-eslint" | ||
], | ||
"plugins": ["prettier"], | ||
"parserOptions": { "project": "./tsconfig.all.json" }, | ||
@@ -17,5 +16,4 @@ "env": { "browser": true }, | ||
"jest/prefer-expect-assertions": "off", | ||
"prettier/prettier": "error", | ||
"react/jsx-filename-extension": ["error", { "extensions": [".tsx"] }] | ||
} | ||
} |
{"/Users/fernandopasik/Sites/react-children-utilities/src/react-children-utilities.ts": {"path":"/Users/fernandopasik/Sites/react-children-utilities/src/react-children-utilities.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}},"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":7}},"2":{"start":{"line":14,"column":2},"end":{"line":3,"column":42}},"3":{"start":{"line":4,"column":0},"end":{"line":4,"column":7}},"4":{"start":{"line":15,"column":2},"end":{"line":4,"column":38}},"5":{"start":{"line":5,"column":0},"end":{"line":5,"column":7}},"6":{"start":{"line":16,"column":2},"end":{"line":5,"column":44}},"7":{"start":{"line":6,"column":0},"end":{"line":6,"column":7}},"8":{"start":{"line":17,"column":2},"end":{"line":6,"column":36}},"9":{"start":{"line":7,"column":0},"end":{"line":7,"column":7}},"10":{"start":{"line":18,"column":2},"end":{"line":7,"column":34}},"11":{"start":{"line":8,"column":0},"end":{"line":8,"column":7}},"12":{"start":{"line":19,"column":2},"end":{"line":8,"column":44}},"13":{"start":{"line":9,"column":0},"end":{"line":9,"column":7}},"14":{"start":{"line":20,"column":2},"end":{"line":9,"column":44}},"15":{"start":{"line":10,"column":0},"end":{"line":10,"column":7}},"16":{"start":{"line":21,"column":2},"end":{"line":10,"column":58}},"17":{"start":{"line":11,"column":0},"end":{"line":11,"column":7}},"18":{"start":{"line":22,"column":2},"end":{"line":11,"column":38}},"19":{"start":{"line":25,"column":0},"end":{"line":35,"column":null}}},"fnMap":{},"branchMap":{},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":1,"9":1,"10":1,"11":1,"12":1,"13":1,"14":1,"15":1,"16":1,"17":1,"18":1,"19":1},"f":{},"b":{}} | ||
,"/Users/fernandopasik/Sites/react-children-utilities/src/lib/deepFilter.ts": {"path":"/Users/fernandopasik/Sites/react-children-utilities/src/lib/deepFilter.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":74}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":54}},"2":{"start":{"line":8,"column":19},"end":{"line":21,"column":1}},"3":{"start":{"line":9,"column":2},"end":{"line":20,"column":7}},"4":{"start":{"line":12,"column":6},"end":{"line":18,"column":null}},"5":{"start":{"line":14,"column":8},"end":{"line":17,"column":11}},"6":{"start":{"line":19,"column":6},"end":{"line":19,"column":19}},"7":{"start":{"line":23,"column":0},"end":{"line":23,"column":26}}},"fnMap":{"0":{"name":"(anonymous_1)","decl":{"start":{"line":8,"column":19},"end":{"line":8,"column":20}},"loc":{"start":{"line":8,"column":86},"end":{"line":21,"column":1}}},"1":{"name":"(anonymous_2)","decl":{"start":{"line":11,"column":9},"end":{"line":11,"column":10}},"loc":{"start":{"line":11,"column":30},"end":{"line":20,"column":5}}}},"branchMap":{"0":{"loc":{"start":{"line":12,"column":6},"end":{"line":18,"column":null}},"type":"if","locations":[{"start":{"line":12,"column":6},"end":{"line":18,"column":null}},{"start":{"line":12,"column":6},"end":{"line":18,"column":null}}]},"1":{"loc":{"start":{"line":12,"column":10},"end":{"line":12,"column":31}},"type":"binary-expr","locations":[{"start":{"line":12,"column":10},"end":{"line":12,"column":31}},{"start":{"line":12,"column":35},"end":{"line":12,"column":60}}]}},"s":{"0":2,"1":2,"2":2,"3":8,"4":13,"5":4,"6":9,"7":2},"f":{"0":8,"1":13},"b":{"0":[4,9],"1":[13,13]}} | ||
,"/Users/fernandopasik/Sites/react-children-utilities/src/lib/deepFind.ts": {"path":"/Users/fernandopasik/Sites/react-children-utilities/src/lib/deepFind.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":54}},"2":{"start":{"line":8,"column":17},"end":{"line":27,"column":1}},"3":{"start":{"line":11,"column":2},"end":{"line":24,"column":5}},"4":{"start":{"line":12,"column":4},"end":{"line":16,"column":null}},"5":{"start":{"line":14,"column":6},"end":{"line":14,"column":57}},"6":{"start":{"line":15,"column":6},"end":{"line":15,"column":42}},"7":{"start":{"line":18,"column":4},"end":{"line":21,"column":null}},"8":{"start":{"line":19,"column":6},"end":{"line":19,"column":20}},"9":{"start":{"line":20,"column":6},"end":{"line":20,"column":18}},"10":{"start":{"line":23,"column":4},"end":{"line":23,"column":17}},"11":{"start":{"line":26,"column":2},"end":{"line":26,"column":15}},"12":{"start":{"line":29,"column":0},"end":{"line":29,"column":24}}},"fnMap":{"0":{"name":"(anonymous_1)","decl":{"start":{"line":8,"column":17},"end":{"line":8,"column":18}},"loc":{"start":{"line":8,"column":90},"end":{"line":27,"column":1}}},"1":{"name":"(anonymous_2)","decl":{"start":{"line":11,"column":34},"end":{"line":11,"column":35}},"loc":{"start":{"line":11,"column":55},"end":{"line":24,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":12,"column":4},"end":{"line":16,"column":null}},"type":"if","locations":[{"start":{"line":12,"column":4},"end":{"line":16,"column":null}},{"start":{"line":12,"column":4},"end":{"line":16,"column":null}}]},"1":{"loc":{"start":{"line":12,"column":8},"end":{"line":12,"column":29}},"type":"binary-expr","locations":[{"start":{"line":12,"column":8},"end":{"line":12,"column":29}},{"start":{"line":12,"column":33},"end":{"line":12,"column":58}}]},"2":{"loc":{"start":{"line":18,"column":4},"end":{"line":21,"column":null}},"type":"if","locations":[{"start":{"line":18,"column":4},"end":{"line":21,"column":null}},{"start":{"line":18,"column":4},"end":{"line":21,"column":null}}]}},"s":{"0":2,"1":2,"2":2,"3":4,"4":7,"5":1,"6":1,"7":6,"8":2,"9":2,"10":4,"11":4,"12":2},"f":{"0":4,"1":7},"b":{"0":[1,6],"1":[7,7],"2":[2,4]}} | ||
,"/Users/fernandopasik/Sites/react-children-utilities/src/lib/deepForEach.ts": {"path":"/Users/fernandopasik/Sites/react-children-utilities/src/lib/deepForEach.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":54}},"2":{"start":{"line":8,"column":20},"end":{"line":16,"column":1}},"3":{"start":{"line":9,"column":2},"end":{"line":15,"column":5}},"4":{"start":{"line":10,"column":4},"end":{"line":13,"column":null}},"5":{"start":{"line":12,"column":6},"end":{"line":12,"column":55}},"6":{"start":{"line":14,"column":4},"end":{"line":14,"column":25}},"7":{"start":{"line":18,"column":0},"end":{"line":18,"column":27}}},"fnMap":{"0":{"name":"(anonymous_1)","decl":{"start":{"line":8,"column":20},"end":{"line":8,"column":21}},"loc":{"start":{"line":8,"column":82},"end":{"line":16,"column":1}}},"1":{"name":"(anonymous_2)","decl":{"start":{"line":9,"column":29},"end":{"line":9,"column":30}},"loc":{"start":{"line":9,"column":50},"end":{"line":15,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":10,"column":4},"end":{"line":13,"column":null}},"type":"if","locations":[{"start":{"line":10,"column":4},"end":{"line":13,"column":null}},{"start":{"line":10,"column":4},"end":{"line":13,"column":null}}]},"1":{"loc":{"start":{"line":10,"column":8},"end":{"line":10,"column":29}},"type":"binary-expr","locations":[{"start":{"line":10,"column":8},"end":{"line":10,"column":29}},{"start":{"line":10,"column":33},"end":{"line":10,"column":58}}]}},"s":{"0":2,"1":2,"2":2,"3":6,"4":11,"5":3,"6":11,"7":2},"f":{"0":6,"1":11},"b":{"0":[3,8],"1":[11,10]}} | ||
,"/Users/fernandopasik/Sites/react-children-utilities/src/lib/deepMap.ts": {"path":"/Users/fernandopasik/Sites/react-children-utilities/src/lib/deepMap.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":74}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":54}},"2":{"start":{"line":8,"column":16},"end":{"line":21,"column":1}},"3":{"start":{"line":9,"column":2},"end":{"line":20,"column":5}},"4":{"start":{"line":10,"column":4},"end":{"line":18,"column":null}},"5":{"start":{"line":12,"column":6},"end":{"line":17,"column":8}},"6":{"start":{"line":19,"column":4},"end":{"line":19,"column":28}},"7":{"start":{"line":23,"column":0},"end":{"line":23,"column":23}}},"fnMap":{"0":{"name":"(anonymous_1)","decl":{"start":{"line":8,"column":16},"end":{"line":8,"column":17}},"loc":{"start":{"line":8,"column":77},"end":{"line":21,"column":1}}},"1":{"name":"(anonymous_2)","decl":{"start":{"line":9,"column":32},"end":{"line":9,"column":33}},"loc":{"start":{"line":9,"column":53},"end":{"line":20,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":10,"column":4},"end":{"line":18,"column":null}},"type":"if","locations":[{"start":{"line":10,"column":4},"end":{"line":18,"column":null}},{"start":{"line":10,"column":4},"end":{"line":18,"column":null}}]},"1":{"loc":{"start":{"line":10,"column":8},"end":{"line":10,"column":29}},"type":"binary-expr","locations":[{"start":{"line":10,"column":8},"end":{"line":10,"column":29}},{"start":{"line":10,"column":33},"end":{"line":10,"column":58}}]}},"s":{"0":2,"1":2,"2":2,"3":6,"4":10,"5":3,"6":7,"7":2},"f":{"0":6,"1":10},"b":{"0":[3,7],"1":[10,9]}} | ||
,"/Users/fernandopasik/Sites/react-children-utilities/src/lib/filter.ts": {"path":"/Users/fernandopasik/Sites/react-children-utilities/src/lib/filter.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}},"1":{"start":{"line":7,"column":15},"end":{"line":9,"column":1}},"2":{"start":{"line":8,"column":2},"end":{"line":8,"column":53}},"3":{"start":{"line":11,"column":0},"end":{"line":11,"column":22}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":7,"column":15},"end":{"line":7,"column":16}},"loc":{"start":{"line":7,"column":78},"end":{"line":9,"column":1}}}},"branchMap":{},"s":{"0":2,"1":2,"2":4,"3":2},"f":{"0":4},"b":{}} | ||
,"/Users/fernandopasik/Sites/react-children-utilities/src/lib/groupByType.ts": {"path":"/Users/fernandopasik/Sites/react-children-utilities/src/lib/groupByType.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}},"1":{"start":{"line":7,"column":20},"end":{"line":23,"column":1}},"2":{"start":{"line":12,"column":2},"end":{"line":22,"column":9}},"3":{"start":{"line":13,"column":19},"end":{"line":13,"column":35}},"4":{"start":{"line":15,"column":4},"end":{"line":19,"column":null}},"5":{"start":{"line":16,"column":6},"end":{"line":16,"column":72}},"6":{"start":{"line":18,"column":6},"end":{"line":18,"column":60}},"7":{"start":{"line":21,"column":4},"end":{"line":21,"column":21}},"8":{"start":{"line":25,"column":0},"end":{"line":25,"column":27}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":7,"column":20},"end":{"line":7,"column":null}},"loc":{"start":{"line":11,"column":21},"end":{"line":23,"column":1}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":12,"column":43},"end":{"line":12,"column":44}},"loc":{"start":{"line":12,"column":89},"end":{"line":22,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":9,"column":23},"end":{"line":9,"column":25}},"type":"default-arg","locations":[{"start":{"line":9,"column":23},"end":{"line":9,"column":25}}]},"1":{"loc":{"start":{"line":10,"column":9},"end":{"line":10,"column":15}},"type":"default-arg","locations":[{"start":{"line":10,"column":9},"end":{"line":10,"column":15}}]},"2":{"loc":{"start":{"line":15,"column":4},"end":{"line":19,"column":null}},"type":"if","locations":[{"start":{"line":15,"column":4},"end":{"line":19,"column":null}},{"start":{"line":15,"column":4},"end":{"line":19,"column":null}}]},"3":{"loc":{"start":{"line":15,"column":8},"end":{"line":15,"column":29}},"type":"binary-expr","locations":[{"start":{"line":15,"column":8},"end":{"line":15,"column":29}},{"start":{"line":15,"column":33},"end":{"line":15,"column":63}},{"start":{"line":15,"column":67},"end":{"line":15,"column":93}}]},"4":{"loc":{"start":{"line":16,"column":35},"end":{"line":16,"column":56}},"type":"binary-expr","locations":[{"start":{"line":16,"column":35},"end":{"line":16,"column":56}},{"start":{"line":16,"column":60},"end":{"line":16,"column":62}}]},"5":{"loc":{"start":{"line":18,"column":29},"end":{"line":18,"column":44}},"type":"binary-expr","locations":[{"start":{"line":18,"column":29},"end":{"line":18,"column":44}},{"start":{"line":18,"column":48},"end":{"line":18,"column":50}}]}},"s":{"0":2,"1":2,"2":10,"3":17,"4":17,"5":6,"6":11,"7":17,"8":2},"f":{"0":10,"1":17},"b":{"0":[1],"1":[9],"2":[6,11],"3":[17,11,11],"4":[6,4],"5":[11,6]}} | ||
,"/Users/fernandopasik/Sites/react-children-utilities/src/lib/hasChildren.ts": {"path":"/Users/fernandopasik/Sites/react-children-utilities/src/lib/hasChildren.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}},"1":{"start":{"line":3,"column":20},"end":{"line":4,"column":60}},"2":{"start":{"line":4,"column":2},"end":{"line":4,"column":60}},"3":{"start":{"line":6,"column":0},"end":{"line":6,"column":27}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":3,"column":20},"end":{"line":3,"column":21}},"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":60}}}},"branchMap":{"0":{"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":25}},"type":"binary-expr","locations":[{"start":{"line":4,"column":2},"end":{"line":4,"column":25}},{"start":{"line":4,"column":29},"end":{"line":4,"column":60}}]}},"s":{"0":8,"1":8,"2":65,"3":8},"f":{"0":65},"b":{"0":[65,65]}} | ||
,"/Users/fernandopasik/Sites/react-children-utilities/src/lib/hasComplexChildren.ts": {"path":"/Users/fernandopasik/Sites/react-children-utilities/src/lib/hasComplexChildren.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}},"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":40}},"2":{"start":{"line":5,"column":27},"end":{"line":10,"column":null}},"3":{"start":{"line":6,"column":2},"end":{"line":10,"column":null}},"4":{"start":{"line":9,"column":45},"end":{"line":9,"column":78}},"5":{"start":{"line":13,"column":0},"end":{"line":13,"column":34}}},"fnMap":{"0":{"name":"(anonymous_1)","decl":{"start":{"line":5,"column":27},"end":{"line":5,"column":28}},"loc":{"start":{"line":6,"column":2},"end":{"line":10,"column":null}}},"1":{"name":"(anonymous_2)","decl":{"start":{"line":9,"column":4},"end":{"line":9,"column":5}},"loc":{"start":{"line":9,"column":45},"end":{"line":9,"column":78}}}},"branchMap":{"0":{"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":25}},"type":"binary-expr","locations":[{"start":{"line":6,"column":2},"end":{"line":6,"column":25}},{"start":{"line":7,"column":2},"end":{"line":7,"column":22}},{"start":{"line":8,"column":2},"end":{"line":10,"column":null}}]},"1":{"loc":{"start":{"line":9,"column":45},"end":{"line":9,"column":53}},"type":"binary-expr","locations":[{"start":{"line":9,"column":45},"end":{"line":9,"column":53}},{"start":{"line":9,"column":57},"end":{"line":9,"column":78}}]}},"s":{"0":6,"1":6,"2":6,"3":48,"4":52,"5":6},"f":{"0":48,"1":52},"b":{"0":[48,48,45],"1":[52,46]}} | ||
,"/Users/fernandopasik/Sites/react-children-utilities/src/lib/deepFilter.ts": {"path":"/Users/fernandopasik/Sites/react-children-utilities/src/lib/deepFilter.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":74}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":54}},"2":{"start":{"line":6,"column":19},"end":{"line":19,"column":1}},"3":{"start":{"line":7,"column":2},"end":{"line":18,"column":7}},"4":{"start":{"line":10,"column":6},"end":{"line":16,"column":null}},"5":{"start":{"line":12,"column":8},"end":{"line":15,"column":11}},"6":{"start":{"line":17,"column":6},"end":{"line":17,"column":19}},"7":{"start":{"line":21,"column":0},"end":{"line":21,"column":26}}},"fnMap":{"0":{"name":"(anonymous_1)","decl":{"start":{"line":6,"column":19},"end":{"line":6,"column":20}},"loc":{"start":{"line":6,"column":86},"end":{"line":19,"column":1}}},"1":{"name":"(anonymous_2)","decl":{"start":{"line":9,"column":9},"end":{"line":9,"column":10}},"loc":{"start":{"line":9,"column":30},"end":{"line":18,"column":5}}}},"branchMap":{"0":{"loc":{"start":{"line":10,"column":6},"end":{"line":16,"column":null}},"type":"if","locations":[{"start":{"line":10,"column":6},"end":{"line":16,"column":null}},{"start":{"line":10,"column":6},"end":{"line":16,"column":null}}]},"1":{"loc":{"start":{"line":10,"column":10},"end":{"line":10,"column":31}},"type":"binary-expr","locations":[{"start":{"line":10,"column":10},"end":{"line":10,"column":31}},{"start":{"line":10,"column":35},"end":{"line":10,"column":60}}]}},"s":{"0":2,"1":2,"2":2,"3":8,"4":13,"5":4,"6":9,"7":2},"f":{"0":8,"1":13},"b":{"0":[4,9],"1":[13,13]}} | ||
,"/Users/fernandopasik/Sites/react-children-utilities/src/lib/deepFind.ts": {"path":"/Users/fernandopasik/Sites/react-children-utilities/src/lib/deepFind.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":54}},"2":{"start":{"line":6,"column":17},"end":{"line":25,"column":1}},"3":{"start":{"line":9,"column":2},"end":{"line":22,"column":5}},"4":{"start":{"line":10,"column":4},"end":{"line":13,"column":null}},"5":{"start":{"line":11,"column":6},"end":{"line":11,"column":20}},"6":{"start":{"line":12,"column":6},"end":{"line":12,"column":18}},"7":{"start":{"line":15,"column":4},"end":{"line":19,"column":null}},"8":{"start":{"line":17,"column":6},"end":{"line":17,"column":57}},"9":{"start":{"line":18,"column":6},"end":{"line":18,"column":42}},"10":{"start":{"line":21,"column":4},"end":{"line":21,"column":17}},"11":{"start":{"line":24,"column":2},"end":{"line":24,"column":15}},"12":{"start":{"line":27,"column":0},"end":{"line":27,"column":24}}},"fnMap":{"0":{"name":"(anonymous_1)","decl":{"start":{"line":6,"column":17},"end":{"line":6,"column":18}},"loc":{"start":{"line":6,"column":90},"end":{"line":25,"column":1}}},"1":{"name":"(anonymous_2)","decl":{"start":{"line":9,"column":34},"end":{"line":9,"column":35}},"loc":{"start":{"line":9,"column":55},"end":{"line":22,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":10,"column":4},"end":{"line":13,"column":null}},"type":"if","locations":[{"start":{"line":10,"column":4},"end":{"line":13,"column":null}},{"start":{"line":10,"column":4},"end":{"line":13,"column":null}}]},"1":{"loc":{"start":{"line":15,"column":4},"end":{"line":19,"column":null}},"type":"if","locations":[{"start":{"line":15,"column":4},"end":{"line":19,"column":null}},{"start":{"line":15,"column":4},"end":{"line":19,"column":null}}]},"2":{"loc":{"start":{"line":15,"column":8},"end":{"line":15,"column":29}},"type":"binary-expr","locations":[{"start":{"line":15,"column":8},"end":{"line":15,"column":29}},{"start":{"line":15,"column":33},"end":{"line":15,"column":58}}]}},"s":{"0":2,"1":2,"2":2,"3":5,"4":9,"5":3,"6":3,"7":6,"8":1,"9":1,"10":5,"11":5,"12":2},"f":{"0":5,"1":9},"b":{"0":[3,6],"1":[1,5],"2":[6,6]}} | ||
,"/Users/fernandopasik/Sites/react-children-utilities/src/lib/deepForEach.ts": {"path":"/Users/fernandopasik/Sites/react-children-utilities/src/lib/deepForEach.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":54}},"2":{"start":{"line":6,"column":20},"end":{"line":14,"column":1}},"3":{"start":{"line":7,"column":2},"end":{"line":13,"column":5}},"4":{"start":{"line":8,"column":4},"end":{"line":11,"column":null}},"5":{"start":{"line":10,"column":6},"end":{"line":10,"column":55}},"6":{"start":{"line":12,"column":4},"end":{"line":12,"column":25}},"7":{"start":{"line":16,"column":0},"end":{"line":16,"column":27}}},"fnMap":{"0":{"name":"(anonymous_1)","decl":{"start":{"line":6,"column":20},"end":{"line":6,"column":21}},"loc":{"start":{"line":6,"column":82},"end":{"line":14,"column":1}}},"1":{"name":"(anonymous_2)","decl":{"start":{"line":7,"column":29},"end":{"line":7,"column":30}},"loc":{"start":{"line":7,"column":50},"end":{"line":13,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":8,"column":4},"end":{"line":11,"column":null}},"type":"if","locations":[{"start":{"line":8,"column":4},"end":{"line":11,"column":null}},{"start":{"line":8,"column":4},"end":{"line":11,"column":null}}]},"1":{"loc":{"start":{"line":8,"column":8},"end":{"line":8,"column":29}},"type":"binary-expr","locations":[{"start":{"line":8,"column":8},"end":{"line":8,"column":29}},{"start":{"line":8,"column":33},"end":{"line":8,"column":58}}]}},"s":{"0":2,"1":2,"2":2,"3":6,"4":11,"5":3,"6":11,"7":2},"f":{"0":6,"1":11},"b":{"0":[3,8],"1":[11,10]}} | ||
,"/Users/fernandopasik/Sites/react-children-utilities/src/lib/deepMap.ts": {"path":"/Users/fernandopasik/Sites/react-children-utilities/src/lib/deepMap.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":74}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":54}},"2":{"start":{"line":6,"column":16},"end":{"line":19,"column":1}},"3":{"start":{"line":7,"column":2},"end":{"line":18,"column":5}},"4":{"start":{"line":8,"column":4},"end":{"line":16,"column":null}},"5":{"start":{"line":10,"column":6},"end":{"line":15,"column":8}},"6":{"start":{"line":17,"column":4},"end":{"line":17,"column":28}},"7":{"start":{"line":21,"column":0},"end":{"line":21,"column":23}}},"fnMap":{"0":{"name":"(anonymous_1)","decl":{"start":{"line":6,"column":16},"end":{"line":6,"column":17}},"loc":{"start":{"line":6,"column":77},"end":{"line":19,"column":1}}},"1":{"name":"(anonymous_2)","decl":{"start":{"line":7,"column":32},"end":{"line":7,"column":33}},"loc":{"start":{"line":7,"column":53},"end":{"line":18,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":8,"column":4},"end":{"line":16,"column":null}},"type":"if","locations":[{"start":{"line":8,"column":4},"end":{"line":16,"column":null}},{"start":{"line":8,"column":4},"end":{"line":16,"column":null}}]},"1":{"loc":{"start":{"line":8,"column":8},"end":{"line":8,"column":29}},"type":"binary-expr","locations":[{"start":{"line":8,"column":8},"end":{"line":8,"column":29}},{"start":{"line":8,"column":33},"end":{"line":8,"column":58}}]}},"s":{"0":2,"1":2,"2":2,"3":6,"4":10,"5":3,"6":7,"7":2},"f":{"0":6,"1":10},"b":{"0":[3,7],"1":[10,9]}} | ||
,"/Users/fernandopasik/Sites/react-children-utilities/src/lib/filter.ts": {"path":"/Users/fernandopasik/Sites/react-children-utilities/src/lib/filter.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}},"1":{"start":{"line":5,"column":15},"end":{"line":7,"column":1}},"2":{"start":{"line":6,"column":2},"end":{"line":6,"column":53}},"3":{"start":{"line":9,"column":0},"end":{"line":9,"column":22}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":5,"column":15},"end":{"line":5,"column":16}},"loc":{"start":{"line":5,"column":78},"end":{"line":7,"column":1}}}},"branchMap":{},"s":{"0":2,"1":2,"2":4,"3":2},"f":{"0":4},"b":{}} | ||
,"/Users/fernandopasik/Sites/react-children-utilities/src/lib/groupByType.ts": {"path":"/Users/fernandopasik/Sites/react-children-utilities/src/lib/groupByType.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}},"1":{"start":{"line":7,"column":20},"end":{"line":28,"column":1}},"2":{"start":{"line":12,"column":2},"end":{"line":27,"column":9}},"3":{"start":{"line":13,"column":19},"end":{"line":13,"column":35}},"4":{"start":{"line":14,"column":14},"end":{"line":14,"column":18}},"5":{"start":{"line":16,"column":4},"end":{"line":18,"column":null}},"6":{"start":{"line":17,"column":6},"end":{"line":17,"column":23}},"7":{"start":{"line":20,"column":4},"end":{"line":22,"column":null}},"8":{"start":{"line":21,"column":6},"end":{"line":21,"column":26}},"9":{"start":{"line":24,"column":4},"end":{"line":24,"column":48}},"10":{"start":{"line":26,"column":4},"end":{"line":26,"column":21}},"11":{"start":{"line":30,"column":0},"end":{"line":30,"column":27}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":7,"column":20},"end":{"line":7,"column":null}},"loc":{"start":{"line":11,"column":21},"end":{"line":28,"column":1}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":12,"column":43},"end":{"line":12,"column":44}},"loc":{"start":{"line":12,"column":89},"end":{"line":27,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":9,"column":23},"end":{"line":9,"column":25}},"type":"default-arg","locations":[{"start":{"line":9,"column":23},"end":{"line":9,"column":25}}]},"1":{"loc":{"start":{"line":10,"column":9},"end":{"line":10,"column":15}},"type":"default-arg","locations":[{"start":{"line":10,"column":9},"end":{"line":10,"column":15}}]},"2":{"loc":{"start":{"line":16,"column":4},"end":{"line":18,"column":null}},"type":"if","locations":[{"start":{"line":16,"column":4},"end":{"line":18,"column":null}},{"start":{"line":16,"column":4},"end":{"line":18,"column":null}}]},"3":{"loc":{"start":{"line":16,"column":8},"end":{"line":16,"column":29}},"type":"binary-expr","locations":[{"start":{"line":16,"column":8},"end":{"line":16,"column":29}},{"start":{"line":16,"column":33},"end":{"line":16,"column":63}},{"start":{"line":16,"column":67},"end":{"line":16,"column":93}}]},"4":{"loc":{"start":{"line":20,"column":4},"end":{"line":22,"column":null}},"type":"if","locations":[{"start":{"line":20,"column":4},"end":{"line":22,"column":null}},{"start":{"line":20,"column":4},"end":{"line":22,"column":null}}]}},"s":{"0":2,"1":2,"2":10,"3":17,"4":17,"5":17,"6":6,"7":17,"8":10,"9":17,"10":17,"11":2},"f":{"0":10,"1":17},"b":{"0":[1],"1":[9],"2":[6,11],"3":[17,11,11],"4":[10,7]}} | ||
,"/Users/fernandopasik/Sites/react-children-utilities/src/lib/hasChildren.ts": {"path":"/Users/fernandopasik/Sites/react-children-utilities/src/lib/hasChildren.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}},"1":{"start":{"line":3,"column":20},"end":{"line":4,"column":60}},"2":{"start":{"line":4,"column":2},"end":{"line":4,"column":60}},"3":{"start":{"line":6,"column":0},"end":{"line":6,"column":27}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":3,"column":20},"end":{"line":3,"column":21}},"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":60}}}},"branchMap":{"0":{"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":25}},"type":"binary-expr","locations":[{"start":{"line":4,"column":2},"end":{"line":4,"column":25}},{"start":{"line":4,"column":29},"end":{"line":4,"column":60}}]}},"s":{"0":8,"1":8,"2":64,"3":8},"f":{"0":64},"b":{"0":[64,64]}} | ||
,"/Users/fernandopasik/Sites/react-children-utilities/src/lib/hasComplexChildren.ts": {"path":"/Users/fernandopasik/Sites/react-children-utilities/src/lib/hasComplexChildren.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}},"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":40}},"2":{"start":{"line":5,"column":27},"end":{"line":10,"column":null}},"3":{"start":{"line":6,"column":2},"end":{"line":10,"column":null}},"4":{"start":{"line":9,"column":45},"end":{"line":9,"column":78}},"5":{"start":{"line":13,"column":0},"end":{"line":13,"column":34}}},"fnMap":{"0":{"name":"(anonymous_1)","decl":{"start":{"line":5,"column":27},"end":{"line":5,"column":28}},"loc":{"start":{"line":6,"column":2},"end":{"line":10,"column":null}}},"1":{"name":"(anonymous_2)","decl":{"start":{"line":9,"column":4},"end":{"line":9,"column":5}},"loc":{"start":{"line":9,"column":45},"end":{"line":9,"column":78}}}},"branchMap":{"0":{"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":25}},"type":"binary-expr","locations":[{"start":{"line":6,"column":2},"end":{"line":6,"column":25}},{"start":{"line":7,"column":2},"end":{"line":7,"column":22}},{"start":{"line":8,"column":2},"end":{"line":10,"column":null}}]},"1":{"loc":{"start":{"line":9,"column":45},"end":{"line":9,"column":53}},"type":"binary-expr","locations":[{"start":{"line":9,"column":45},"end":{"line":9,"column":53}},{"start":{"line":9,"column":57},"end":{"line":9,"column":78}}]}},"s":{"0":6,"1":6,"2":6,"3":47,"4":51,"5":6},"f":{"0":47,"1":51},"b":{"0":[47,47,44],"1":[51,45]}} | ||
,"/Users/fernandopasik/Sites/react-children-utilities/src/lib/onlyText.ts": {"path":"/Users/fernandopasik/Sites/react-children-utilities/src/lib/onlyText.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":71}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":40}},"2":{"start":{"line":4,"column":22},"end":{"line":10,"column":1}},"3":{"start":{"line":5,"column":2},"end":{"line":7,"column":null}},"4":{"start":{"line":6,"column":4},"end":{"line":6,"column":14}},"5":{"start":{"line":9,"column":2},"end":{"line":9,"column":26}},"6":{"start":{"line":12,"column":17},"end":{"line":28,"column":1}},"7":{"start":{"line":13,"column":2},"end":{"line":15,"column":null}},"8":{"start":{"line":14,"column":4},"end":{"line":14,"column":35}},"9":{"start":{"line":17,"column":2},"end":{"line":27,"column":9}},"10":{"start":{"line":20,"column":4},"end":{"line":24,"column":null}},"11":{"start":{"line":21,"column":6},"end":{"line":21,"column":47}},"12":{"start":{"line":23,"column":6},"end":{"line":23,"column":37}},"13":{"start":{"line":26,"column":4},"end":{"line":26,"column":32}},"14":{"start":{"line":30,"column":0},"end":{"line":30,"column":24}}},"fnMap":{"0":{"name":"(anonymous_1)","decl":{"start":{"line":4,"column":22},"end":{"line":4,"column":23}},"loc":{"start":{"line":4,"column":85},"end":{"line":10,"column":1}}},"1":{"name":"(anonymous_2)","decl":{"start":{"line":12,"column":17},"end":{"line":12,"column":18}},"loc":{"start":{"line":12,"column":49},"end":{"line":28,"column":1}}},"2":{"name":"(anonymous_3)","decl":{"start":{"line":17,"column":43},"end":{"line":17,"column":44}},"loc":{"start":{"line":17,"column":86},"end":{"line":27,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":5,"column":2},"end":{"line":7,"column":null}},"type":"if","locations":[{"start":{"line":5,"column":2},"end":{"line":7,"column":null}},{"start":{"line":5,"column":2},"end":{"line":7,"column":null}}]},"1":{"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":34}},"type":"binary-expr","locations":[{"start":{"line":5,"column":6},"end":{"line":5,"column":34}},{"start":{"line":5,"column":38},"end":{"line":5,"column":52}},{"start":{"line":5,"column":56},"end":{"line":5,"column":82}}]},"2":{"loc":{"start":{"line":13,"column":2},"end":{"line":15,"column":null}},"type":"if","locations":[{"start":{"line":13,"column":2},"end":{"line":15,"column":null}},{"start":{"line":13,"column":2},"end":{"line":15,"column":null}}]},"3":{"loc":{"start":{"line":13,"column":6},"end":{"line":13,"column":34}},"type":"binary-expr","locations":[{"start":{"line":13,"column":6},"end":{"line":13,"column":34}},{"start":{"line":13,"column":38},"end":{"line":13,"column":63}}]},"4":{"loc":{"start":{"line":20,"column":4},"end":{"line":24,"column":null}},"type":"if","locations":[{"start":{"line":20,"column":4},"end":{"line":24,"column":null}},{"start":{"line":20,"column":4},"end":{"line":24,"column":null}}]},"5":{"loc":{"start":{"line":20,"column":8},"end":{"line":20,"column":29}},"type":"binary-expr","locations":[{"start":{"line":20,"column":8},"end":{"line":20,"column":29}},{"start":{"line":20,"column":33},"end":{"line":20,"column":51}}]}},"s":{"0":2,"1":2,"2":2,"3":16,"4":4,"5":12,"6":2,"7":17,"8":12,"9":5,"10":12,"11":8,"12":4,"13":12,"14":2},"f":{"0":16,"1":17,"2":12},"b":{"0":[4,12],"1":[16,15,14],"2":[12,5],"3":[17,13],"4":[8,4],"5":[12,8]}} | ||
} |
@@ -9,10 +9,10 @@ --- | ||
- [deepFilter(children, filterFn)](/deep-filter) | ||
- [deepFind(children, findFn)](/deep-find) | ||
- [deepForEach(children, forEachFn)](/deep-foreach) | ||
- [deepMap(children, mapFn)](/deep-map) | ||
- [filter(children, filterFn)](/filter) | ||
- [groupByType(children, types, rest)](/group-by-type) | ||
- [hasChildren(children)](/has-children) | ||
- [hasComplexChildren(children)](/has-complex-children) | ||
- [onlyText(children)](/only-text) | ||
- [deepFilter(children, filterFn)]({{ site.github.url }}/deep-filter) | ||
- [deepFind(children, findFn)]({{ site.github.url }}/deep-find) | ||
- [deepForEach(children, forEachFn)]({{ site.github.url }}/deep-foreach) | ||
- [deepMap(children, mapFn)]({{ site.github.url }}/deep-map) | ||
- [filter(children, filterFn)]({{ site.github.url }}/filter) | ||
- [groupByType(children, types, rest)]({{ site.github.url }}/group-by-type) | ||
- [hasChildren(children)]({{ site.github.url }}/has-children) | ||
- [hasComplexChildren(children)]({{ site.github.url }}/has-complex-children) | ||
- [onlyText(children)]({{ site.github.url }}/only-text) |
import { ReactNode } from 'react'; | ||
export interface FilterFunction { | ||
(child: ReactNode, index?: number, children?: ReactNode[]): boolean; | ||
} | ||
export declare type FilterFunction = (child: ReactNode, index?: number, children?: ReactNode[]) => boolean; | ||
declare const deepFilter: (children: ReactNode, deepFilterFn: FilterFunction) => ReactNode[]; | ||
export default deepFilter; | ||
//# sourceMappingURL=deepFilter.d.ts.map |
import { ReactNode } from 'react'; | ||
export interface FindFunction { | ||
(child: ReactNode, index?: number, children?: ReactNode[]): ReactNode; | ||
} | ||
export declare type FindFunction = (child: ReactNode, index?: number, children?: ReactNode[]) => boolean; | ||
declare const deepFind: (children: ReactNode, deepFindFn: FindFunction) => ReactNode; | ||
export default deepFind; | ||
//# sourceMappingURL=deepFind.d.ts.map |
@@ -6,2 +6,6 @@ import { Children, isValidElement } from 'react'; | ||
Children.toArray(children).find((child) => { | ||
if (deepFindFn(child)) { | ||
found = child; | ||
return true; | ||
} | ||
if (isValidElement(child) && hasComplexChildren(child)) { | ||
@@ -12,6 +16,2 @@ // Find inside the child that has children | ||
} | ||
if (deepFindFn(child)) { | ||
found = child; | ||
return true; | ||
} | ||
return false; | ||
@@ -18,0 +18,0 @@ }); |
import { ReactNode } from 'react'; | ||
export interface ForEachFunction { | ||
(child: ReactNode, index?: number, children?: ReactNode[]): void; | ||
} | ||
export declare type ForEachFunction = (child: ReactNode, index?: number, children?: ReactNode[]) => void; | ||
declare const deepForEach: (children: ReactNode, deepForEachFn: ForEachFunction) => void; | ||
export default deepForEach; | ||
//# sourceMappingURL=deepForEach.d.ts.map |
import { ReactNode } from 'react'; | ||
export interface MapFunction { | ||
(child: ReactNode, index?: number, children?: ReactNode[]): ReactNode; | ||
} | ||
export declare type MapFunction = (child: ReactNode, index?: number, children?: ReactNode[]) => ReactNode; | ||
declare const deepMap: (children: ReactNode, deepMapFn: MapFunction) => ReactNode[]; | ||
export default deepMap; | ||
//# sourceMappingURL=deepMap.d.ts.map |
import { ReactNode } from 'react'; | ||
export interface FilterFunction { | ||
(child: ReactNode, index?: number, children?: ReactNode[]): boolean; | ||
} | ||
declare type FilterFunction = (child: ReactNode, index?: number, children?: ReactNode[]) => boolean; | ||
declare const filter: (children: ReactNode, filterFn: FilterFunction) => ReactNode[]; | ||
export default filter; | ||
//# sourceMappingURL=filter.d.ts.map |
@@ -5,8 +5,10 @@ import { Children, isValidElement } from 'react'; | ||
const newGroups = Object.assign({}, groups); | ||
let key = rest; | ||
if (isValidElement(child) && typeof child.type === 'string' && types.includes(child.type)) { | ||
newGroups[child.type] = [...(newGroups[child.type] || []), child]; | ||
key = child.type; | ||
} | ||
else { | ||
newGroups[rest] = [...(newGroups[rest] || []), child]; | ||
if (typeof newGroups[key] === 'undefined') { | ||
newGroups[key] = []; | ||
} | ||
newGroups[key] = [...newGroups[key], child]; | ||
return newGroups; | ||
@@ -13,0 +15,0 @@ }, {}); |
{ | ||
"name": "react-children-utilities", | ||
"version": "2.0.0-rc.0", | ||
"version": "2.0.0-rc.1", | ||
"description": "Extended utils for React.Children opaque data structure", | ||
@@ -53,3 +53,3 @@ "keywords": [ | ||
"@types/enzyme-adapter-react-16": "^1.0.5", | ||
"@types/jest": "^24.0.20", | ||
"@types/jest": "^24.0.21", | ||
"@types/react": "^16.9.11", | ||
@@ -74,3 +74,3 @@ "@types/react-dom": "^16.9.3", | ||
"eslint-plugin-react-hooks": "^2.2.0", | ||
"flow-bin": "^0.110.1", | ||
"flow-bin": "^0.111.1", | ||
"flowgen": "^1.10.0", | ||
@@ -90,3 +90,3 @@ "husky": "^3.0.9", | ||
"react-test-renderer": "^16.11.0", | ||
"rollup": "^1.26.0", | ||
"rollup": "^1.26.2", | ||
"rollup-plugin-terser": "^5.1.2", | ||
@@ -93,0 +93,0 @@ "ts-jest": "^24.1.0", |
@@ -17,3 +17,3 @@ /// <reference types="react" /> | ||
deepMap: (children: import("react").ReactNode, deepMapFn: import("./lib/deepMap").MapFunction) => import("react").ReactNode[]; | ||
filter: (children: import("react").ReactNode, filterFn: import("./lib/filter").FilterFunction) => import("react").ReactNode[]; | ||
filter: (children: import("react").ReactNode, filterFn: (child: import("react").ReactNode, index?: number | undefined, children?: import("react").ReactNode[] | undefined) => boolean) => import("react").ReactNode[]; | ||
groupByType: (children: import("react").ReactNode, types?: import("react").ReactNode[], rest?: string) => import("./lib/groupByType").GroupedChildren; | ||
@@ -20,0 +20,0 @@ hasChildren: (element: import("react").ReactNode) => boolean; |
@@ -1,2 +0,2 @@ | ||
import{isValidElement as e,Children as t,cloneElement as r}from"react";const o=t=>e(t)&&Boolean(t.t.children),n=r=>e(r)&&o(r)&&t.toArray(r.t.children).reduce((t,r)=>t||e(r),!1),l=(o,c)=>t.toArray(o).filter(c).map(t=>e(t)&&n(t)?r(t,Object.assign(Object.assign({},t.t),{children:l(t.t.children,c)})):t),c=(r,o)=>{let l;return t.toArray(r).find(t=>e(t)&&n(t)?void 0!==(l=c(t.t.children,o)):!!o(t)&&(l=t,!0)),l},p=(r,o)=>{t.forEach(r,t=>{e(t)&&n(t)&&p(t.t.children,o),o(t)})},a=(o,l)=>t.map(o,t=>e(t)&&n(t)?l(r(t,Object.assign(Object.assign({},t.t),{children:a(t.t.children,l)}))):l(t)),d=(e,r)=>t.toArray(e).filter(r),i=(r,o=[],n="rest")=>t.toArray(r).reduce((t,r)=>{const l=Object.assign({},t);return e(r)&&"string"==typeof r.type&&o.includes(r.type)?l[r.type]=[...l[r.type]||[],r]:l[n]=[...l[n]||[],r],l},{}),b=e=>null==e||"boolean"==typeof e?"":e.toString(),h=r=>r instanceof Array||e(r)?t.toArray(r).reduce((t,r)=>{let n;return n=e(r)&&o(r)?h(r.t.children):b(r),t.concat(n)},""):b(r);var j=Object.assign(Object.assign({},t),{o:l,l:c,p:p,i:a,filter:d,h:i,j:o,s:n,O:h});export default j;export{l as deepFilter,c as deepFind,p as deepForEach,a as deepMap,d as filter,i as groupByType,o as hasChildren,n as hasComplexChildren,h as onlyText}; | ||
import{isValidElement as e,Children as t,cloneElement as r}from"react";const o=t=>e(t)&&Boolean(t.t.children),n=r=>e(r)&&o(r)&&t.toArray(r.t.children).reduce((t,r)=>t||e(r),!1),l=(o,c)=>t.toArray(o).filter(c).map(t=>e(t)&&n(t)?r(t,Object.assign(Object.assign({},t.t),{children:l(t.t.children,c)})):t),c=(r,o)=>{let l;return t.toArray(r).find(t=>o(t)?(l=t,!0):!(!e(t)||!n(t))&&void 0!==(l=c(t.t.children,o))),l},p=(r,o)=>{t.forEach(r,t=>{e(t)&&n(t)&&p(t.t.children,o),o(t)})},d=(o,l)=>t.map(o,t=>e(t)&&n(t)?l(r(t,Object.assign(Object.assign({},t.t),{children:d(t.t.children,l)}))):l(t)),i=(e,r)=>t.toArray(e).filter(r),a=(r,o=[],n="rest")=>t.toArray(r).reduce((t,r)=>{const l=Object.assign({},t);let c=n;return e(r)&&"string"==typeof r.type&&o.includes(r.type)&&(c=r.type),void 0===l[c]&&(l[c]=[]),l[c]=[...l[c],r],l},{}),b=e=>null==e||"boolean"==typeof e?"":e.toString(),h=r=>r instanceof Array||e(r)?t.toArray(r).reduce((t,r)=>{let n;return n=e(r)&&o(r)?h(r.t.children):b(r),t.concat(n)},""):b(r);var j=Object.assign(Object.assign({},t),{o:l,l:c,p:p,i:d,filter:i,h:a,j:o,s:n,O:h});export default j;export{l as deepFilter,c as deepFind,p as deepForEach,d as deepMap,i as filter,a as groupByType,o as hasChildren,n as hasComplexChildren,h as onlyText}; | ||
//# sourceMappingURL=react-children-utilities.min.js.map |
@@ -10,6 +10,4 @@ # React Children Utilities | ||
[![npm downloads][badge-downloads]][url-downloads] | ||
[![peerDependency Status][badge-deps-peer]][url-deps-peer] | ||
[![devDependency Status][badge-deps-dev]][url-deps-dev] | ||
[badge-size]: http://img.badgesize.io/https://unpkg.com/react-children-utilities?compression=gzip | ||
[badge-size]: http://img.badgesize.io/https://unpkg.com/react-children-utilities/react-children-utilities.min.js?compression=gzip | ||
[badge-ci]: https://circleci.com/gh/fernandopasik/react-children-utilities.svg?style=svg | ||
@@ -20,5 +18,3 @@ [badge-cov]: https://codecov.io/gh/fernandopasik/react-children-utilities/branch/master/graph/badge.svg | ||
[badge-downloads]: https://img.shields.io/npm/dm/react-children-utilities.svg | ||
[badge-deps-peer]: https://david-dm.org/fernandopasik/react-children-utilities/peer-status.svg | ||
[badge-deps-dev]: https://david-dm.org/fernandopasik/react-children-utilities/dev-status.svg | ||
[url-size]: https://unpkg.com/react-children-utilities 'Gzip Bundle Size' | ||
[url-size]: https://unpkg.com/react-children-utilities/react-children-utilities.min.js 'Gzip Bundle Size' | ||
[url-ci]: https://circleci.com/gh/fernandopasik/react-children-utilities 'Build Status' | ||
@@ -29,4 +25,2 @@ [url-cov]: https://codecov.io/gh/fernandopasik/react-children-utilities 'Test Coverage Status' | ||
[url-downloads]: https://www.npmjs.com/package/react-children-utilities 'npm downloads' | ||
[url-deps-peer]: https://david-dm.org/fernandopasik/react-children-utilities?type=peer 'Peer Dependency Status' | ||
[url-deps-dev]: https://david-dm.org/fernandopasik/react-children-utilities?type=dev 'Dev Dependency Status' | ||
@@ -33,0 +27,0 @@ Extended utils for React.Children opaque data structure. |
import { Children, cloneElement, isValidElement, ReactNode } from 'react'; | ||
import hasComplexChildren from './hasComplexChildren'; | ||
export interface FilterFunction { | ||
(child: ReactNode, index?: number, children?: ReactNode[]): boolean; | ||
} | ||
export type FilterFunction = (child: ReactNode, index?: number, children?: ReactNode[]) => boolean; | ||
@@ -8,0 +6,0 @@ const deepFilter = (children: ReactNode, deepFilterFn: FilterFunction): ReactNode[] => { |
import { Children, isValidElement, ReactNode } from 'react'; | ||
import hasComplexChildren from './hasComplexChildren'; | ||
export interface FindFunction { | ||
(child: ReactNode, index?: number, children?: ReactNode[]): ReactNode; | ||
} | ||
export type FindFunction = (child: ReactNode, index?: number, children?: ReactNode[]) => boolean; | ||
@@ -12,2 +10,7 @@ const deepFind = (children: ReactNode, deepFindFn: FindFunction): ReactNode | undefined => { | ||
Children.toArray(children).find((child: ReactNode) => { | ||
if (deepFindFn(child)) { | ||
found = child; | ||
return true; | ||
} | ||
if (isValidElement(child) && hasComplexChildren(child)) { | ||
@@ -19,7 +22,2 @@ // Find inside the child that has children | ||
if (deepFindFn(child)) { | ||
found = child; | ||
return true; | ||
} | ||
return false; | ||
@@ -26,0 +24,0 @@ }); |
import { Children, isValidElement, ReactNode } from 'react'; | ||
import hasComplexChildren from './hasComplexChildren'; | ||
export interface ForEachFunction { | ||
(child: ReactNode, index?: number, children?: ReactNode[]): void; | ||
} | ||
export type ForEachFunction = (child: ReactNode, index?: number, children?: ReactNode[]) => void; | ||
@@ -8,0 +6,0 @@ const deepForEach = (children: ReactNode, deepForEachFn: ForEachFunction): void => { |
import { Children, cloneElement, isValidElement, ReactNode } from 'react'; | ||
import hasComplexChildren from './hasComplexChildren'; | ||
export interface MapFunction { | ||
(child: ReactNode, index?: number, children?: ReactNode[]): ReactNode; | ||
} | ||
export type MapFunction = (child: ReactNode, index?: number, children?: ReactNode[]) => ReactNode; | ||
@@ -8,0 +6,0 @@ const deepMap = (children: ReactNode, deepMapFn: MapFunction): ReactNode[] => { |
import { Children, ReactNode } from 'react'; | ||
export interface FilterFunction { | ||
(child: ReactNode, index?: number, children?: ReactNode[]): boolean; | ||
} | ||
type FilterFunction = (child: ReactNode, index?: number, children?: ReactNode[]) => boolean; | ||
@@ -7,0 +5,0 @@ const filter = (children: ReactNode, filterFn: FilterFunction): ReactNode[] => { |
@@ -14,9 +14,14 @@ import { Children, isValidElement, ReactNode } from 'react'; | ||
const newGroups = { ...groups }; | ||
let key = rest; | ||
if (isValidElement(child) && typeof child.type === 'string' && types.includes(child.type)) { | ||
newGroups[child.type] = [...(newGroups[child.type] || []), child]; | ||
} else { | ||
newGroups[rest] = [...(newGroups[rest] || []), child]; | ||
key = child.type; | ||
} | ||
if (typeof newGroups[key] === 'undefined') { | ||
newGroups[key] = []; | ||
} | ||
newGroups[key] = [...newGroups[key], child]; | ||
return newGroups; | ||
@@ -23,0 +28,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
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
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
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
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
879685
1841
79