Skip to content

Commit

Permalink
Merge pull request #25 from xob/fix_count
Browse files Browse the repository at this point in the history
Fix _count returning an empty string when length is 0
  • Loading branch information
xob authored Mar 3, 2020
2 parents 7ab2f58 + 6ad163f commit 42ccaf2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simplify-scorm",
"version": "1.1.0",
"version": "1.1.1",
"description": "",
"license": "MIT",
"private": true,
Expand All @@ -22,6 +22,7 @@
"sinon-chai": "^3.0.0"
},
"scripts": {
"build": "grunt",
"test": "grunt test"
}
}
10 changes: 5 additions & 5 deletions src/scormAPI2004.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Scorm 2004 Overview for Developers: https://scorm.com/scorm-explained/technical-scorm/scorm-2004-overview-for-developers/
* Run-Time Reference: http://scorm.com/scorm-explained/technical-scorm/run-time/run-time-reference/
* Scorm specification: https://adlnet.gov/research/scorm/scorm-2004-4th-edition/
* Testing requirements: https://adlnet.gov/wp-content/uploads/2011/07/SCORM_2004_4ED_v1_1_TR_20090814.pdf
* Testing requirements: https://adlnet.gov/assets/uploads/SCORM_2004_4ED_v1_1_TR_20090814.pdf
*
* SPM = Smallest Permitted Maximum
*/
Expand Down Expand Up @@ -654,7 +654,7 @@
set _children(_children) { API.throwSCORMError(404); },

childArray: [],
get _count() { return this.childArray.length; },
get _count() { return String(this.childArray.length); },
set _count(_count) { API.throwSCORMError(404); },

toJSON: jsonFormatter
Expand Down Expand Up @@ -691,7 +691,7 @@
set _children(_children) { API.throwSCORMError(404); },

childArray: [],
get _count() { return this.childArray.length; },
get _count() { return String(this.childArray.length); },
set _count(_count) { API.throwSCORMError(404); },

toJSON: jsonFormatter
Expand Down Expand Up @@ -798,7 +798,7 @@
objectives: {
// SPM 10 interaction's objectives
childArray: [],
get _count() { return this.childArray.length; },
get _count() { return String(this.childArray.length); },
set _count(_count) { API.throwSCORMError(404); },

toJSON: jsonFormatter
Expand All @@ -807,7 +807,7 @@
correct_responses: {
// SPM changes based on interaction's type
childArray: [],
get _count() { return this.childArray.length; },
get _count() { return String(this.childArray.length); },
set _count(_count) { API.throwSCORMError(404); },

toJSON: jsonFormatter
Expand Down

0 comments on commit 42ccaf2

Please sign in to comment.