Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@polaritybit/use-form

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polaritybit/use-form - npm Package Compare versions

Comparing version 1.1.5 to 1.2.0

4

coverage/coverage-final.json

@@ -1,3 +0,3 @@

{"/home/gianmarcotoso/Developer/projects/use-form/src/use-form.hook.ts": {"path":"/home/gianmarcotoso/Developer/projects/use-form/src/use-form.hook.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":68}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":67}},"2":{"start":{"line":40,"column":21},"end":{"line":40,"column":35}},"3":{"start":{"line":41,"column":18},"end":{"line":41,"column":39}},"4":{"start":{"line":43,"column":16},"end":{"line":43,"column":40}},"5":{"start":{"line":45,"column":1},"end":{"line":45,"column":null}},"6":{"start":{"line":49,"column":16},"end":{"line":49,"column":48}},"7":{"start":{"line":50,"column":15},"end":{"line":50,"column":73}},"8":{"start":{"line":52,"column":1},"end":{"line":52,"column":null}},"9":{"start":{"line":61,"column":15},"end":{"line":61,"column":48}},"10":{"start":{"line":62,"column":1},"end":{"line":66,"column":null}},"11":{"start":{"line":63,"column":2},"end":{"line":63,"column":null}},"12":{"start":{"line":65,"column":2},"end":{"line":65,"column":8}},"13":{"start":{"line":68,"column":1},"end":{"line":72,"column":null}},"14":{"start":{"line":69,"column":2},"end":{"line":69,"column":null}},"15":{"start":{"line":71,"column":2},"end":{"line":71,"column":8}},"16":{"start":{"line":74,"column":1},"end":{"line":74,"column":null}},"17":{"start":{"line":78,"column":25},"end":{"line":78,"column":84}},"18":{"start":{"line":80,"column":22},"end":{"line":96,"column":7}},"19":{"start":{"line":81,"column":2},"end":{"line":84,"column":null}},"20":{"start":{"line":82,"column":3},"end":{"line":82,"column":null}},"21":{"start":{"line":83,"column":3},"end":{"line":83,"column":9}},"22":{"start":{"line":86,"column":2},"end":{"line":95,"column":null}},"23":{"start":{"line":87,"column":3},"end":{"line":89,"column":null}},"24":{"start":{"line":88,"column":4},"end":{"line":88,"column":null}},"25":{"start":{"line":91,"column":18},"end":{"line":91,"column":63}},"26":{"start":{"line":92,"column":3},"end":{"line":92,"column":null}},"27":{"start":{"line":94,"column":3},"end":{"line":94,"column":null}},"28":{"start":{"line":98,"column":22},"end":{"line":102,"column":null}},"29":{"start":{"line":100,"column":3},"end":{"line":100,"column":null}},"30":{"start":{"line":105,"column":1},"end":{"line":105,"column":null}},"31":{"start":{"line":77,"column":0},"end":{"line":77,"column":16}},"32":{"start":{"line":112,"column":38},"end":{"line":114,"column":11}},"33":{"start":{"line":113,"column":2},"end":{"line":113,"column":null}},"34":{"start":{"line":116,"column":22},"end":{"line":120,"column":null}},"35":{"start":{"line":118,"column":3},"end":{"line":118,"column":null}},"36":{"start":{"line":123,"column":22},"end":{"line":127,"column":null}},"37":{"start":{"line":125,"column":3},"end":{"line":125,"column":null}},"38":{"start":{"line":130,"column":1},"end":{"line":130,"column":null}},"39":{"start":{"line":108,"column":0},"end":{"line":108,"column":16}},"40":{"start":{"line":151,"column":26},"end":{"line":151,"column":30}},"41":{"start":{"line":152,"column":27},"end":{"line":154,"column":16}},"42":{"start":{"line":153,"column":2},"end":{"line":153,"column":null}},"43":{"start":{"line":157,"column":23},"end":{"line":157,"column":46}},"44":{"start":{"line":159,"column":2},"end":{"line":159,"column":null}},"45":{"start":{"line":163,"column":23},"end":{"line":163,"column":85}},"46":{"start":{"line":163,"column":50},"end":{"line":163,"column":84}},"47":{"start":{"line":165,"column":2},"end":{"line":165,"column":null}},"48":{"start":{"line":169,"column":23},"end":{"line":179,"column":4}},"49":{"start":{"line":170,"column":3},"end":{"line":176,"column":null}},"50":{"start":{"line":171,"column":4},"end":{"line":173,"column":null}},"51":{"start":{"line":172,"column":5},"end":{"line":172,"column":null}},"52":{"start":{"line":175,"column":4},"end":{"line":175,"column":null}},"53":{"start":{"line":178,"column":3},"end":{"line":178,"column":null}},"54":{"start":{"line":181,"column":2},"end":{"line":181,"column":null}},"55":{"start":{"line":185,"column":2},"end":{"line":185,"column":null}},"56":{"start":{"line":188,"column":1},"end":{"line":188,"column":null}},"57":{"start":{"line":146,"column":0},"end":{"line":146,"column":16}}},"fnMap":{"0":{"name":"UpdateOnPathAndValue","decl":{"start":{"line":39,"column":9},"end":{"line":39,"column":29}},"loc":{"start":{"line":39,"column":114},"end":{"line":46,"column":1}}},"1":{"name":"UpdateOnEvent","decl":{"start":{"line":48,"column":9},"end":{"line":48,"column":22}},"loc":{"start":{"line":48,"column":83},"end":{"line":53,"column":1}}},"2":{"name":"Update","decl":{"start":{"line":55,"column":9},"end":{"line":55,"column":15}},"loc":{"start":{"line":59,"column":18},"end":{"line":75,"column":1}}},"3":{"name":"useForm","decl":{"start":{"line":77,"column":16},"end":{"line":77,"column":23}},"loc":{"start":{"line":77,"column":108},"end":{"line":106,"column":1}}},"4":{"name":"(anonymous_4)","decl":{"start":{"line":80,"column":34},"end":{"line":80,"column":35}},"loc":{"start":{"line":80,"column":79},"end":{"line":96,"column":2}}},"5":{"name":"(anonymous_5)","decl":{"start":{"line":86,"column":10},"end":{"line":86,"column":11}},"loc":{"start":{"line":86,"column":19},"end":{"line":95,"column":3}}},"6":{"name":"handleChange","decl":{"start":{"line":99,"column":11},"end":{"line":99,"column":23}},"loc":{"start":{"line":99,"column":88},"end":{"line":101,"column":3}}},"7":{"name":"useNestedForm","decl":{"start":{"line":108,"column":16},"end":{"line":108,"column":29}},"loc":{"start":{"line":110,"column":7},"end":{"line":131,"column":1}}},"8":{"name":"(anonymous_8)","decl":{"start":{"line":112,"column":46},"end":{"line":112,"column":49}},"loc":{"start":{"line":112,"column":51},"end":{"line":114,"column":2}}},"9":{"name":"(anonymous_9)","decl":{"start":{"line":117,"column":2},"end":{"line":117,"column":3}},"loc":{"start":{"line":117,"column":47},"end":{"line":119,"column":3}}},"10":{"name":"handleChange","decl":{"start":{"line":124,"column":11},"end":{"line":124,"column":23}},"loc":{"start":{"line":124,"column":88},"end":{"line":126,"column":3}}},"11":{"name":"useFormList","decl":{"start":{"line":146,"column":16},"end":{"line":146,"column":27}},"loc":{"start":{"line":149,"column":29},"end":{"line":189,"column":1}}},"12":{"name":"(anonymous_12)","decl":{"start":{"line":152,"column":35},"end":{"line":152,"column":38}},"loc":{"start":{"line":152,"column":40},"end":{"line":154,"column":2}}},"13":{"name":"handleAddItem","decl":{"start":{"line":156,"column":10},"end":{"line":156,"column":23}},"loc":{"start":{"line":156,"column":44},"end":{"line":160,"column":2}}},"14":{"name":"handleRemoveItem","decl":{"start":{"line":162,"column":10},"end":{"line":162,"column":26}},"loc":{"start":{"line":162,"column":34},"end":{"line":166,"column":2}}},"15":{"name":"(anonymous_15)","decl":{"start":{"line":163,"column":43},"end":{"line":163,"column":44}},"loc":{"start":{"line":163,"column":50},"end":{"line":163,"column":84}}},"16":{"name":"handleUpdateItem","decl":{"start":{"line":168,"column":10},"end":{"line":168,"column":26}},"loc":{"start":{"line":168,"column":76},"end":{"line":182,"column":2}}},"17":{"name":"(anonymous_17)","decl":{"start":{"line":169,"column":40},"end":{"line":169,"column":41}},"loc":{"start":{"line":169,"column":46},"end":{"line":179,"column":3}}},"18":{"name":"handleChange","decl":{"start":{"line":184,"column":10},"end":{"line":184,"column":22}},"loc":{"start":{"line":184,"column":96},"end":{"line":186,"column":2}}}},"branchMap":{"0":{"loc":{"start":{"line":50,"column":44},"end":{"line":50,"column":58}},"type":"cond-expr","locations":[{"start":{"line":50,"column":44},"end":{"line":50,"column":58}},{"start":{"line":50,"column":61},"end":{"line":50,"column":73}}]},"1":{"loc":{"start":{"line":62,"column":1},"end":{"line":66,"column":null}},"type":"if","locations":[{"start":{"line":62,"column":1},"end":{"line":66,"column":null}},{"start":{"line":62,"column":1},"end":{"line":66,"column":null}}]},"2":{"loc":{"start":{"line":62,"column":10},"end":{"line":62,"column":12}},"type":"cond-expr","locations":[{"start":{"line":62,"column":10},"end":{"line":62,"column":12}},{"start":{"line":62,"column":5},"end":{"line":62,"column":23}}]},"3":{"loc":{"start":{"line":62,"column":5},"end":{"line":62,"column":12}},"type":"binary-expr","locations":[{"start":{"line":62,"column":5},"end":{"line":62,"column":12}},{"start":{"line":62,"column":5},"end":{"line":62,"column":12}}]},"4":{"loc":{"start":{"line":68,"column":1},"end":{"line":72,"column":null}},"type":"if","locations":[{"start":{"line":68,"column":1},"end":{"line":72,"column":null}},{"start":{"line":68,"column":1},"end":{"line":72,"column":null}}]},"5":{"loc":{"start":{"line":68,"column":5},"end":{"line":68,"column":43}},"type":"binary-expr","locations":[{"start":{"line":68,"column":5},"end":{"line":68,"column":43}},{"start":{"line":68,"column":47},"end":{"line":68,"column":84}}]},"6":{"loc":{"start":{"line":77,"column":58},"end":{"line":77,"column":60}},"type":"default-arg","locations":[{"start":{"line":77,"column":58},"end":{"line":77,"column":60}}]},"7":{"loc":{"start":{"line":77,"column":100},"end":{"line":77,"column":108}},"type":"default-arg","locations":[{"start":{"line":77,"column":100},"end":{"line":77,"column":108}}]},"8":{"loc":{"start":{"line":81,"column":2},"end":{"line":84,"column":null}},"type":"if","locations":[{"start":{"line":81,"column":2},"end":{"line":84,"column":null}},{"start":{"line":81,"column":2},"end":{"line":84,"column":null}}]},"9":{"loc":{"start":{"line":81,"column":6},"end":{"line":81,"column":20}},"type":"binary-expr","locations":[{"start":{"line":81,"column":6},"end":{"line":81,"column":20}},{"start":{"line":81,"column":24},"end":{"line":81,"column":31}}]},"10":{"loc":{"start":{"line":87,"column":3},"end":{"line":89,"column":null}},"type":"if","locations":[{"start":{"line":87,"column":3},"end":{"line":89,"column":null}},{"start":{"line":87,"column":3},"end":{"line":89,"column":null}}]},"11":{"loc":{"start":{"line":113,"column":47},"end":{"line":113,"column":51}},"type":"cond-expr","locations":[{"start":{"line":113,"column":47},"end":{"line":113,"column":51}},{"start":{"line":113,"column":51},"end":{"line":113,"column":53}}]},"12":{"loc":{"start":{"line":113,"column":9},"end":{"line":113,"column":51}},"type":"binary-expr","locations":[{"start":{"line":113,"column":9},"end":{"line":113,"column":51}},{"start":{"line":113,"column":47},"end":{"line":113,"column":51}}]},"13":{"loc":{"start":{"line":153,"column":47},"end":{"line":153,"column":51}},"type":"cond-expr","locations":[{"start":{"line":153,"column":47},"end":{"line":153,"column":51}},{"start":{"line":153,"column":51},"end":{"line":153,"column":53}}]},"14":{"loc":{"start":{"line":153,"column":9},"end":{"line":153,"column":51}},"type":"binary-expr","locations":[{"start":{"line":153,"column":9},"end":{"line":153,"column":51}},{"start":{"line":153,"column":47},"end":{"line":153,"column":51}}]},"15":{"loc":{"start":{"line":170,"column":3},"end":{"line":176,"column":null}},"type":"if","locations":[{"start":{"line":170,"column":3},"end":{"line":176,"column":null}},{"start":{"line":170,"column":3},"end":{"line":176,"column":null}}]},"16":{"loc":{"start":{"line":171,"column":4},"end":{"line":173,"column":null}},"type":"if","locations":[{"start":{"line":171,"column":4},"end":{"line":173,"column":null}},{"start":{"line":171,"column":4},"end":{"line":173,"column":null}}]},"17":{"loc":{"start":{"line":171,"column":8},"end":{"line":171,"column":29}},"type":"binary-expr","locations":[{"start":{"line":171,"column":8},"end":{"line":171,"column":29}},{"start":{"line":171,"column":33},"end":{"line":171,"column":41}}]}},"s":{"0":1,"1":1,"2":13,"3":13,"4":13,"5":13,"6":2,"7":2,"8":2,"9":22,"10":22,"11":2,"12":2,"13":20,"14":11,"15":11,"16":9,"17":41,"18":41,"19":19,"20":1,"21":1,"22":18,"23":18,"24":2,"25":16,"26":16,"27":16,"28":41,"29":19,"30":41,"31":1,"32":2,"33":2,"34":2,"35":1,"36":2,"37":1,"38":2,"39":1,"40":15,"41":15,"42":15,"43":2,"44":2,"45":2,"46":2,"47":2,"48":2,"49":3,"50":2,"51":1,"52":1,"53":1,"54":2,"55":2,"56":15,"57":1},"f":{"0":13,"1":2,"2":22,"3":41,"4":19,"5":18,"6":19,"7":2,"8":2,"9":1,"10":1,"11":15,"12":15,"13":2,"14":2,"15":2,"16":2,"17":3,"18":2},"b":{"0":[1,1],"1":[2,20],"2":[2,20],"3":[22,20],"4":[11,9],"5":[20,12],"6":[3],"7":[38],"8":[1,18],"9":[19,2],"10":[2,16],"11":[1,1],"12":[2,2],"13":[14,1],"14":[15,15],"15":[2,1],"16":[1,1],"17":[2,1]}}
,"/home/gianmarcotoso/Developer/projects/use-form/src/value.function.ts": {"path":"/home/gianmarcotoso/Developer/projects/use-form/src/value.function.ts","statementMap":{"0":{"start":{"line":2,"column":1},"end":{"line":2,"column":null}},"1":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}},"fnMap":{"0":{"name":"value","decl":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}},"loc":{"start":{"line":1,"column":32},"end":{"line":3,"column":1}}}},"branchMap":{"0":{"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":13}},"type":"cond-expr","locations":[{"start":{"line":2,"column":8},"end":{"line":2,"column":13}},{"start":{"line":2,"column":17},"end":{"line":2,"column":19}}]},"1":{"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":17}},"type":"binary-expr","locations":[{"start":{"line":2,"column":8},"end":{"line":2,"column":17}},{"start":{"line":2,"column":8},"end":{"line":2,"column":17}}]}},"s":{"0":2,"1":1},"f":{"0":2},"b":{"0":[1,1],"1":[2,2]}}
{"/home/gianmarcotoso/Developer/projects/use-form/src/use-form.hook.ts": {"path":"/home/gianmarcotoso/Developer/projects/use-form/src/use-form.hook.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":68}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":67}},"3":{"start":{"line":41,"column":21},"end":{"line":41,"column":35}},"4":{"start":{"line":42,"column":18},"end":{"line":42,"column":39}},"5":{"start":{"line":44,"column":16},"end":{"line":44,"column":40}},"6":{"start":{"line":46,"column":1},"end":{"line":46,"column":null}},"7":{"start":{"line":50,"column":16},"end":{"line":50,"column":48}},"8":{"start":{"line":51,"column":15},"end":{"line":51,"column":73}},"9":{"start":{"line":53,"column":1},"end":{"line":53,"column":null}},"10":{"start":{"line":62,"column":15},"end":{"line":62,"column":48}},"11":{"start":{"line":63,"column":1},"end":{"line":67,"column":null}},"12":{"start":{"line":64,"column":2},"end":{"line":64,"column":null}},"13":{"start":{"line":66,"column":2},"end":{"line":66,"column":8}},"14":{"start":{"line":69,"column":1},"end":{"line":73,"column":null}},"15":{"start":{"line":70,"column":2},"end":{"line":70,"column":null}},"16":{"start":{"line":72,"column":2},"end":{"line":72,"column":8}},"17":{"start":{"line":75,"column":1},"end":{"line":75,"column":null}},"18":{"start":{"line":79,"column":25},"end":{"line":79,"column":84}},"19":{"start":{"line":81,"column":22},"end":{"line":97,"column":7}},"20":{"start":{"line":82,"column":2},"end":{"line":85,"column":null}},"21":{"start":{"line":83,"column":3},"end":{"line":83,"column":null}},"22":{"start":{"line":84,"column":3},"end":{"line":84,"column":9}},"23":{"start":{"line":87,"column":2},"end":{"line":96,"column":null}},"24":{"start":{"line":88,"column":3},"end":{"line":90,"column":null}},"25":{"start":{"line":89,"column":4},"end":{"line":89,"column":null}},"26":{"start":{"line":92,"column":18},"end":{"line":92,"column":63}},"27":{"start":{"line":93,"column":3},"end":{"line":93,"column":null}},"28":{"start":{"line":95,"column":3},"end":{"line":95,"column":null}},"29":{"start":{"line":99,"column":22},"end":{"line":103,"column":null}},"30":{"start":{"line":101,"column":3},"end":{"line":101,"column":null}},"31":{"start":{"line":106,"column":1},"end":{"line":106,"column":null}},"32":{"start":{"line":78,"column":0},"end":{"line":78,"column":16}},"33":{"start":{"line":113,"column":38},"end":{"line":115,"column":11}},"34":{"start":{"line":114,"column":2},"end":{"line":114,"column":null}},"35":{"start":{"line":117,"column":22},"end":{"line":121,"column":null}},"36":{"start":{"line":119,"column":3},"end":{"line":119,"column":null}},"37":{"start":{"line":124,"column":22},"end":{"line":128,"column":null}},"38":{"start":{"line":126,"column":3},"end":{"line":126,"column":null}},"39":{"start":{"line":131,"column":1},"end":{"line":131,"column":null}},"40":{"start":{"line":109,"column":0},"end":{"line":109,"column":16}},"41":{"start":{"line":152,"column":26},"end":{"line":152,"column":30}},"42":{"start":{"line":153,"column":27},"end":{"line":155,"column":16}},"43":{"start":{"line":154,"column":2},"end":{"line":154,"column":null}},"44":{"start":{"line":158,"column":23},"end":{"line":160,"column":4}},"45":{"start":{"line":159,"column":3},"end":{"line":159,"column":null}},"46":{"start":{"line":162,"column":2},"end":{"line":162,"column":null}},"47":{"start":{"line":166,"column":23},"end":{"line":173,"column":4}},"48":{"start":{"line":167,"column":17},"end":{"line":167,"column":80}},"49":{"start":{"line":167,"column":40},"end":{"line":167,"column":79}},"50":{"start":{"line":168,"column":3},"end":{"line":170,"column":null}},"51":{"start":{"line":169,"column":4},"end":{"line":169,"column":10}},"52":{"start":{"line":172,"column":3},"end":{"line":172,"column":null}},"53":{"start":{"line":175,"column":2},"end":{"line":175,"column":null}},"54":{"start":{"line":179,"column":23},"end":{"line":198,"column":4}},"55":{"start":{"line":180,"column":17},"end":{"line":180,"column":80}},"56":{"start":{"line":180,"column":40},"end":{"line":180,"column":79}},"57":{"start":{"line":182,"column":3},"end":{"line":184,"column":null}},"58":{"start":{"line":183,"column":4},"end":{"line":183,"column":10}},"59":{"start":{"line":186,"column":3},"end":{"line":189,"column":null}},"60":{"start":{"line":187,"column":4},"end":{"line":187,"column":null}},"61":{"start":{"line":188,"column":4},"end":{"line":188,"column":10}},"62":{"start":{"line":191,"column":3},"end":{"line":194,"column":null}},"63":{"start":{"line":192,"column":4},"end":{"line":192,"column":null}},"64":{"start":{"line":193,"column":4},"end":{"line":193,"column":10}},"65":{"start":{"line":197,"column":3},"end":{"line":197,"column":null}},"66":{"start":{"line":200,"column":2},"end":{"line":200,"column":null}},"67":{"start":{"line":204,"column":2},"end":{"line":204,"column":null}},"68":{"start":{"line":207,"column":1},"end":{"line":207,"column":null}},"69":{"start":{"line":147,"column":0},"end":{"line":147,"column":16}}},"fnMap":{"0":{"name":"UpdateOnPathAndValue","decl":{"start":{"line":40,"column":9},"end":{"line":40,"column":29}},"loc":{"start":{"line":40,"column":114},"end":{"line":47,"column":1}}},"1":{"name":"UpdateOnEvent","decl":{"start":{"line":49,"column":9},"end":{"line":49,"column":22}},"loc":{"start":{"line":49,"column":83},"end":{"line":54,"column":1}}},"2":{"name":"Update","decl":{"start":{"line":56,"column":9},"end":{"line":56,"column":15}},"loc":{"start":{"line":60,"column":18},"end":{"line":76,"column":1}}},"3":{"name":"useForm","decl":{"start":{"line":78,"column":16},"end":{"line":78,"column":23}},"loc":{"start":{"line":78,"column":108},"end":{"line":107,"column":1}}},"4":{"name":"(anonymous_5)","decl":{"start":{"line":81,"column":34},"end":{"line":81,"column":35}},"loc":{"start":{"line":81,"column":79},"end":{"line":97,"column":2}}},"5":{"name":"(anonymous_6)","decl":{"start":{"line":87,"column":10},"end":{"line":87,"column":11}},"loc":{"start":{"line":87,"column":19},"end":{"line":96,"column":3}}},"6":{"name":"handleChange","decl":{"start":{"line":100,"column":11},"end":{"line":100,"column":23}},"loc":{"start":{"line":100,"column":88},"end":{"line":102,"column":3}}},"7":{"name":"useNestedForm","decl":{"start":{"line":109,"column":16},"end":{"line":109,"column":29}},"loc":{"start":{"line":111,"column":7},"end":{"line":132,"column":1}}},"8":{"name":"(anonymous_9)","decl":{"start":{"line":113,"column":46},"end":{"line":113,"column":49}},"loc":{"start":{"line":113,"column":51},"end":{"line":115,"column":2}}},"9":{"name":"(anonymous_10)","decl":{"start":{"line":118,"column":2},"end":{"line":118,"column":3}},"loc":{"start":{"line":118,"column":47},"end":{"line":120,"column":3}}},"10":{"name":"handleChange","decl":{"start":{"line":125,"column":11},"end":{"line":125,"column":23}},"loc":{"start":{"line":125,"column":88},"end":{"line":127,"column":3}}},"11":{"name":"useFormList","decl":{"start":{"line":147,"column":16},"end":{"line":147,"column":27}},"loc":{"start":{"line":150,"column":29},"end":{"line":208,"column":1}}},"12":{"name":"(anonymous_13)","decl":{"start":{"line":153,"column":35},"end":{"line":153,"column":38}},"loc":{"start":{"line":153,"column":40},"end":{"line":155,"column":2}}},"13":{"name":"handleAddItem","decl":{"start":{"line":157,"column":10},"end":{"line":157,"column":23}},"loc":{"start":{"line":157,"column":44},"end":{"line":163,"column":2}}},"14":{"name":"(anonymous_15)","decl":{"start":{"line":158,"column":50},"end":{"line":158,"column":51}},"loc":{"start":{"line":158,"column":60},"end":{"line":160,"column":3}}},"15":{"name":"handleRemoveItem","decl":{"start":{"line":165,"column":10},"end":{"line":165,"column":26}},"loc":{"start":{"line":165,"column":34},"end":{"line":176,"column":2}}},"16":{"name":"(anonymous_17)","decl":{"start":{"line":166,"column":50},"end":{"line":166,"column":51}},"loc":{"start":{"line":166,"column":60},"end":{"line":173,"column":3}}},"17":{"name":"(anonymous_18)","decl":{"start":{"line":167,"column":33},"end":{"line":167,"column":34}},"loc":{"start":{"line":167,"column":40},"end":{"line":167,"column":79}}},"18":{"name":"handleUpdateItem","decl":{"start":{"line":178,"column":10},"end":{"line":178,"column":26}},"loc":{"start":{"line":178,"column":76},"end":{"line":201,"column":2}}},"19":{"name":"(anonymous_20)","decl":{"start":{"line":179,"column":50},"end":{"line":179,"column":51}},"loc":{"start":{"line":179,"column":60},"end":{"line":198,"column":3}}},"20":{"name":"(anonymous_21)","decl":{"start":{"line":180,"column":33},"end":{"line":180,"column":34}},"loc":{"start":{"line":180,"column":40},"end":{"line":180,"column":79}}},"21":{"name":"handleChange","decl":{"start":{"line":203,"column":10},"end":{"line":203,"column":22}},"loc":{"start":{"line":203,"column":96},"end":{"line":205,"column":2}}}},"branchMap":{"0":{"loc":{"start":{"line":51,"column":15},"end":{"line":51,"column":73}},"type":"cond-expr","locations":[{"start":{"line":51,"column":44},"end":{"line":51,"column":58}},{"start":{"line":51,"column":61},"end":{"line":51,"column":73}}]},"1":{"loc":{"start":{"line":63,"column":1},"end":{"line":67,"column":null}},"type":"if","locations":[{"start":{"line":63,"column":1},"end":{"line":67,"column":null}},{"start":{"line":63,"column":1},"end":{"line":67,"column":null}}]},"2":{"loc":{"start":{"line":63,"column":5},"end":{"line":63,"column":23}},"type":"cond-expr","locations":[{"start":{"line":63,"column":10},"end":{"line":63,"column":12}},{"start":{"line":63,"column":5},"end":{"line":63,"column":23}}]},"3":{"loc":{"start":{"line":63,"column":5},"end":{"line":63,"column":12}},"type":"binary-expr","locations":[{"start":{"line":63,"column":5},"end":{"line":63,"column":12}},{"start":{"line":63,"column":5},"end":{"line":63,"column":12}}]},"4":{"loc":{"start":{"line":69,"column":1},"end":{"line":73,"column":null}},"type":"if","locations":[{"start":{"line":69,"column":1},"end":{"line":73,"column":null}},{"start":{"line":69,"column":1},"end":{"line":73,"column":null}}]},"5":{"loc":{"start":{"line":69,"column":5},"end":{"line":69,"column":84}},"type":"binary-expr","locations":[{"start":{"line":69,"column":5},"end":{"line":69,"column":43}},{"start":{"line":69,"column":47},"end":{"line":69,"column":84}}]},"6":{"loc":{"start":{"line":78,"column":27},"end":{"line":78,"column":60}},"type":"default-arg","locations":[{"start":{"line":78,"column":58},"end":{"line":78,"column":60}}]},"7":{"loc":{"start":{"line":78,"column":62},"end":{"line":78,"column":108}},"type":"default-arg","locations":[{"start":{"line":78,"column":100},"end":{"line":78,"column":108}}]},"8":{"loc":{"start":{"line":82,"column":2},"end":{"line":85,"column":null}},"type":"if","locations":[{"start":{"line":82,"column":2},"end":{"line":85,"column":null}},{"start":{"line":82,"column":2},"end":{"line":85,"column":null}}]},"9":{"loc":{"start":{"line":82,"column":6},"end":{"line":82,"column":31}},"type":"binary-expr","locations":[{"start":{"line":82,"column":6},"end":{"line":82,"column":20}},{"start":{"line":82,"column":24},"end":{"line":82,"column":31}}]},"10":{"loc":{"start":{"line":88,"column":3},"end":{"line":90,"column":null}},"type":"if","locations":[{"start":{"line":88,"column":3},"end":{"line":90,"column":null}},{"start":{"line":88,"column":3},"end":{"line":90,"column":null}}]},"11":{"loc":{"start":{"line":114,"column":9},"end":{"line":114,"column":53}},"type":"cond-expr","locations":[{"start":{"line":114,"column":47},"end":{"line":114,"column":51}},{"start":{"line":114,"column":51},"end":{"line":114,"column":53}}]},"12":{"loc":{"start":{"line":114,"column":9},"end":{"line":114,"column":51}},"type":"binary-expr","locations":[{"start":{"line":114,"column":9},"end":{"line":114,"column":51}},{"start":{"line":114,"column":47},"end":{"line":114,"column":51}}]},"13":{"loc":{"start":{"line":154,"column":9},"end":{"line":154,"column":53}},"type":"cond-expr","locations":[{"start":{"line":154,"column":47},"end":{"line":154,"column":51}},{"start":{"line":154,"column":51},"end":{"line":154,"column":53}}]},"14":{"loc":{"start":{"line":154,"column":9},"end":{"line":154,"column":51}},"type":"binary-expr","locations":[{"start":{"line":154,"column":9},"end":{"line":154,"column":51}},{"start":{"line":154,"column":47},"end":{"line":154,"column":51}}]},"15":{"loc":{"start":{"line":168,"column":3},"end":{"line":170,"column":null}},"type":"if","locations":[{"start":{"line":168,"column":3},"end":{"line":170,"column":null}},{"start":{"line":168,"column":3},"end":{"line":170,"column":null}}]},"16":{"loc":{"start":{"line":182,"column":3},"end":{"line":184,"column":null}},"type":"if","locations":[{"start":{"line":182,"column":3},"end":{"line":184,"column":null}},{"start":{"line":182,"column":3},"end":{"line":184,"column":null}}]},"17":{"loc":{"start":{"line":186,"column":3},"end":{"line":189,"column":null}},"type":"if","locations":[{"start":{"line":186,"column":3},"end":{"line":189,"column":null}},{"start":{"line":186,"column":3},"end":{"line":189,"column":null}}]},"18":{"loc":{"start":{"line":191,"column":3},"end":{"line":194,"column":null}},"type":"if","locations":[{"start":{"line":191,"column":3},"end":{"line":194,"column":null}},{"start":{"line":191,"column":3},"end":{"line":194,"column":null}}]}},"s":{"0":1,"1":1,"2":1,"3":18,"4":18,"5":18,"6":18,"7":2,"8":2,"9":2,"10":30,"11":30,"12":2,"13":2,"14":28,"15":16,"16":16,"17":12,"18":51,"19":51,"20":24,"21":1,"22":1,"23":23,"24":23,"25":2,"26":21,"27":21,"28":21,"29":51,"30":24,"31":51,"32":1,"33":2,"34":2,"35":2,"36":1,"37":2,"38":1,"39":2,"40":1,"41":25,"42":25,"43":25,"44":2,"45":2,"46":2,"47":4,"48":4,"49":4,"50":4,"51":1,"52":3,"53":4,"54":5,"55":5,"56":5,"57":5,"58":1,"59":4,"60":1,"61":1,"62":3,"63":1,"64":1,"65":2,"66":5,"67":5,"68":25,"69":1},"f":{"0":18,"1":2,"2":30,"3":51,"4":24,"5":23,"6":24,"7":2,"8":2,"9":1,"10":1,"11":25,"12":25,"13":2,"14":2,"15":4,"16":4,"17":4,"18":5,"19":5,"20":5,"21":5},"b":{"0":[1,1],"1":[2,28],"2":[2,28],"3":[30,28],"4":[16,12],"5":[28,17],"6":[3],"7":[48],"8":[1,23],"9":[24,2],"10":[2,21],"11":[1,1],"12":[2,2],"13":[24,1],"14":[25,25],"15":[1,3],"16":[1,4],"17":[1,3],"18":[1,2]}}
,"/home/gianmarcotoso/Developer/projects/use-form/src/value.function.ts": {"path":"/home/gianmarcotoso/Developer/projects/use-form/src/value.function.ts","statementMap":{"0":{"start":{"line":2,"column":1},"end":{"line":2,"column":null}},"1":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}},"fnMap":{"0":{"name":"value","decl":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}},"loc":{"start":{"line":1,"column":32},"end":{"line":3,"column":1}}}},"branchMap":{"0":{"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":19}},"type":"cond-expr","locations":[{"start":{"line":2,"column":8},"end":{"line":2,"column":13}},{"start":{"line":2,"column":17},"end":{"line":2,"column":19}}]},"1":{"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":17}},"type":"binary-expr","locations":[{"start":{"line":2,"column":8},"end":{"line":2,"column":17}},{"start":{"line":2,"column":8},"end":{"line":2,"column":17}}]}},"s":{"0":2,"1":1},"f":{"0":2},"b":{"0":[1,1],"1":[2,2]}}
}

