Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- fixed visiting of the `null` and `undefined` values

  • Loading branch information...
commit a59d71c898f7c0d4e93c00143ee224b39fa4b827 1 parent 00fd0be
Nickolay Platonov authored
Showing with 6 additions and 2 deletions.
  1. +2 −2 lib/Data/Visitor.js
  2. +4 −0 t/010_basics.t.js
View
4 lib/Data/Visitor.js
@@ -19,11 +19,11 @@ Class('Data.Visitor', {
var res = Joose.A.map(arguments, function (value) {
- if (value && typeof value == 'object' || typeof value == 'function') {
+ if (value != null && (typeof value == 'object' || typeof value == 'function')) {
var ref = value.__REFADR__
- if (ref != null && seen[ ref ])
+ if (seen[ ref ])
return this.visitSeen(value, seen[ ref ])
else
return this.visitNotSeen(value)
View
4 t/010_basics.t.js
@@ -13,11 +13,15 @@ StartTest(function(t) {
var data2 = []
var data3 = 10
var data4 = true
+ var data5 = null
+ var data6 = undefined
t.ok(data1 === Data.Visitor.my.visit(data1), "Visiting don't modify the data #1")
t.ok(data2 === Data.Visitor.my.visit(data2), "Visiting don't modify the data #2")
t.ok(data3 === Data.Visitor.my.visit(data3), "Visiting don't modify the data #3")
t.ok(data4 === Data.Visitor.my.visit(data4), "Visiting don't modify the data #4")
+ t.ok(data5 === Data.Visitor.my.visit(data5), "Visiting don't modify the data #5")
+ t.ok(data6 === Data.Visitor.my.visit(data6), "Visiting don't modify the data #6")
//======================================================================================================================================================================================================================================================
Please sign in to comment.
Something went wrong with that request. Please try again.