knadh / localStorageDB

A simple database layer for localStorage and sessionStorage for creating structured data in the form of databases and tables
http://nadh.in/code/localstoragedb
814 stars 128 forks source link

Better type checking for updates #16

Closed albertogasparin closed 7 years ago

albertogasparin commented 11 years ago

This code updates all the records instead of none:

db.insertOrUpdate("table", { field: 0 }, { 'field': 5 });

The issue should be on validFields() function, where you are doing a "simple" if(data[field]) instead of a type checking.

w35l3y commented 7 years ago

It was fixed in Nov 4th, 2013 and updated in Mar 13rd, 2014

https://github.com/knadh/localStorageDB/blame/ab7c0a227ecaecbe6c92db98e4ce831994cd6dfc/localstoragedb.js#L346 https://github.com/knadh/localStorageDB/blame/master/localstoragedb.js#L387

This issue may be closed.