Skip to content

Commit 3a2c82f

Browse files
authored
Merge pull request #3 from iuriatan/bump-deno
chore: update deno std lib to 0.204.0
2 parents 7baeca3 + 6fd93aa commit 3a2c82f

File tree

4 files changed

+7
-18
lines changed

4 files changed

+7
-18
lines changed

deps.ts

-5
This file was deleted.

dev_deps.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// Copyright 2020 Masataka Kurihara. All rights reserved. MIT license.
22

3-
export {
4-
assert,
5-
assertEquals,
6-
assertThrows,
7-
} from 'https://deno.land/[email protected]/testing/asserts.ts';
3+
export { assert } from 'https://deno.land/[email protected]/assert/assert.ts'
4+
export { assertEquals } from 'https://deno.land/[email protected]/assert/assert_equals.ts'
5+
export { assertThrows } from 'https://deno.land/[email protected]/assert/assert_throws.ts';

parser.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
// Copyright 2020 Masataka Kurihara. All rights reserved. MIT license.
22

3-
import {
4-
readableStreamFromReader,
5-
} from './deps.ts';
6-
73
import {
84
XMLParseHandler,
95
XMLParseContext,
@@ -245,16 +241,16 @@ export class SAXParser extends ParserBase implements UnderlyingSink<Uint8Array>
245241
* @param source Target XML.
246242
* @param encoding When the source is Deno.Reader or Uint8Array, specify the encoding.
247243
*/
248-
async parse(source: Deno.Reader | Uint8Array | string, encoding?: string) {
244+
async parse(source: ReadableStream<unknown> | Uint8Array | string, encoding?: string) {
249245
this._encoding = encoding;
250246
if (typeof source === 'string') {
251247
this.chunk = source;
252248
this.run();
253249
} else if (source instanceof Uint8Array) {
254250
this.write(source);
255251
} else {
256-
await readableStreamFromReader(source).pipeThrough(
257-
new TextDecoderStream(this._encoding),
252+
await source.pipeThrough(
253+
new TextDecoderStream(this._encoding)
258254
).pipeTo(
259255
new WritableStream<string>({ write: str => this.parse(str, encoding) }),
260256
);

parser_test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Deno.test('SAXParser on & parse(Deno.Reader)', async () => {
6969
}
7070
});
7171
const file = await Deno.open('parser_test.xml');
72-
await parser.parse(file);
72+
await parser.parse(file.readable);
7373
assertEquals(assertionCount, 3);
7474
assertEquals(elementCount, 18);
7575
});

0 commit comments

Comments
 (0)