Skip to content

Commit 214f023

Browse files
committed
Updated StringToBoolean function
See issue pipwerks#3 for details.
1 parent 5fc00ed commit 214f023

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/JavaScript/SCORM_API_wrapper.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* ===========================================================
22
33
pipwerks SCORM Wrapper for JavaScript
4-
v1.1.20111123
4+
v1.1.20121005
55
66
Created by Philip Hutchison, January 2008
77
https://github.com/pipwerks/scorm-api-wrapper
@@ -790,6 +790,9 @@ pipwerks.SCORM.quit = pipwerks.SCORM.connection.terminate;
790790
pipwerks.UTILS.StringToBoolean = function(value){
791791
var t = typeof value;
792792
switch(t){
793+
//typeof new String("true") === "object", so handle objects as string via fall-through.
794+
//See https://github.com/pipwerks/scorm-api-wrapper/issues/3
795+
case "object":
793796
case "string": return (/(true|1)/i).test(value);
794797
case "number": return !!value;
795798
case "boolean": return value;

0 commit comments

Comments
 (0)