fluxo-js / fluxo

Fluxo is a simple, lightweight (~300LOC) and dependency free data infrastructure lib based on Facebook Flux and Backbone.js. It's compatible with React.js, but you can use with whatever you want to the view/component layer.
15 stars 3 forks source link

Error on toJSON dump when a computed property returns undefined #40

Closed fnmunhoz closed 8 years ago

fnmunhoz commented 8 years ago

Fluxo v0.0.23 is breaking when a computed property returns undefined.

The following code reproduces the error:

js
class Person extends Fluxo.ObjectStore {
  static computed = { something: ["change"] };

  something () {
    return undefined;
  }
}

x = new Person
x.toJSON()

The error message is: Uncaught SyntaxError: Unexpected token u in JSON at position 0

The error occurs on this line: https://github.com/fluxo-js/fluxo/blob/master/dist/fluxo.js#L572

Let me known if I can help. Thanks!

sobrinho commented 8 years ago

Fixed by 5a4c943442a98b0fee8f0fc7ada5a50f040d7743