@@ -66,2 +66,10 @@ /* eslint-disable */

return function jump(event) {
if (
document.getElementById('fileSearch') === document.activeElement &&
document.activeElement != null
) {
// if we're currently focused on the search input, we don't want to navigate
return;
}
switch (event.which) {

@@ -68,0 +76,0 @@ case 78: // n

@@ -27,2 +27,27 @@ /* eslint-disable */

function onFilterInput() {
const searchValue = document.getElementById('fileSearch').value;
const rows = document.getElementsByTagName('tbody')[0].children;
for (let i = 0; i < rows.length; i++) {
const row = rows[i];
if (
row.textContent
.toLowerCase()
.includes(searchValue.toLowerCase())
) {
row.style.display = '';
} else {
row.style.display = 'none';
}
}
}
// loads the search box
function addSearchBox() {
var template = document.getElementById('filterTemplate');
var templateClone = template.content.cloneNode(true);
templateClone.getElementById('fileSearch').oninput = onFilterInput;
template.parentElement.appendChild(templateClone);
}
// loads all columns

@@ -166,2 +191,3 @@ function loadColumns() {

loadData();
addSearchBox();
addSortIndicators();

@@ -168,0 +194,0 @@ enableUI();

export { useForm, useFormList, useNestedForm } from './use-form.hook.js';
export { value } from './value.function.js';
import 'immer';
import 'ramda';
import 'react';

@@ -0,1 +1,2 @@

import produce from 'immer';
import { identity, mergeDeepLeft, path, lensPath, set } from 'ramda';

@@ -68,18 +69,33 @@ import { useState, useCallback, useMemo } from 'react';

function handleAddItem(item) {
const updatedArray = [...currentValue, item];
const updatedArray = produce(currentValue, (draft) => {
draft.push(item);
});
onChange(key, updatedArray);
}
function handleRemoveItem(item) {
const updatedArray = currentValue.filter((i) => identifier(i) !== identifier(item));
const updatedArray = produce(currentValue, (draft) => {
const index = draft.findIndex((i) => identifier(i) === identifier(item));
if (index === -1) {
return;
}
draft.splice(index, 1);
});
onChange(key, updatedArray);
}
function handleUpdateItem(item, delta, replace) {
const updatedArray = currentValue.map((i) => {
if (identifier(i) === identifier(item)) {
if (typeof i === 'object' && !replace) {
return mergeDeepLeft(delta, i);
}
return delta;
const updatedArray = produce(currentValue, (draft) => {
const index = draft.findIndex((i) => identifier(i) === identifier(item));
if (index === -1) {
return;
}
return i;
if (typeof item === 'string') {
draft[index] = delta;
return;
}
if (replace) {
draft[index] = delta;
return;
}
//@ts-ignore
draft[index] = mergeDeepLeft(delta, draft[index]);
});

@@ -86,0 +102,0 @@ onChange(key, updatedArray);

{
"name": "@polaritybit/use-form",
"version": "1.1.5",
"version": "1.2.0",
"private": false,

@@ -18,17 +18,18 @@ "repository": {

"devDependencies": {
"@rollup/plugin-typescript": "^8.2.5",
"@testing-library/react-hooks": "^7.0.1",
"@types/jest": "^26.0.24",
"@types/ramda": "^0.27.44",
"@types/react": "^17.0.15",
"@types/react-dom": "^17.0.9",
"jest": "^27.0.6",
"@rollup/plugin-typescript": "^8.3.0",
"@testing-library/react-hooks": "^7.0.2",
"@types/jest": "^27.0.3",
"@types/ramda": "^0.27.60",
"@types/react": "^17.0.37",
"@types/react-dom": "^17.0.11",
"jest": "^27.4.5",
"rimraf": "^3.0.2",
"rollup": "^2.55.1",
"rollup": "^2.61.1",
"rollup-plugin-multi-input": "^1.3.1",
"ts-jest": "^27.0.4",
"tslib": "^2.3.0",
"typescript": "^4.3.5"
"ts-jest": "^27.1.2",
"tslib": "^2.3.1",
"typescript": "^4.5.4"
},
"dependencies": {
"immer": "^9.0.7",
"ramda": "^0.27.1",

@@ -35,0 +36,0 @@ "react": "^17.0.2",

@@ -11,4 +11,4 @@ import typescript from '@rollup/plugin-typescript'

},
external: ['react', 'ramda'],
external: ['react', 'ramda', 'immer'],
plugins: [multiInput(), typescript()],
}

@@ -0,1 +1,2 @@

import produce, { current, Draft } from 'immer'
import { identity, lensPath, mergeDeepLeft, path, set } from 'ramda'

@@ -157,3 +158,5 @@ import { ChangeEvent, useCallback, useMemo, useState } from 'react'

function handleAddItem(item: DeepPartial<I>) {
const updatedArray = [...currentValue, item]
const updatedArray = produce<I[]>(currentValue, (draft) => {
draft.push(item as Draft<I>)
})

@@ -164,4 +167,11 @@ onChange(key, updatedArray)

function handleRemoveItem(item: I) {
const updatedArray = currentValue.filter((i) => identifier(i) !== identifier(item))
const updatedArray = produce<I[]>(currentValue, (draft) => {
const index = draft.findIndex((i) => identifier(i as I) === identifier(item))
if (index === -1) {
return
}
draft.splice(index, 1)
})
onChange(key, updatedArray)

@@ -171,12 +181,21 @@ }

function handleUpdateItem(item: I, delta: DeepPartial<I>, replace?: boolean) {
const updatedArray = currentValue.map((i) => {
if (identifier(i) === identifier(item)) {
if (typeof i === 'object' && !replace) {
return mergeDeepLeft(delta, i)
}
const updatedArray = produce<I[]>(currentValue, (draft) => {
const index = draft.findIndex((i) => identifier(i as I) === identifier(item))
return delta
if (index === -1) {
return
}
return i
if (typeof item === 'string') {
draft[index] = delta as Draft<I>
return
}
if (replace) {
draft[index] = delta as Draft<I>
return
}
//@ts-ignore
draft[index] = mergeDeepLeft(delta, draft[index])
})

@@ -183,0 +202,0 @@

@@ -7,3 +7,3 @@ import { act, renderHook } from '@testing-library/react-hooks'

type TestFormStateTodo = {
completed: string
completed?: string
name: string

@@ -21,2 +21,3 @@ id: number

tags: string[]
todos?: TestFormStateTodo[]
}

@@ -305,7 +306,7 @@ todos: TestFormStateTodo[]

it('allows to edit a value on a focused nested array', () => {
it('allows to edit a value on a focused nested array of strings', () => {
function useFormListHookTest() {
const [data, setData] = useForm<TestFormState>({
nest: {
tags: ['foo'],
tags: ['hello', 'world'],
},

@@ -320,12 +321,73 @@ })

act(() => result.current.tagsHandlers.onEdit(result.current.tags[0], 'bar'))
act(() => result.current.tagsHandlers.onEdit(result.current.tags[0], 'zaz'))
expect(result.current.tags).toHaveLength(1)
expect(result.current.tags[0]).toEqual('bar')
expect(result.current.tags).toHaveLength(2)
expect(result.current.tags[0]).toBe('zaz')
})
it('allows to remove a value on a focused nested array', () => {
it('allows to edit a value on a focused nested array of objects', () => {
function useFormListHookTest() {
const [data, setData] = useForm<TestFormState>({
nest: {
todos: [{ id: Math.random(), name: 'foo' }],
},
})
const [todos, todosHandlers] = useFormList([data, setData], 'nest.todos', (i) => i.id)
return { data, todos, setData, todosHandlers }
}
const { result } = renderHook(() => useFormListHookTest())
act(() => result.current.todosHandlers.onEdit(result.current.todos[0], { name: 'bar' }))
expect(result.current.todos).toHaveLength(1)
expect(result.current.todos[0]).toHaveProperty('name', 'bar')
})
it('allows to replace a value on a focused nested array of objects', () => {
function useFormListHookTest() {
const [data, setData] = useForm<TestFormState>({
nest: {
todos: [{ id: Math.random(), name: 'foo' }],
},
})
const [todos, todosHandlers] = useFormList([data, setData], 'nest.todos', (i) => i.id)
return { data, todos, setData, todosHandlers }
}
const { result } = renderHook(() => useFormListHookTest())
act(() => result.current.todosHandlers.onEdit(result.current.todos[0], { id: 42 }, true))
expect(result.current.todos).toHaveLength(1)
expect(result.current.todos[0]).not.toHaveProperty('name')
expect(result.current.todos[0]).toHaveProperty('id', 42)
})
it('does nothing when attempting to edit a non existing item', () => {
function useFormListHookTest() {
const [data, setData] = useForm<TestFormState>({
nest: {
todos: [{ id: Math.random(), name: 'foo' }],
},
})
const [todos, todosHandlers] = useFormList([data, setData], 'nest.todos', (i) => i.id)
return { data, todos, setData, todosHandlers }
}
const { result } = renderHook(() => useFormListHookTest())
act(() => result.current.todosHandlers.onEdit({ id: 12, name: 'baz' }, { name: 'bar' }))
expect(result.current.todos).toHaveLength(1)
expect(result.current.todos[0]).toHaveProperty('name', 'foo')
})
it('allows to remove a value on a focused nested array of strings', () => {
function useFormListHookTest() {
const [data, setData] = useForm<TestFormState>({
nest: {
tags: ['foo'],

@@ -346,2 +408,40 @@ },

it('allows to remove a value on a focused nested array of objects', () => {
function useFormListHookTest() {
const [data, setData] = useForm<TestFormState>({
nest: {
todos: [{ id: Math.random(), name: 'foo' }],
},
})
const [todos, todosHandlers] = useFormList([data, setData], 'nest.todos', (i) => i.id)
return { data, todos, setData, todosHandlers }
}
const { result } = renderHook(() => useFormListHookTest())
act(() => result.current.todosHandlers.onRemove(result.current.todos[0]))
expect(result.current.todos).toHaveLength(0)
})
it('does nothing when attempting to remove a non-existing item', () => {
function useFormListHookTest() {
const [data, setData] = useForm<TestFormState>({
nest: {
todos: [{ id: Math.random(), name: 'foo' }],
},
})
const [todos, todosHandlers] = useFormList([data, setData], 'nest.todos', (i) => i.id)
return { data, todos, setData, todosHandlers }
}
const { result } = renderHook(() => useFormListHookTest())
act(() => result.current.todosHandlers.onRemove({ id: 0, name: 'baz' }))
expect(result.current.todos).toHaveLength(1)
})
it('should not mutate nested objects within the source object when replacing the state', () => {

@@ -348,0 +448,0 @@ function useFormListHookTest() {

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc