Skip to content

Commit

Permalink
fix ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
samthor committed Aug 30, 2022
1 parent 472a322 commit 60d0a6c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/o-encoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { encodeFallback } from './lowlevel.js';
import { maybeThrowFailedToOption } from './shared.js';
import { hasBufferFrom } from './support.js';

export var encodeImpl = hasBufferFrom ? encodeFallback : encodeBuffer;
export var encodeImpl = hasBufferFrom ? encodeBuffer : encodeFallback;

/**
* @constructor
Expand Down
4 changes: 4 additions & 0 deletions test-setup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

if (typeof global === 'undefined') {
var global = globalThis;
}

const NativeTextEncoder = global.TextEncoder;
const NativeTextDecoder = global.TextDecoder;

Expand Down
9 changes: 8 additions & 1 deletion test.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html>
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="node_modules/mocha/mocha.css" />
<script type="module">

import {
Expand All @@ -15,6 +14,14 @@
window._NativeTextEncoder = NativeTextEncoder;
window._NativeTextDecoder = NativeTextDecoder;


const src = 'hello t£¡™fgafsadknl1\x00here ™£a';

const b = new TextEncoder().encode(src);
const o = new TextDecoder().decode(b);
console.info('b', b, 'out', o, 'eq', o === src);


</script>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion text.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 60d0a6c

Please sign in to comment.