From 31a64c2d7c7bca187a3895006cfda9f282513e50 Mon Sep 17 00:00:00 2001 From: kohalmyk Date: Tue, 16 Aug 2016 18:23:59 +0200 Subject: [PATCH] modelObject check if idField is given in data by checking typeof data[idField] (instead of !data[idField] which causes error throwing in case of data[idField] is 0). --- package.json | 2 +- src/model/modelObject.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b9b917f..a0569c8 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.1.11", + "version": "0.1.12", "name": "superdata", "description": "A ligth weight data layer module motivated by extjs' data layer. It can be used with any client-side framework.", "main": "src/superData.js", diff --git a/src/model/modelObject.js b/src/model/modelObject.js index 4190ff9..c1ab707 100644 --- a/src/model/modelObject.js +++ b/src/model/modelObject.js @@ -24,7 +24,7 @@ module.exports = function createModelObject(options) { throw new Error("options.model.idField is mandatory!"); } - if(!options.data[options.model.idField]) { + if (typeof options.data[options.model.idField] === "undefined") { throw new Error("options.data has to have a property with same name as value of options.model.idField!"); }