[Pkg-javascript-commits] [json-js] 48/85: For Kyle

Jonas Smedegaard dr at jones.dk
Mon Mar 14 10:39:29 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository json-js.

commit 40f3377a631eaedeec877379f9cb338046cac0e0
Author: Douglas Crockford <douglas at crockford.com>
Date:   Sun Aug 19 10:25:51 2012 -0700

    For Kyle
---
 cycle.js | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/cycle.js b/cycle.js
index ca9a7b3..7187bf4 100644
--- a/cycle.js
+++ b/cycle.js
@@ -1,6 +1,6 @@
 /*
     cycle.js
-    2012-07-18
+    2012-08-19
 
     Public Domain.
 
@@ -54,9 +54,15 @@ if (typeof JSON.decycle !== 'function') {
             case 'object':
 
 // typeof null === 'object', so get out if this value is not really an object.
-
-                if (!value) {
-                    return null;
+// Also get out if it is a weird builtin object.
+
+                if (value === null ||
+                        value instanceof Boolean ||
+                        value instanceof Date    ||
+                        value instanceof Number  ||
+                        value instanceof RegExp  ||
+                        value instanceof String) {
+                    return value;
                 }
 
 // If the value is an object or array, look to see if we have already

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/json-js.git



More information about the Pkg-javascript-commits mailing list