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.1 to 1.0.2

dist/index.js.map

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":6,"column":16},"end":{"line":6,"column":43}},"2":{"start":{"line":7,"column":0},"end":{"line":7,"column":61}},"3":{"start":{"line":7,"column":24},"end":{"line":7,"column":59}},"4":{"start":{"line":7,"column":41},"end":{"line":7,"column":58}},"5":{"start":{"line":11,"column":21},"end":{"line":11,"column":62}},"6":{"start":{"line":12,"column":4},"end":{"line":12,"column":31}},"7":{"start":{"line":15,"column":4},"end":{"line":15,"column":34}},"8":{"start":{"line":16,"column":4},"end":{"line":16,"column":68}},"9":{"start":{"line":17,"column":4},"end":{"line":17,"column":17}},"10":{"start":{"line":20,"column":4},"end":{"line":20,"column":20}},"11":{"start":{"line":23,"column":4},"end":{"line":23,"column":43}},"12":{"start":{"line":23,"column":36},"end":{"line":23,"column":43}},"13":{"start":{"line":24,"column":4},"end":{"line":46,"column":null}},"14":{"start":{"line":25,"column":16},"end":{"line":25,"column":25}},"15":{"start":{"line":26,"column":6},"end":{"line":29,"column":null}},"16":{"start":{"line":27,"column":8},"end":{"line":27,"column":66}},"17":{"start":{"line":28,"column":8},"end":{"line":28,"column":24}},"18":{"start":{"line":30,"column":11},"end":{"line":46,"column":null}},"19":{"start":{"line":31,"column":16},"end":{"line":31,"column":36}},"20":{"start":{"line":32,"column":6},"end":{"line":36,"column":null}},"21":{"start":{"line":33,"column":8},"end":{"line":33,"column":66}},"22":{"start":{"line":34,"column":8},"end":{"line":34,"column":40}},"23":{"start":{"line":35,"column":8},"end":{"line":35,"column":24}},"24":{"start":{"line":37,"column":11},"end":{"line":46,"column":null}},"25":{"start":{"line":38,"column":16},"end":{"line":38,"column":71}},"26":{"start":{"line":39,"column":6},"end":{"line":43,"column":null}},"27":{"start":{"line":40,"column":8},"end":{"line":40,"column":95}},"28":{"start":{"line":41,"column":8},"end":{"line":41,"column":40}},"29":{"start":{"line":42,"column":8},"end":{"line":42,"column":24}},"30":{"start":{"line":45,"column":6},"end":{"line":45,"column":50}},"31":{"start":{"line":49,"column":4},"end":{"line":56,"column":null}},"32":{"start":{"line":50,"column":6},"end":{"line":50,"column":63}},"33":{"start":{"line":51,"column":11},"end":{"line":56,"column":null}},"34":{"start":{"line":52,"column":24},"end":{"line":52,"column":84}},"35":{"start":{"line":53,"column":6},"end":{"line":53,"column":86}},"36":{"start":{"line":55,"column":6},"end":{"line":55,"column":42}},"37":{"start":{"line":57,"column":4},"end":{"line":57,"column":17}},"38":{"start":{"line":60,"column":4},"end":{"line":74,"column":null}},"39":{"start":{"line":61,"column":16},"end":{"line":61,"column":34}},"40":{"start":{"line":62,"column":17},"end":{"line":62,"column":25}},"41":{"start":{"line":63,"column":6},"end":{"line":69,"column":null}},"42":{"start":{"line":64,"column":8},"end":{"line":64,"column":64}},"43":{"start":{"line":66,"column":18},"end":{"line":66,"column":36}},"44":{"start":{"line":67,"column":8},"end":{"line":67,"column":27}},"45":{"start":{"line":68,"column":8},"end":{"line":68,"column":24}},"46":{"start":{"line":70,"column":6},"end":{"line":70,"column":41}},"47":{"start":{"line":72,"column":6},"end":{"line":72,"column":41}},"48":{"start":{"line":73,"column":6},"end":{"line":73,"column":25}},"49":{"start":{"line":8,"column":0},"end":{"line":8,"column":21}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":7,"column":14},"end":{"line":7,"column":15}},"loc":{"start":{"line":7,"column":24},"end":{"line":7,"column":59}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":7,"column":34},"end":{"line":7,"column":35}},"loc":{"start":{"line":7,"column":41},"end":{"line":7,"column":58}}},"2":{"name":"(anonymous_2)","decl":{"start":{"line":11,"column":2},"end":{"line":11,"column":21}},"loc":{"start":{"line":11,"column":62},"end":{"line":13,"column":3}}},"3":{"name":"(anonymous_3)","decl":{"start":{"line":14,"column":2},"end":{"line":14,"column":9}},"loc":{"start":{"line":14,"column":19},"end":{"line":18,"column":3}}},"4":{"name":"(anonymous_4)","decl":{"start":{"line":19,"column":2},"end":{"line":19,"column":7}},"loc":{"start":{"line":19,"column":7},"end":{"line":21,"column":3}}},"5":{"name":"(anonymous_5)","decl":{"start":{"line":22,"column":2},"end":{"line":22,"column":7}},"loc":{"start":{"line":22,"column":7},"end":{"line":47,"column":3}}},"6":{"name":"(anonymous_6)","decl":{"start":{"line":48,"column":2},"end":{"line":48,"column":7}},"loc":{"start":{"line":48,"column":25},"end":{"line":58,"column":3}}},"7":{"name":"(anonymous_7)","decl":{"start":{"line":59,"column":2},"end":{"line":59,"column":8}},"loc":{"start":{"line":59,"column":21},"end":{"line":75,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":23,"column":4},"end":{"line":23,"column":43}},"type":"if","locations":[{"start":{"line":23,"column":4},"end":{"line":23,"column":43}}]},"1":{"loc":{"start":{"line":23,"column":8},"end":{"line":23,"column":34}},"type":"binary-expr","locations":[{"start":{"line":23,"column":8},"end":{"line":23,"column":20}},{"start":{"line":23,"column":24},"end":{"line":23,"column":34}}]},"2":{"loc":{"start":{"line":24,"column":4},"end":{"line":46,"column":null}},"type":"if","locations":[{"start":{"line":24,"column":4},"end":{"line":46,"column":null}},{"start":{"line":30,"column":11},"end":{"line":46,"column":null}}]},"3":{"loc":{"start":{"line":26,"column":6},"end":{"line":29,"column":null}},"type":"if","locations":[{"start":{"line":26,"column":6},"end":{"line":29,"column":null}}]},"4":{"loc":{"start":{"line":30,"column":11},"end":{"line":46,"column":null}},"type":"if","locations":[{"start":{"line":30,"column":11},"end":{"line":46,"column":null}},{"start":{"line":37,"column":11},"end":{"line":46,"column":null}}]},"5":{"loc":{"start":{"line":32,"column":6},"end":{"line":36,"column":null}},"type":"if","locations":[{"start":{"line":32,"column":6},"end":{"line":36,"column":null}}]},"6":{"loc":{"start":{"line":37,"column":11},"end":{"line":46,"column":null}},"type":"if","locations":[{"start":{"line":37,"column":11},"end":{"line":46,"column":null}},{"start":{"line":44,"column":11},"end":{"line":46,"column":null}}]},"7":{"loc":{"start":{"line":39,"column":6},"end":{"line":43,"column":null}},"type":"if","locations":[{"start":{"line":39,"column":6},"end":{"line":43,"column":null}}]},"8":{"loc":{"start":{"line":49,"column":4},"end":{"line":56,"column":null}},"type":"if","locations":[{"start":{"line":49,"column":4},"end":{"line":56,"column":null}},{"start":{"line":51,"column":11},"end":{"line":56,"column":null}}]},"9":{"loc":{"start":{"line":51,"column":11},"end":{"line":56,"column":null}},"type":"if","locations":[{"start":{"line":51,"column":11},"end":{"line":56,"column":null}},{"start":{"line":54,"column":11},"end":{"line":56,"column":null}}]},"10":{"loc":{"start":{"line":60,"column":4},"end":{"line":74,"column":null}},"type":"if","locations":[{"start":{"line":60,"column":4},"end":{"line":74,"column":null}},{"start":{"line":71,"column":11},"end":{"line":74,"column":null}}]},"11":{"loc":{"start":{"line":63,"column":6},"end":{"line":69,"column":null}},"type":"if","locations":[{"start":{"line":63,"column":6},"end":{"line":69,"column":null}},{"start":{"line":65,"column":13},"end":{"line":69,"column":null}}]}},"s":{"0":1,"1":1,"2":1,"3":4,"4":8,"5":5,"6":5,"7":8,"8":8,"9":8,"10":1,"11":13,"12":4,"13":9,"14":2,"15":2,"16":2,"17":2,"18":7,"19":2,"20":2,"21":2,"22":2,"23":2,"24":5,"25":5,"26":5,"27":4,"28":4,"29":4,"30":0,"31":5,"32":0,"33":5,"34":5,"35":5,"36":0,"37":5,"38":5,"39":1,"40":1,"41":1,"42":0,"43":1,"44":1,"45":1,"46":1,"47":4,"48":4,"49":1},"f":{"0":4,"1":8,"2":5,"3":8,"4":1,"5":13,"6":5,"7":5},"b":{"0":[4],"1":[13,13],"2":[2,7],"3":[2],"4":[2,5],"5":[2],"6":[5,0],"7":[4],"8":[0,5],"9":[5,0],"10":[1,4],"11":[0,1]}}
{"/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]}}
}
declare type InputTypes = Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array | Float32Array | Float64Array | ArrayBuffer;
declare type NeedTypes = InputTypes | number;
declare type ReturnType<T extends NeedTypes> = T extends number ? Uint8Array : T;
export default class OPut {
g: Generator<NeedTypes, void, InputTypes>;
g?: Generator<NeedTypes, void, InputTypes> | undefined;
need: NeedTypes | void;
buffer?: Uint8Array;
constructor(g: Generator<NeedTypes, void, InputTypes>);
resolve?: (v: any) => void;
constructor(g?: Generator<NeedTypes, void, InputTypes> | undefined);
consume(n: number): void;
read<T extends NeedTypes>(need: T): Promise<ReturnType<T>>;
close(): void;
flush(): void;

@@ -10,0 +14,0 @@ write(value: InputTypes): void;

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

this.g = g;
this.need = g.next().value;
if (g)
this.need = g.next().value;
}

