save (updateData, callback, id) {
		var data = JSON.parse(localStorage[this._dbName]);
		var todos = data.todos;
		
		callback = callback || function () { };

		// If an ID was actually given, find the item and update each property
		if (id !== undefined && id !== null) {
			for (var i = 0; i < todos.length; i++) {
				if (todos[i].id === id) {
					for (var key in updateData) {
						todos[i][key] = updateData[key];
					}
					break;
				}
			}

			localStorage[this._dbName] = JSON.stringify(data);
			callback.call(this, todos);
		} else {
			// Assign an ID
			updateData.id = this.index;
			// Increment the store index to make sure we have a unique id
			this.index ++;
			
			todos.push(updateData);
			localStorage[this._dbName] = JSON.stringify(data);
			callback.call(this, [updateData]);
		}
	}
/**
	 * Will save the given data to the DB. If no item exists it will create a new
	 * item, otherwise it'll simply update an existing item's properties
	 * 
	 * When a new item is created, current Store instance's index is used as unique id
	 * then index is incremented
	 * 
	 * @param {object} updateData The data to save back into the DB
	 * @param {function} callback The callback to fire after saving
	 * @param {number} id An optional param to enter an ID of an item to update.
	 */
Will save the given data to the DB. If no item exists it will create a new
item, otherwise it'll simply update an existing item's properties

When a new item is created, current Store instance's index is used as unique id
then index is incremented

@param {object} updateData The data to save back into the DB
@param {function} callback The callback to fire after saving
@param {number} id An optional param to enter an ID of an item to update.
Will save the given data to the DB . If no item exists it will create a new item otherwise it ' ll simply update an existing item ' s properties When a new item is created current Store instance ' s index is used as unique id then index is incremented @param { object } updateData The data to save back into the DB @param { function } callback The callback to fire after saving @param { number } id An optional param to enter an ID of an item to update .
save (updateData, callback, id) {
		var data = JSON.parse(localStorage[this._dbName]);
		var todos = data.todos;
		callback = callback || function () { };
		if (id !== undefined && id !== null) {
			for (var i = 0; i < todos.length; i++) {
				if (todos[i].id === id) {
					for (var key in updateData) {
						todos[i][key] = updateData[key];
					}
					break;
				}
			}
			localStorage[this._dbName] = JSON.stringify(data);
			callback.call(this, todos);
		} else {
			updateData.id = this.index;
			this.index ++;
			todos.push(updateData);
			localStorage[this._dbName] = JSON.stringify(data);
			callback.call(this, [updateData]);
		}
	}
save ( updateData , callback , id ) { var data = JSON . parse ( localStorage [ this . _dbName ] ) ; var todos = data . todos ; callback = callback || function ( ) { } ; if ( id !== undefined && d  ==  ull) for ( var i = 0 ; i < todos . length ; i ++ ) { if ( todos [ i ] . id === id ) { for ( var key in updateData ) { todos [ i ] [ key ] = updateData [ key ] ; } break ; } } localStorage [ this . _dbName ] = JSON . stringify ( data ) ; callback . call ( this , todos ) ; } else { updateData . id = this . index ; this . index ++ ; todos . push ( updateData ) ; localStorage [ this . _dbName ] = JSON . stringify ( data ) ; callback . call ( this , [ updateData ] ) ; } }
Will save the given data to the DB.
Will save the given data to the DB .
// If an ID was actually given, find the item and update each property // Assign an ID // Increment the store index to make sure we have a unique id