kahoot.js-fix

0.2.0 • Public • Published

kahoot.js fix

Fixes one two critical bugs in kahoot.js-updated.

The bugs

The first

In the file src/modules/backup.js, kahoot.js tries to get an array from a property after parsing a response from the Kahoot API. However, this property doesn't always exist.

this.quiz.quizQuestionAnswers = recover.defaultQuizData.quizQuestionAnswers
//                                      ^^^^^^^^^^^^^^^
//                                    this might not exist

The value recover is retrieved via JSON.parse, so this library simply patches JSON.parse using a Proxy. If defaultQuizData doesn't exist, its last existant value is returned. If there is no last valid value, an empty array is returned.

The second

In another part of the code, there's an attempt to get the key quizQuestionAnswers from a different object. This key, shockingly, is also missing here! The last valid value or an empty array is also returned in this case.

License

This project is licensed under either of

at your option.

Package Sidebar

Install

npm i kahoot.js-fix

Weekly Downloads

1

Version

0.2.0

License

MIT OR Apache-2.0

Unpacked Size

15.6 kB

Total Files

5

Last publish

Collaborators

  • mysteryblokhed