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

oput

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oput - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

coverage/coverage-final.json

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

{"/Users/dexter/project/oput/src/index.ts": {"path":"/Users/dexter/project/oput/src/index.ts","statementMap":{"0":{"start":{"line":2,"column":14},"end":{"line":2,"column":123}},"1":{"start":{"line":7,"column":16},"end":{"line":7,"column":43}},"2":{"start":{"line":8,"column":0},"end":{"line":8,"column":61}},"3":{"start":{"line":8,"column":24},"end":{"line":8,"column":59}},"4":{"start":{"line":8,"column":41},"end":{"line":8,"column":58}},"5":{"start":{"line":13,"column":21},"end":{"line":13,"column":63}},"6":{"start":{"line":14,"column":4},"end":{"line":14,"column":38}},"7":{"start":{"line":14,"column":11},"end":{"line":14,"column":38}},"8":{"start":{"line":17,"column":4},"end":{"line":17,"column":34}},"9":{"start":{"line":18,"column":4},"end":{"line":18,"column":68}},"10":{"start":{"line":19,"column":4},"end":{"line":19,"column":17}},"11":{"start":{"line":22,"column":4},"end":{"line":22,"column":21}},"12":{"start":{"line":23,"column":4},"end":{"line":23,"column":65}},"13":{"start":{"line":23,"column":22},"end":{"line":23,"column":65}},"14":{"start":{"line":24,"column":4},"end":{"line":30,"column":7}},"15":{"start":{"line":25,"column":6},"end":{"line":28,"column":8}},"16":{"start":{"line":26,"column":8},"end":{"line":26,"column":30}},"17":{"start":{"line":27,"column":8},"end":{"line":27,"column":22}},"18":{"start":{"line":29,"column":6},"end":{"line":29,"column":19}},"19":{"start":{"line":33,"column":4},"end":{"line":33,"column":32}},"20":{"start":{"line":33,"column":16},"end":{"line":33,"column":32}},"21":{"start":{"line":36,"column":4},"end":{"line":36,"column":43}},"22":{"start":{"line":36,"column":36},"end":{"line":36,"column":43}},"23":{"start":{"line":37,"column":4},"end":{"line":71,"column":null}},"24":{"start":{"line":38,"column":16},"end":{"line":38,"column":25}},"25":{"start":{"line":39,"column":6},"end":{"line":46,"column":null}},"26":{"start":{"line":40,"column":8},"end":{"line":44,"column":17}},"27":{"start":{"line":40,"column":20},"end":{"line":40,"column":78}},"28":{"start":{"line":41,"column":13},"end":{"line":44,"column":17}},"29":{"start":{"line":42,"column":10},"end":{"line":42,"column":51}},"30":{"start":{"line":44,"column":10},"end":{"line":44,"column":17}},"31":{"start":{"line":45,"column":8},"end":{"line":45,"column":24}},"32":{"start":{"line":47,"column":11},"end":{"line":71,"column":null}},"33":{"start":{"line":48,"column":16},"end":{"line":48,"column":36}},"34":{"start":{"line":49,"column":6},"end":{"line":57,"column":null}},"35":{"start":{"line":50,"column":8},"end":{"line":50,"column":66}},"36":{"start":{"line":51,"column":8},"end":{"line":55,"column":17}},"37":{"start":{"line":51,"column":20},"end":{"line":51,"column":52}},"38":{"start":{"line":52,"column":13},"end":{"line":55,"column":17}},"39":{"start":{"line":53,"column":10},"end":{"line":53,"column":34}},"40":{"start":{"line":55,"column":10},"end":{"line":55,"column":17}},"41":{"start":{"line":56,"column":8},"end":{"line":56,"column":24}},"42":{"start":{"line":58,"column":11},"end":{"line":71,"column":null}},"43":{"start":{"line":59,"column":16},"end":{"line":59,"column":71}},"44":{"start":{"line":60,"column":6},"end":{"line":68,"column":null}},"45":{"start":{"line":61,"column":8},"end":{"line":61,"column":95}},"46":{"start":{"line":62,"column":8},"end":{"line":66,"column":17}},"47":{"start":{"line":62,"column":20},"end":{"line":62,"column":52}},"48":{"start":{"line":63,"column":13},"end":{"line":66,"column":17}},"49":{"start":{"line":64,"column":10},"end":{"line":64,"column":34}},"50":{"start":{"line":66,"column":10},"end":{"line":66,"column":17}},"51":{"start":{"line":67,"column":8},"end":{"line":67,"column":24}},"52":{"start":{"line":69,"column":11},"end":{"line":71,"column":null}},"53":{"start":{"line":70,"column":6},"end":{"line":70,"column":50}},"54":{"start":{"line":74,"column":4},"end":{"line":81,"column":null}},"55":{"start":{"line":75,"column":6},"end":{"line":75,"column":63}},"56":{"start":{"line":76,"column":11},"end":{"line":81,"column":null}},"57":{"start":{"line":77,"column":24},"end":{"line":77,"column":84}},"58":{"start":{"line":78,"column":6},"end":{"line":78,"column":86}},"59":{"start":{"line":80,"column":6},"end":{"line":80,"column":42}},"60":{"start":{"line":82,"column":4},"end":{"line":82,"column":17}},"61":{"start":{"line":85,"column":4},"end":{"line":99,"column":null}},"62":{"start":{"line":86,"column":16},"end":{"line":86,"column":34}},"63":{"start":{"line":87,"column":17},"end":{"line":87,"column":25}},"64":{"start":{"line":88,"column":6},"end":{"line":94,"column":null}},"65":{"start":{"line":89,"column":8},"end":{"line":89,"column":64}},"66":{"start":{"line":91,"column":18},"end":{"line":91,"column":36}},"67":{"start":{"line":92,"column":8},"end":{"line":92,"column":27}},"68":{"start":{"line":93,"column":8},"end":{"line":93,"column":24}},"69":{"start":{"line":95,"column":6},"end":{"line":95,"column":41}},"70":{"start":{"line":97,"column":6},"end":{"line":97,"column":41}},"71":{"start":{"line":98,"column":6},"end":{"line":98,"column":25}},"72":{"start":{"line":9,"column":0},"end":{"line":9,"column":21}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":8,"column":14},"end":{"line":8,"column":15}},"loc":{"start":{"line":8,"column":24},"end":{"line":8,"column":59}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":8,"column":34},"end":{"line":8,"column":35}},"loc":{"start":{"line":8,"column":41},"end":{"line":8,"column":58}}},"2":{"name":"(anonymous_2)","decl":{"start":{"line":13,"column":2},"end":{"line":13,"column":21}},"loc":{"start":{"line":13,"column":63},"end":{"line":15,"column":3}}},"3":{"name":"(anonymous_3)","decl":{"start":{"line":16,"column":2},"end":{"line":16,"column":9}},"loc":{"start":{"line":16,"column":19},"end":{"line":20,"column":3}}},"4":{"name":"(anonymous_4)","decl":{"start":{"line":21,"column":2},"end":{"line":21,"column":6}},"loc":{"start":{"line":21,"column":35},"end":{"line":31,"column":3}}},"5":{"name":"(anonymous_5)","decl":{"start":{"line":24,"column":38},"end":{"line":24,"column":39}},"loc":{"start":{"line":24,"column":58},"end":{"line":30,"column":5}}},"6":{"name":"(anonymous_6)","decl":{"start":{"line":25,"column":21},"end":{"line":25,"column":22}},"loc":{"start":{"line":25,"column":30},"end":{"line":28,"column":7}}},"7":{"name":"(anonymous_7)","decl":{"start":{"line":32,"column":2},"end":{"line":32,"column":7}},"loc":{"start":{"line":32,"column":7},"end":{"line":34,"column":3}}},"8":{"name":"(anonymous_8)","decl":{"start":{"line":35,"column":2},"end":{"line":35,"column":7}},"loc":{"start":{"line":35,"column":7},"end":{"line":72,"column":3}}},"9":{"name":"(anonymous_9)","decl":{"start":{"line":73,"column":2},"end":{"line":73,"column":7}},"loc":{"start":{"line":73,"column":25},"end":{"line":83,"column":3}}},"10":{"name":"(anonymous_10)","decl":{"start":{"line":84,"column":2},"end":{"line":84,"column":8}},"loc":{"start":{"line":84,"column":21},"end":{"line":100,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":14,"column":4},"end":{"line":14,"column":38}},"type":"if","locations":[{"start":{"line":14,"column":4},"end":{"line":14,"column":38}}]},"1":{"loc":{"start":{"line":23,"column":4},"end":{"line":23,"column":65}},"type":"if","locations":[{"start":{"line":23,"column":4},"end":{"line":23,"column":65}}]},"2":{"loc":{"start":{"line":33,"column":4},"end":{"line":33,"column":32}},"type":"if","locations":[{"start":{"line":33,"column":4},"end":{"line":33,"column":32}}]},"3":{"loc":{"start":{"line":36,"column":4},"end":{"line":36,"column":43}},"type":"if","locations":[{"start":{"line":36,"column":4},"end":{"line":36,"column":43}}]},"4":{"loc":{"start":{"line":36,"column":8},"end":{"line":36,"column":34}},"type":"binary-expr","locations":[{"start":{"line":36,"column":8},"end":{"line":36,"column":20}},{"start":{"line":36,"column":24},"end":{"line":36,"column":34}}]},"5":{"loc":{"start":{"line":37,"column":4},"end":{"line":71,"column":null}},"type":"if","locations":[{"start":{"line":37,"column":4},"end":{"line":71,"column":null}},{"start":{"line":47,"column":11},"end":{"line":71,"column":null}}]},"6":{"loc":{"start":{"line":39,"column":6},"end":{"line":46,"column":null}},"type":"if","locations":[{"start":{"line":39,"column":6},"end":{"line":46,"column":null}}]},"7":{"loc":{"start":{"line":40,"column":8},"end":{"line":44,"column":17}},"type":"if","locations":[{"start":{"line":40,"column":8},"end":{"line":44,"column":17}},{"start":{"line":41,"column":13},"end":{"line":44,"column":17}}]},"8":{"loc":{"start":{"line":41,"column":13},"end":{"line":44,"column":17}},"type":"if","locations":[{"start":{"line":41,"column":13},"end":{"line":44,"column":17}},{"start":{"line":44,"column":10},"end":{"line":44,"column":17}}]},"9":{"loc":{"start":{"line":47,"column":11},"end":{"line":71,"column":null}},"type":"if","locations":[{"start":{"line":47,"column":11},"end":{"line":71,"column":null}},{"start":{"line":58,"column":11},"end":{"line":71,"column":null}}]},"10":{"loc":{"start":{"line":49,"column":6},"end":{"line":57,"column":null}},"type":"if","locations":[{"start":{"line":49,"column":6},"end":{"line":57,"column":null}}]},"11":{"loc":{"start":{"line":51,"column":8},"end":{"line":55,"column":17}},"type":"if","locations":[{"start":{"line":51,"column":8},"end":{"line":55,"column":17}},{"start":{"line":52,"column":13},"end":{"line":55,"column":17}}]},"12":{"loc":{"start":{"line":52,"column":13},"end":{"line":55,"column":17}},"type":"if","locations":[{"start":{"line":52,"column":13},"end":{"line":55,"column":17}},{"start":{"line":55,"column":10},"end":{"line":55,"column":17}}]},"13":{"loc":{"start":{"line":58,"column":11},"end":{"line":71,"column":null}},"type":"if","locations":[{"start":{"line":58,"column":11},"end":{"line":71,"column":null}},{"start":{"line":69,"column":11},"end":{"line":71,"column":null}}]},"14":{"loc":{"start":{"line":60,"column":6},"end":{"line":68,"column":null}},"type":"if","locations":[{"start":{"line":60,"column":6},"end":{"line":68,"column":null}}]},"15":{"loc":{"start":{"line":62,"column":8},"end":{"line":66,"column":17}},"type":"if","locations":[{"start":{"line":62,"column":8},"end":{"line":66,"column":17}},{"start":{"line":63,"column":13},"end":{"line":66,"column":17}}]},"16":{"loc":{"start":{"line":63,"column":13},"end":{"line":66,"column":17}},"type":"if","locations":[{"start":{"line":63,"column":13},"end":{"line":66,"column":17}},{"start":{"line":66,"column":10},"end":{"line":66,"column":17}}]},"17":{"loc":{"start":{"line":69,"column":11},"end":{"line":71,"column":null}},"type":"if","locations":[{"start":{"line":69,"column":11},"end":{"line":71,"column":null}}]},"18":{"loc":{"start":{"line":74,"column":4},"end":{"line":81,"column":null}},"type":"if","locations":[{"start":{"line":74,"column":4},"end":{"line":81,"column":null}},{"start":{"line":76,"column":11},"end":{"line":81,"column":null}}]},"19":{"loc":{"start":{"line":76,"column":11},"end":{"line":81,"column":null}},"type":"if","locations":[{"start":{"line":76,"column":11},"end":{"line":81,"column":null}},{"start":{"line":79,"column":11},"end":{"line":81,"column":null}}]},"20":{"loc":{"start":{"line":85,"column":4},"end":{"line":99,"column":null}},"type":"if","locations":[{"start":{"line":85,"column":4},"end":{"line":99,"column":null}},{"start":{"line":96,"column":11},"end":{"line":99,"column":null}}]},"21":{"loc":{"start":{"line":88,"column":6},"end":{"line":94,"column":null}},"type":"if","locations":[{"start":{"line":88,"column":6},"end":{"line":94,"column":null}},{"start":{"line":90,"column":13},"end":{"line":94,"column":null}}]}},"s":{"0":1,"1":1,"2":1,"3":4,"4":8,"5":6,"6":6,"7":5,"8":24,"9":24,"10":24,"11":1,"12":1,"13":0,"14":1,"15":1,"16":1,"17":1,"18":1,"19":1,"20":1,"21":32,"22":6,"23":26,"24":19,"25":19,"26":18,"27":2,"28":16,"29":16,"30":0,"31":18,"32":7,"33":2,"34":2,"35":2,"36":2,"37":2,"38":0,"39":0,"40":0,"41":2,"42":5,"43":5,"44":5,"45":4,"46":4,"47":4,"48":0,"49":0,"50":0,"51":4,"52":0,"53":0,"54":7,"55":0,"56":7,"57":7,"58":7,"59":0,"60":7,"61":7,"62":2,"63":2,"64":2,"65":0,"66":2,"67":2,"68":2,"69":2,"70":5,"71":5,"72":1},"f":{"0":4,"1":8,"2":6,"3":24,"4":1,"5":1,"6":1,"7":1,"8":32,"9":7,"10":7},"b":{"0":[5],"1":[0],"2":[1],"3":[6],"4":[32,32],"5":[19,7],"6":[18],"7":[2,16],"8":[16,0],"9":[2,5],"10":[2],"11":[2,0],"12":[0,0],"13":[5,0],"14":[4],"15":[4,0],"16":[0,0],"17":[0],"18":[0,7],"19":[7,0],"20":[2,5],"21":[0,2]}}
{"/Users/dexter/project/oput/src/index.ts": {"path":"/Users/dexter/project/oput/src/index.ts","statementMap":{"0":{"start":{"line":2,"column":14},"end":{"line":2,"column":123}},"1":{"start":{"line":7,"column":16},"end":{"line":7,"column":43}},"2":{"start":{"line":8,"column":0},"end":{"line":8,"column":61}},"3":{"start":{"line":8,"column":24},"end":{"line":8,"column":59}},"4":{"start":{"line":8,"column":41},"end":{"line":8,"column":58}},"5":{"start":{"line":14,"column":21},"end":{"line":14,"column":63}},"6":{"start":{"line":11,"column":2},"end":{"line":11,"column":15}},"7":{"start":{"line":15,"column":4},"end":{"line":15,"column":38}},"8":{"start":{"line":15,"column":11},"end":{"line":15,"column":38}},"9":{"start":{"line":18,"column":4},"end":{"line":22,"column":null}},"10":{"start":{"line":19,"column":6},"end":{"line":19,"column":48}},"11":{"start":{"line":20,"column":6},"end":{"line":20,"column":82}},"12":{"start":{"line":21,"column":6},"end":{"line":21,"column":24}},"13":{"start":{"line":23,"column":4},"end":{"line":23,"column":18}},"14":{"start":{"line":24,"column":4},"end":{"line":24,"column":17}},"15":{"start":{"line":27,"column":4},"end":{"line":27,"column":67}},"16":{"start":{"line":27,"column":22},"end":{"line":27,"column":67}},"17":{"start":{"line":28,"column":4},"end":{"line":36,"column":7}},"18":{"start":{"line":29,"column":6},"end":{"line":34,"column":8}},"19":{"start":{"line":30,"column":8},"end":{"line":30,"column":28}},"20":{"start":{"line":31,"column":8},"end":{"line":31,"column":25}},"21":{"start":{"line":32,"column":8},"end":{"line":32,"column":null}},"22":{"start":{"line":33,"column":8},"end":{"line":33,"column":22}},"23":{"start":{"line":35,"column":6},"end":{"line":35,"column":24}},"24":{"start":{"line":39,"column":4},"end":{"line":39,"column":32}},"25":{"start":{"line":39,"column":16},"end":{"line":39,"column":32}},"26":{"start":{"line":42,"column":4},"end":{"line":42,"column":43}},"27":{"start":{"line":42,"column":36},"end":{"line":42,"column":43}},"28":{"start":{"line":43,"column":41},"end":{"line":43,"column":45}},"29":{"start":{"line":44,"column":4},"end":{"line":64,"column":null}},"30":{"start":{"line":45,"column":6},"end":{"line":48,"column":null}},"31":{"start":{"line":46,"column":8},"end":{"line":46,"column":34}},"32":{"start":{"line":47,"column":8},"end":{"line":47,"column":61}},"33":{"start":{"line":49,"column":11},"end":{"line":64,"column":null}},"34":{"start":{"line":50,"column":6},"end":{"line":54,"column":null}},"35":{"start":{"line":51,"column":8},"end":{"line":51,"column":45}},"36":{"start":{"line":52,"column":8},"end":{"line":52,"column":78}},"37":{"start":{"line":53,"column":8},"end":{"line":53,"column":null}},"38":{"start":{"line":55,"column":11},"end":{"line":64,"column":null}},"39":{"start":{"line":56,"column":16},"end":{"line":56,"column":71}},"40":{"start":{"line":57,"column":6},"end":{"line":61,"column":null}},"41":{"start":{"line":58,"column":8},"end":{"line":58,"column":26}},"42":{"start":{"line":59,"column":8},"end":{"line":59,"column":95}},"43":{"start":{"line":60,"column":8},"end":{"line":60,"column":null}},"44":{"start":{"line":62,"column":11},"end":{"line":64,"column":null}},"45":{"start":{"line":63,"column":6},"end":{"line":63,"column":50}},"46":{"start":{"line":65,"column":4},"end":{"line":70,"column":null}},"47":{"start":{"line":66,"column":6},"end":{"line":69,"column":29}},"48":{"start":{"line":66,"column":18},"end":{"line":66,"column":62}},"49":{"start":{"line":67,"column":11},"end":{"line":69,"column":29}},"50":{"start":{"line":68,"column":8},"end":{"line":68,"column":34}},"51":{"start":{"line":69,"column":11},"end":{"line":69,"column":29}},"52":{"start":{"line":73,"column":4},"end":{"line":80,"column":null}},"53":{"start":{"line":74,"column":6},"end":{"line":74,"column":63}},"54":{"start":{"line":75,"column":11},"end":{"line":80,"column":null}},"55":{"start":{"line":76,"column":24},"end":{"line":76,"column":84}},"56":{"start":{"line":77,"column":6},"end":{"line":77,"column":86}},"57":{"start":{"line":79,"column":6},"end":{"line":79,"column":42}},"58":{"start":{"line":81,"column":4},"end":{"line":81,"column":17}},"59":{"start":{"line":84,"column":4},"end":{"line":98,"column":null}},"60":{"start":{"line":85,"column":16},"end":{"line":85,"column":34}},"61":{"start":{"line":86,"column":17},"end":{"line":86,"column":25}},"62":{"start":{"line":87,"column":6},"end":{"line":93,"column":null}},"63":{"start":{"line":88,"column":8},"end":{"line":88,"column":64}},"64":{"start":{"line":90,"column":18},"end":{"line":90,"column":36}},"65":{"start":{"line":91,"column":8},"end":{"line":91,"column":27}},"66":{"start":{"line":92,"column":8},"end":{"line":92,"column":24}},"67":{"start":{"line":94,"column":6},"end":{"line":94,"column":41}},"68":{"start":{"line":96,"column":6},"end":{"line":96,"column":41}},"69":{"start":{"line":97,"column":6},"end":{"line":97,"column":25}},"70":{"start":{"line":9,"column":0},"end":{"line":9,"column":21}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":8,"column":14},"end":{"line":8,"column":15}},"loc":{"start":{"line":8,"column":24},"end":{"line":8,"column":59}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":8,"column":34},"end":{"line":8,"column":35}},"loc":{"start":{"line":8,"column":41},"end":{"line":8,"column":58}}},"2":{"name":"(anonymous_2)","decl":{"start":{"line":14,"column":2},"end":{"line":14,"column":21}},"loc":{"start":{"line":14,"column":63},"end":{"line":16,"column":3}}},"3":{"name":"(anonymous_3)","decl":{"start":{"line":17,"column":2},"end":{"line":17,"column":8}},"loc":{"start":{"line":17,"column":28},"end":{"line":25,"column":3}}},"4":{"name":"(anonymous_4)","decl":{"start":{"line":26,"column":2},"end":{"line":26,"column":6}},"loc":{"start":{"line":26,"column":35},"end":{"line":37,"column":3}}},"5":{"name":"(anonymous_5)","decl":{"start":{"line":28,"column":38},"end":{"line":28,"column":39}},"loc":{"start":{"line":28,"column":58},"end":{"line":36,"column":5}}},"6":{"name":"(anonymous_6)","decl":{"start":{"line":29,"column":21},"end":{"line":29,"column":22}},"loc":{"start":{"line":29,"column":30},"end":{"line":34,"column":7}}},"7":{"name":"(anonymous_7)","decl":{"start":{"line":38,"column":2},"end":{"line":38,"column":7}},"loc":{"start":{"line":38,"column":7},"end":{"line":40,"column":3}}},"8":{"name":"(anonymous_8)","decl":{"start":{"line":41,"column":2},"end":{"line":41,"column":7}},"loc":{"start":{"line":41,"column":7},"end":{"line":71,"column":3}}},"9":{"name":"(anonymous_9)","decl":{"start":{"line":72,"column":2},"end":{"line":72,"column":7}},"loc":{"start":{"line":72,"column":25},"end":{"line":82,"column":3}}},"10":{"name":"(anonymous_10)","decl":{"start":{"line":83,"column":2},"end":{"line":83,"column":8}},"loc":{"start":{"line":83,"column":21},"end":{"line":99,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":15,"column":4},"end":{"line":15,"column":38}},"type":"if","locations":[{"start":{"line":15,"column":4},"end":{"line":15,"column":38}}]},"1":{"loc":{"start":{"line":18,"column":4},"end":{"line":22,"column":null}},"type":"if","locations":[{"start":{"line":18,"column":4},"end":{"line":22,"column":null}}]},"2":{"loc":{"start":{"line":27,"column":4},"end":{"line":27,"column":67}},"type":"if","locations":[{"start":{"line":27,"column":4},"end":{"line":27,"column":67}}]},"3":{"loc":{"start":{"line":39,"column":4},"end":{"line":39,"column":32}},"type":"if","locations":[{"start":{"line":39,"column":4},"end":{"line":39,"column":32}}]},"4":{"loc":{"start":{"line":42,"column":4},"end":{"line":42,"column":43}},"type":"if","locations":[{"start":{"line":42,"column":4},"end":{"line":42,"column":43}}]},"5":{"loc":{"start":{"line":42,"column":8},"end":{"line":42,"column":34}},"type":"binary-expr","locations":[{"start":{"line":42,"column":8},"end":{"line":42,"column":20}},{"start":{"line":42,"column":24},"end":{"line":42,"column":34}}]},"6":{"loc":{"start":{"line":44,"column":4},"end":{"line":64,"column":null}},"type":"if","locations":[{"start":{"line":44,"column":4},"end":{"line":64,"column":null}},{"start":{"line":49,"column":11},"end":{"line":64,"column":null}}]},"7":{"loc":{"start":{"line":45,"column":6},"end":{"line":48,"column":null}},"type":"if","locations":[{"start":{"line":45,"column":6},"end":{"line":48,"column":null}}]},"8":{"loc":{"start":{"line":49,"column":11},"end":{"line":64,"column":null}},"type":"if","locations":[{"start":{"line":49,"column":11},"end":{"line":64,"column":null}},{"start":{"line":55,"column":11},"end":{"line":64,"column":null}}]},"9":{"loc":{"start":{"line":50,"column":6},"end":{"line":54,"column":null}},"type":"if","locations":[{"start":{"line":50,"column":6},"end":{"line":54,"column":null}}]},"10":{"loc":{"start":{"line":55,"column":11},"end":{"line":64,"column":null}},"type":"if","locations":[{"start":{"line":55,"column":11},"end":{"line":64,"column":null}},{"start":{"line":62,"column":11},"end":{"line":64,"column":null}}]},"11":{"loc":{"start":{"line":57,"column":6},"end":{"line":61,"column":null}},"type":"if","locations":[{"start":{"line":57,"column":6},"end":{"line":61,"column":null}}]},"12":{"loc":{"start":{"line":62,"column":11},"end":{"line":64,"column":null}},"type":"if","locations":[{"start":{"line":62,"column":11},"end":{"line":64,"column":null}}]},"13":{"loc":{"start":{"line":65,"column":4},"end":{"line":70,"column":null}},"type":"if","locations":[{"start":{"line":65,"column":4},"end":{"line":70,"column":null}}]},"14":{"loc":{"start":{"line":66,"column":6},"end":{"line":69,"column":29}},"type":"if","locations":[{"start":{"line":66,"column":6},"end":{"line":69,"column":29}},{"start":{"line":67,"column":11},"end":{"line":69,"column":29}}]},"15":{"loc":{"start":{"line":67,"column":11},"end":{"line":69,"column":29}},"type":"if","locations":[{"start":{"line":67,"column":11},"end":{"line":69,"column":29}},{"start":{"line":69,"column":11},"end":{"line":69,"column":29}}]},"16":{"loc":{"start":{"line":73,"column":4},"end":{"line":80,"column":null}},"type":"if","locations":[{"start":{"line":73,"column":4},"end":{"line":80,"column":null}},{"start":{"line":75,"column":11},"end":{"line":80,"column":null}}]},"17":{"loc":{"start":{"line":75,"column":11},"end":{"line":80,"column":null}},"type":"if","locations":[{"start":{"line":75,"column":11},"end":{"line":80,"column":null}},{"start":{"line":78,"column":11},"end":{"line":80,"column":null}}]},"18":{"loc":{"start":{"line":84,"column":4},"end":{"line":98,"column":null}},"type":"if","locations":[{"start":{"line":84,"column":4},"end":{"line":98,"column":null}},{"start":{"line":95,"column":11},"end":{"line":98,"column":null}}]},"19":{"loc":{"start":{"line":87,"column":6},"end":{"line":93,"column":null}},"type":"if","locations":[{"start":{"line":87,"column":6},"end":{"line":93,"column":null}},{"start":{"line":89,"column":13},"end":{"line":93,"column":null}}]}},"s":{"0":1,"1":1,"2":1,"3":4,"4":8,"5":6,"6":6,"7":6,"8":5,"9":10,"10":9,"11":9,"12":9,"13":10,"14":10,"15":2,"16":0,"17":2,"18":2,"19":2,"20":2,"21":2,"22":2,"23":2,"24":1,"25":1,"26":17,"27":6,"28":11,"29":11,"30":4,"31":4,"32":4,"33":7,"34":2,"35":2,"36":2,"37":2,"38":5,"39":5,"40":5,"41":4,"42":4,"43":4,"44":0,"45":0,"46":11,"47":10,"48":8,"49":2,"50":2,"51":0,"52":7,"53":0,"54":7,"55":7,"56":7,"57":0,"58":7,"59":7,"60":2,"61":2,"62":2,"63":0,"64":2,"65":2,"66":2,"67":2,"68":5,"69":5,"70":1},"f":{"0":4,"1":8,"2":6,"3":10,"4":2,"5":2,"6":2,"7":1,"8":17,"9":7,"10":7},"b":{"0":[5],"1":[9],"2":[0],"3":[1],"4":[6],"5":[17,17],"6":[4,7],"7":[4],"8":[2,5],"9":[2],"10":[5,0],"11":[4],"12":[0],"13":[10],"14":[8,2],"15":[2,0],"16":[0,7],"17":[7,0],"18":[2,5],"19":[0,2]}}
}

@@ -6,7 +6,8 @@ declare type InputTypes = Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array | Float32Array | Float64Array | ArrayBuffer;

g?: Generator<NeedTypes, void, InputTypes> | undefined;
need: NeedTypes | void;
need?: NeedTypes | void;
consumed: number;
buffer?: Uint8Array;
resolve?: (v: any) => void;
constructor(g?: Generator<NeedTypes, void, InputTypes> | undefined);
consume(n: number): void;
demand(n: NeedTypes | void): void;
read<T extends NeedTypes>(need: T): Promise<ReturnType<T>>;

@@ -13,0 +14,0 @@ close(): void;

@@ -7,20 +7,26 @@ const Types = [[Uint8Array, Int8Array], [Uint16Array, Int16Array], [Uint32Array, Int32Array, Float32Array], [Float64Array]];

this.g = g;
this.consumed = 0;
if (g)
this.need = g.next().value;
}
consume(n) {
this.buffer.copyWithin(0, n);
this.buffer = this.buffer.subarray(0, this.buffer.length - n);
demand(n) {
if (this.consumed) {
this.buffer.copyWithin(0, this.consumed);
this.buffer = this.buffer.subarray(0, this.buffer.length - this.consumed);
this.consumed = 0;
}
this.need = n;
this.flush();
}
read(need) {
this.need = need;
if (this.resolve)
this.resolve("read next before last done");
Promise.reject("last read not complete yet");
return new Promise((resolve, reject) => {
this.resolve = (data) => {
this.resolve = reject;
delete this.resolve;
delete this.need;
console.log(data);
resolve(data);
};
this.flush();
this.demand(need);
});

@@ -35,25 +41,14 @@ }

return;
let returnValue = null;
if (typeof this.need === 'number') {
const n = this.need;
if (this.buffer.length >= n) {
if (this.g)
this.need = this.g.next(this.buffer.subarray(0, n)).value;
else if (this.resolve)
this.resolve(this.buffer.subarray(0, n));
else
return;
this.consume(n);
if (this.buffer.length >= this.need) {
this.consumed = this.need;
returnValue = this.buffer.subarray(0, this.consumed);
}
}
else if (this.need instanceof ArrayBuffer) {
const n = this.need.byteLength;
if (this.buffer.length >= n) {
new Uint8Array(this.need).set(this.buffer.subarray(0, n));
if (this.g)
this.need = this.g.next().value;
else if (this.resolve)
this.resolve(this.need);
else
return;
this.consume(n);
if (this.buffer.length >= this.need.byteLength) {
this.consumed = this.need.byteLength;
new Uint8Array(this.need).set(this.buffer.subarray(0, this.consumed));
returnValue = this.need;
}

@@ -64,10 +59,5 @@ }

if (this.buffer.length >= n) {
this.consumed = n;
new Uint8Array(this.need.buffer, this.need.byteOffset).set(this.buffer.subarray(0, n));
if (this.g)
this.need = this.g.next().value;
else if (this.resolve)
this.resolve(this.need);
else
return;
this.consume(n);
returnValue = this.need;
}

@@ -78,2 +68,10 @@ }

}
if (returnValue) {
if (this.g)
this.demand(this.g.next(returnValue).value);
else if (this.resolve)
this.resolve(returnValue);
else
this.consumed = 0;
}
}

@@ -80,0 +78,0 @@ write(value) {

{
"name": "oput",
"version": "1.0.2",
"version": "1.0.3",
"description": "0 put do",

@@ -5,0 +5,0 @@ "main": "src/index.ts",

@@ -10,3 +10,4 @@

export default class OPut {
need: NeedTypes | void;
need?: NeedTypes | void;
consumed = 0;
buffer?: Uint8Array;

@@ -17,16 +18,21 @@ resolve?: (v: any) => void;

}
consume(n: number) {
this.buffer!.copyWithin(0, n);
this.buffer = this.buffer!.subarray(0, this.buffer!.length - n);
demand(n: NeedTypes | void) {
if (this.consumed) {
this.buffer!.copyWithin(0, this.consumed);
this.buffer = this.buffer!.subarray(0, this.buffer!.length - this.consumed);
this.consumed = 0;
}
this.need = n;
this.flush();
}
read<T extends NeedTypes>(need: T) {
this.need = need;
if (this.resolve) this.resolve("read next before last done");
if (this.resolve) Promise.reject("last read not complete yet");
return new Promise<ReturnType<T>>((resolve, reject) => {
this.resolve = (data) => {
this.resolve = reject;
delete this.resolve;
delete this.need;
console.log(data)
resolve(data);
};
this.flush();
this.demand(need);
});

@@ -39,22 +45,13 @@ }

if (!this.buffer || !this.need) return;
let returnValue: InputTypes | null = null;
if (typeof this.need === 'number') {
const n = this.need;
if (this.buffer.length >= n) {
if (this.g) this.need = this.g.next(this.buffer.subarray(0, n)).value;
else if (this.resolve)
this.resolve(this.buffer.subarray(0, n));
else
return;
this.consume(n);
if (this.buffer.length >= this.need) {
this.consumed = this.need;
returnValue = this.buffer.subarray(0, this.consumed);
}
} else if (this.need instanceof ArrayBuffer) {
const n = this.need.byteLength;
if (this.buffer.length >= n) {
new Uint8Array(this.need).set(this.buffer.subarray(0, n));
if (this.g) this.need = this.g.next().value;
else if (this.resolve)
this.resolve(this.need);
else
return;
this.consume(n);
if (this.buffer.length >= this.need.byteLength) {
this.consumed = this.need.byteLength;
new Uint8Array(this.need).set(this.buffer.subarray(0, this.consumed));
returnValue = this.need
}

@@ -64,9 +61,5 @@ } else if (OPutMap.has(this.need.constructor)) {

if (this.buffer.length >= n) {
this.consumed = n;
new Uint8Array(this.need.buffer, this.need.byteOffset).set(this.buffer.subarray(0, n));
if (this.g) this.need = this.g.next().value;
else if (this.resolve)
this.resolve(this.need);
else
return;
this.consume(n);
returnValue = this.need
}

@@ -76,2 +69,8 @@ } else if (this.g) {

}
if (returnValue) {
if (this.g) this.demand(this.g.next(returnValue).value);
else if (this.resolve)
this.resolve(returnValue);
else this.consumed = 0;
}
}

@@ -78,0 +77,0 @@ write(value: InputTypes): void {

import OPut from '../src/index';
test('close', () => {
function* reader(): Generator<number, void, Uint8Array> {
while(true){
while (true) {
let b = yield 5;
console.log(b)
console.log('error::', b);
throw new Error('error');

@@ -68,12 +68,12 @@ }

test('read',()=>{
test('read', () => {
const oput = new OPut();
oput.write(new Uint32Array([1, 2]));
oput.write(new Uint32Array([1, 2]));
oput.read(1).then(value=>{
expect(value[0]).toBe(1)
return oput.read(4)
}).then(value=>{
expect(value[3]).toBe(2)
})
})
oput.read(1).then(value => {
expect(value[0]).toBe(1);
return oput.read(4);
}).then(value => {
expect(value[3]).toBe(2);
});
});

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