Skip to content

Commit 60d0a6c

Browse files
committed
fix ordering
1 parent 472a322 commit 60d0a6c

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

src/o-encoder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { encodeFallback } from './lowlevel.js';
33
import { maybeThrowFailedToOption } from './shared.js';
44
import { hasBufferFrom } from './support.js';
55

6-
export var encodeImpl = hasBufferFrom ? encodeFallback : encodeBuffer;
6+
export var encodeImpl = hasBufferFrom ? encodeBuffer : encodeFallback;
77

88
/**
99
* @constructor

test-setup.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11

2+
if (typeof global === 'undefined') {
3+
var global = globalThis;
4+
}
5+
26
const NativeTextEncoder = global.TextEncoder;
37
const NativeTextDecoder = global.TextDecoder;
48

test.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<html>
33
<head>
44
<meta charset="UTF-8" />
5-
<link rel="stylesheet" href="node_modules/mocha/mocha.css" />
65
<script type="module">
76

87
import {
@@ -15,6 +14,14 @@
1514
window._NativeTextEncoder = NativeTextEncoder;
1615
window._NativeTextDecoder = NativeTextDecoder;
1716

17+
18+
const src = 'hello t£¡™fgafsadknl1\x00here ™£a';
19+
20+
const b = new TextEncoder().encode(src);
21+
const o = new TextDecoder().decode(b);
22+
console.info('b', b, 'out', o, 'eq', o === src);
23+
24+
1825
</script>
1926
</head>
2027
<body>

text.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)