question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Drop TextEncoder requirement

See original GitHub issue

The need for TextEncoder is limited and it is not supported (without expensive polyfills) on IE or Edge.

It is easily replaced as follows:

// modified from source: http://stackoverflow.com/a/11058858
export function str2ab(str: string) {
  const buf = new ArrayBuffer(str.length);
  const bufView = new Uint8Array(buf);
  for (let i = 0; i < str.length; i++) {
    bufView[i] = str.charCodeAt(i);
  }
  return buf;
}

crypto.subtle.digest('SHA-256', str2ab(code))

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
tikurahulcommented, Nov 30, 2018

Sorry about the delay. Have been swamped with a lot of other things.

AppAuth-JS 1.1.2 is now live. https://www.npmjs.com/package/@openid/appauth

Now uses TypeScript 3.2.1.

0reactions
jurepurgarcommented, Nov 21, 2018

OK great. Let us know when it is available 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add support for TextEncoder and TextDecoder #2524 - GitHub
There is no plan to stop requiring the latest Node.js releases in the new major versions. You can use the old unsupported versions...
Read more >
TextDecoder TextEncoder feature detection in javascript
Is there any drop in libraries that would pollyfill? And if it does not exist can I conditionally load a pollyfill. I do...
Read more >
TextEncoder - Web APIs - MDN Web Docs
Chrome Edge TextEncoder Full support. Chrome38. Toggle history Full support. Edge79. To... TextEncoder() constructor Full support. Chrome38. Toggle history Full support. Edge79. To... encode Full support....
Read more >
TextEncoder is not defined | NodeJs | MongoDB | Solved
TextEncoder is not definedReference ErrorPath for required filenode_modules/whatwg-url/encoding.jsThanks# TextEncoder #mongodb #nodejs.
Read more >
The Plug and Play of Language Models for Text-to-image ...
Without the finetuning step, performance actually drops. Therefore it is not strictly “plug and play” of the new text encoder and the MTN....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found