@@ -15,2 +16,18 @@ consume(n) {

}
read(need) {
this.need = need;
if (this.resolve)
this.resolve("read next before last done");
return new Promise((resolve, reject) => {
this.resolve = (data) => {
this.resolve = reject;
resolve(data);
};
this.flush();
});
}
close() {
if (this.g)
this.g.return();
}
flush() {

@@ -22,3 +39,8 @@ if (!this.buffer || !this.need)

if (this.buffer.length >= n) {
this.need = this.g.next(this.buffer.subarray(0, n)).value;
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);

@@ -31,3 +53,8 @@ }

new Uint8Array(this.need).set(this.buffer.subarray(0, n));
this.need = this.g.next().value;
if (this.g)
this.need = this.g.next().value;
else if (this.resolve)
this.resolve(this.need);
else
return;
this.consume(n);

@@ -40,7 +67,12 @@ }

new Uint8Array(this.need.buffer, this.need.byteOffset).set(this.buffer.subarray(0, n));
this.need = this.g.next().value;
if (this.g)
this.need = this.g.next().value;
else if (this.resolve)
this.resolve(this.need);
else
return;
this.consume(n);
}
}
else {
else if (this.g) {
this.g.throw(new Error('Unsupported type'));

@@ -83,1 +115,2 @@ }

;
//# sourceMappingURL=index.js.map
{
"name": "oput",
"version": "1.0.1",
"version": "1.0.2",
"description": "0 put do",

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

@@ -50,2 +50,15 @@ # 0 put do 零存整取库

}
```
### 模式三:通过异步read方式读取数据
```ts
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)
})
```

@@ -6,2 +6,3 @@

type NeedTypes = InputTypes | number;
type ReturnType<T extends NeedTypes> = T extends number ? Uint8Array : T;
const OPutMap = new Map<Function, number>();

@@ -12,4 +13,5 @@ Types.forEach((t, i) => t.forEach((t) => OPutMap.set(t, i)));

buffer?: Uint8Array;
constructor(public g: Generator<NeedTypes, void, InputTypes>) {
this.need = g.next().value;
resolve?: (v: any) => void;
constructor(public g?: Generator<NeedTypes, void, InputTypes>) {
if (g) this.need = g.next().value;
}

@@ -21,5 +23,16 @@ consume(n: number) {

}
close(){
this.g.return();
read<T extends NeedTypes>(need: T) {
this.need = need;
if (this.resolve) this.resolve("read next before last done");
return new Promise<ReturnType<T>>((resolve, reject) => {
this.resolve = (data) => {
this.resolve = reject;
resolve(data);
};
this.flush();
});
}
close() {
if (this.g) this.g.return();
}
flush() {

@@ -30,3 +43,7 @@ if (!this.buffer || !this.need) return;

if (this.buffer.length >= n) {
this.need = this.g.next(this.buffer.subarray(0, n)).value;
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);

@@ -38,3 +55,7 @@ }

new Uint8Array(this.need).set(this.buffer.subarray(0, n));
this.need = this.g.next().value;
if (this.g) this.need = this.g.next().value;
else if (this.resolve)
this.resolve(this.need);
else
return;
this.consume(n);

@@ -46,6 +67,10 @@ }

new Uint8Array(this.need.buffer, this.need.byteOffset).set(this.buffer.subarray(0, n));
this.need = this.g.next().value;
if (this.g) this.need = this.g.next().value;
else if (this.resolve)
this.resolve(this.need);
else
return;
this.consume(n);
}
} else {
} else if (this.g) {
this.g.throw(new Error('Unsupported type'));

@@ -52,0 +77,0 @@ }

@@ -66,2 +66,14 @@ import OPut from '../src/index';

oput.write(new Uint32Array([1, 2]));
});
});
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)
})
})

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