Comparing version 1.0.0 to 1.0.1
@@ -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":43}},"11":{"start":{"line":20,"column":36},"end":{"line":20,"column":43}},"12":{"start":{"line":21,"column":4},"end":{"line":43,"column":null}},"13":{"start":{"line":22,"column":16},"end":{"line":22,"column":25}},"14":{"start":{"line":23,"column":6},"end":{"line":26,"column":null}},"15":{"start":{"line":24,"column":8},"end":{"line":24,"column":66}},"16":{"start":{"line":25,"column":8},"end":{"line":25,"column":24}},"17":{"start":{"line":27,"column":11},"end":{"line":43,"column":null}},"18":{"start":{"line":28,"column":16},"end":{"line":28,"column":36}},"19":{"start":{"line":29,"column":6},"end":{"line":33,"column":null}},"20":{"start":{"line":30,"column":8},"end":{"line":30,"column":66}},"21":{"start":{"line":31,"column":8},"end":{"line":31,"column":40}},"22":{"start":{"line":32,"column":8},"end":{"line":32,"column":24}},"23":{"start":{"line":34,"column":11},"end":{"line":43,"column":null}},"24":{"start":{"line":35,"column":16},"end":{"line":35,"column":71}},"25":{"start":{"line":36,"column":6},"end":{"line":40,"column":null}},"26":{"start":{"line":37,"column":8},"end":{"line":37,"column":95}},"27":{"start":{"line":38,"column":8},"end":{"line":38,"column":40}},"28":{"start":{"line":39,"column":8},"end":{"line":39,"column":24}},"29":{"start":{"line":42,"column":6},"end":{"line":42,"column":50}},"30":{"start":{"line":46,"column":4},"end":{"line":53,"column":null}},"31":{"start":{"line":47,"column":6},"end":{"line":47,"column":63}},"32":{"start":{"line":48,"column":11},"end":{"line":53,"column":null}},"33":{"start":{"line":49,"column":24},"end":{"line":49,"column":84}},"34":{"start":{"line":50,"column":6},"end":{"line":50,"column":86}},"35":{"start":{"line":52,"column":6},"end":{"line":52,"column":42}},"36":{"start":{"line":54,"column":4},"end":{"line":54,"column":17}},"37":{"start":{"line":57,"column":4},"end":{"line":71,"column":null}},"38":{"start":{"line":58,"column":16},"end":{"line":58,"column":34}},"39":{"start":{"line":59,"column":17},"end":{"line":59,"column":25}},"40":{"start":{"line":60,"column":6},"end":{"line":66,"column":null}},"41":{"start":{"line":61,"column":8},"end":{"line":61,"column":64}},"42":{"start":{"line":63,"column":18},"end":{"line":63,"column":36}},"43":{"start":{"line":64,"column":8},"end":{"line":64,"column":27}},"44":{"start":{"line":65,"column":8},"end":{"line":65,"column":24}},"45":{"start":{"line":67,"column":6},"end":{"line":67,"column":41}},"46":{"start":{"line":69,"column":6},"end":{"line":69,"column":41}},"47":{"start":{"line":70,"column":6},"end":{"line":70,"column":25}},"48":{"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":44,"column":3}}},"5":{"name":"(anonymous_5)","decl":{"start":{"line":45,"column":2},"end":{"line":45,"column":7}},"loc":{"start":{"line":45,"column":25},"end":{"line":55,"column":3}}},"6":{"name":"(anonymous_6)","decl":{"start":{"line":56,"column":2},"end":{"line":56,"column":8}},"loc":{"start":{"line":56,"column":21},"end":{"line":72,"column":3}}}},"branchMap":{"0":{"loc":{"start":{"line":20,"column":4},"end":{"line":20,"column":43}},"type":"if","locations":[{"start":{"line":20,"column":4},"end":{"line":20,"column":43}}]},"1":{"loc":{"start":{"line":20,"column":8},"end":{"line":20,"column":34}},"type":"binary-expr","locations":[{"start":{"line":20,"column":8},"end":{"line":20,"column":20}},{"start":{"line":20,"column":24},"end":{"line":20,"column":34}}]},"2":{"loc":{"start":{"line":21,"column":4},"end":{"line":43,"column":null}},"type":"if","locations":[{"start":{"line":21,"column":4},"end":{"line":43,"column":null}},{"start":{"line":27,"column":11},"end":{"line":43,"column":null}}]},"3":{"loc":{"start":{"line":23,"column":6},"end":{"line":26,"column":null}},"type":"if","locations":[{"start":{"line":23,"column":6},"end":{"line":26,"column":null}}]},"4":{"loc":{"start":{"line":27,"column":11},"end":{"line":43,"column":null}},"type":"if","locations":[{"start":{"line":27,"column":11},"end":{"line":43,"column":null}},{"start":{"line":34,"column":11},"end":{"line":43,"column":null}}]},"5":{"loc":{"start":{"line":29,"column":6},"end":{"line":33,"column":null}},"type":"if","locations":[{"start":{"line":29,"column":6},"end":{"line":33,"column":null}}]},"6":{"loc":{"start":{"line":34,"column":11},"end":{"line":43,"column":null}},"type":"if","locations":[{"start":{"line":34,"column":11},"end":{"line":43,"column":null}},{"start":{"line":41,"column":11},"end":{"line":43,"column":null}}]},"7":{"loc":{"start":{"line":36,"column":6},"end":{"line":40,"column":null}},"type":"if","locations":[{"start":{"line":36,"column":6},"end":{"line":40,"column":null}}]},"8":{"loc":{"start":{"line":46,"column":4},"end":{"line":53,"column":null}},"type":"if","locations":[{"start":{"line":46,"column":4},"end":{"line":53,"column":null}},{"start":{"line":48,"column":11},"end":{"line":53,"column":null}}]},"9":{"loc":{"start":{"line":48,"column":11},"end":{"line":53,"column":null}},"type":"if","locations":[{"start":{"line":48,"column":11},"end":{"line":53,"column":null}},{"start":{"line":51,"column":11},"end":{"line":53,"column":null}}]},"10":{"loc":{"start":{"line":57,"column":4},"end":{"line":71,"column":null}},"type":"if","locations":[{"start":{"line":57,"column":4},"end":{"line":71,"column":null}},{"start":{"line":68,"column":11},"end":{"line":71,"column":null}}]},"11":{"loc":{"start":{"line":60,"column":6},"end":{"line":66,"column":null}},"type":"if","locations":[{"start":{"line":60,"column":6},"end":{"line":66,"column":null}},{"start":{"line":62,"column":13},"end":{"line":66,"column":null}}]}},"s":{"0":1,"1":1,"2":1,"3":4,"4":8,"5":4,"6":4,"7":8,"8":8,"9":8,"10":13,"11":4,"12":9,"13":2,"14":2,"15":2,"16":2,"17":7,"18":2,"19":2,"20":2,"21":2,"22":2,"23":5,"24":5,"25":5,"26":4,"27":4,"28":4,"29":0,"30":5,"31":0,"32":5,"33":5,"34":5,"35":0,"36":5,"37":5,"38":1,"39":1,"40":1,"41":0,"42":1,"43":1,"44":1,"45":1,"46":4,"47":4,"48":1},"f":{"0":4,"1":8,"2":4,"3":8,"4":13,"5":5,"6":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":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]}} | ||
} |
{ | ||
"name": "oput", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "0 put do", | ||
@@ -28,2 +28,2 @@ "main": "src/index.ts", | ||
} | ||
} | ||
} |
# 0 put do 零存整取库 | ||
[![Build Status](https://travis-ci.org/langhuihui/oput.svg?branch=master)](https://travis-ci.org/langhuihui/oput) | ||
[![codecov](https://codecov.io/gh/langhuihui/oput/branch/master/graph/badge.svg)](https://codecov.io/gh/langhuihui/oput) | ||
![](https://github.com/langhuihui/oput/workflows/codecov/badge.svg) | ||
[![codecov](https://codecov.io/gh/langhuihui/oput/branch/main/graph/badge.svg?token=GpCih64bOv)](https://codecov.io/gh/langhuihui/oput) | ||
该库旨在解决js需要缓存内存块来解决接收不定长度的数据,取出不定长度的数据的问题。例如tcp的粘包问题。 | ||
@@ -44,10 +46,6 @@ | ||
console.log(b[0]) | ||
} | ||
``` | ||
```js | ||
function *reader(){ | ||
let b = new Uint32Array(5); | ||
yield b;//填充到b中,一共读取了20个字节 | ||
b = new Uint32Array(5); | ||
yield b;//填充到b中,又读取了20个字节 | ||
console.log(b[0]) | ||
} | ||
``` |
@@ -19,2 +19,5 @@ | ||
} | ||
close(){ | ||
this.g.return(); | ||
} | ||
flush() { | ||
@@ -21,0 +24,0 @@ if (!this.buffer || !this.need) return; |
import OPut from '../src/index'; | ||
test('close', () => { | ||
function* reader(): Generator<number, void, Uint8Array> { | ||
while(true){ | ||
let b = yield 5; | ||
console.log(b) | ||
throw new Error('error'); | ||
} | ||
} | ||
const oput = new OPut(reader()); | ||
oput.close(); | ||
}); | ||
test('number', () => { | ||
@@ -3,0 +14,0 @@ function* reader(): Generator<number, void, Uint8Array> { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
190732
892
50