Skip to content

Commit

Permalink
AuthenticationApi - update TextEncoderLite to a version which exports…
Browse files Browse the repository at this point in the history
… the encoder

and explicitly say window.TextEncoder for when it doesn't exist
  • Loading branch information
himdel committed Mar 27, 2018
1 parent bdbc83b commit 1384c4a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions client/app/core/authentication-api.factory.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import base64js from 'base64-js'
import TextEncoderLite from 'text-encoder-lite'
const TextEncoderLite = require('text-encoder-lite').TextEncoderLite

// utf8-capable window.btoa
function base64encode (str, encoding = 'utf-8') {
let bytes = new (TextEncoder || TextEncoderLite)(encoding).encode(str)
let bytes = new (window.TextEncoder || TextEncoderLite)(encoding).encode(str)
return base64js.fromByteArray(bytes)
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"sprintf-js": "1.1.1",
"standard-loader": "6.0.1",
"style-loader": "0.20.2",
"text-encoder-lite": "1.0.1",
"text-encoder-lite": "git://github.com/coolaj86/TextEncoderLite.git#e1e031b",
"ts-loader": "3.5.0",
"typescript": "2.7.2",
"ui-select": "0.19.8",
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9304,9 +9304,9 @@ test-exclude@^4.1.1:
read-pkg-up "^1.0.1"
require-main-filename "^1.0.1"

text-encoder-lite@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/text-encoder-lite/-/text-encoder-lite-1.0.1.tgz#121c5ee74dfeb307037770ec75748c6824ac0518"
"text-encoder-lite@git://github.com/coolaj86/TextEncoderLite.git#e1e031b":
version "1.0.2"
resolved "git://github.com/coolaj86/TextEncoderLite.git#e1e031b4a7fb89c35629340a61a06ec4f50ce7cb"

text-encoding@^0.6.4:
version "0.6.4"
Expand Down

0 comments on commit 1384c4a

Please sign in to comment.