diff --git a/.gitignore b/.gitignore index 14dbadc..a84a8f3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .DS_Store node_modules npm-debug.log +.idea \ No newline at end of file diff --git a/README.md b/README.md index 9241e86..04e9ea6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +NOTE +==== +This is a patched and npm-published version of https://github.com/redpie/backbone-schema + Backbone.Schema =============== diff --git a/backbone-schema.js b/backbone-schema.js index 4b32cde..94a9317 100644 --- a/backbone-schema.js +++ b/backbone-schema.js @@ -887,7 +887,7 @@ if(this.schema) { _.each(this.schema.properties, function(property, name) { var attribute = this.attributes[name]; - if(attribute) { + if ([undefined, null].indexOf(attribute) === -1) { var value; if(this.schemaRelations[name]) { value = attribute.toJSON(options); @@ -1501,10 +1501,6 @@ var toReturn; if(this.schema) { var models = this.models; - if(models.length === 0) { - return undefined; - } - toReturn = []; _.each(models, function(model) { var value = model.toJSON(options); diff --git a/package.json b/package.json index 5c25de8..bdad9a7 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,8 @@ { - "name" : "backbone-schema", - "description" : "Create Backbone models and collections from JSON Schema", + "name" : "backbone-json-schema", + "description" : "A patched and npm published fork of https://github.com/redpie/backbone-schema --- Create Backbone models and collections from JSON Schema", "keywords" : ["Backbone", "schema", "json", "jsonschema", "nested", "model", "collection"], - "repository" : "git://github.com/redpie/backbone-schema.git", - "author" : "Redpie", + "repository" : "git://github.com/Reggino/backbone-json-schema.git", "contributors" : "Listed at ", "dependencies" : { "backbone": ">=0.9.2",