examples/todomvc/js/models/model.js
function (query, callback) {
        var queryType = typeof query;
        callback = callback || function () { };

        if (queryType === 'function') {
          callback = query;
          storage.findAll(callback);
        } else if (queryType === 'string' || queryType === 'number') {
          query = parseInt(query, 10);
          storage.find({ id: query }, callback);
        } else {
          storage.find(query, callback);
        }
      }
function (query, callback) {
        var queryType = typeof query;
        callback = callback || function () { };

        if (queryType === 'function') {
          callback = query;
          storage.findAll(callback);
        } else if (queryType === 'string' || queryType === 'number') {
          query = parseInt(query, 10);
          storage.find({ id: query }, callback);
        } else {
          storage.find(query, callback);
        }
      }
function ( query , callback ) { var queryType = typeof query ; callback = callback || function ( ) { } ; if ( queryType === 'function' ) { callback = query ; storage . findAll ( callback ) ; } else if ( queryType === 'string' || queryType === 'number' ) { query = parseInt ( query , 10 ) ; storage . find ( { id : query } , callback ) ; } else { storage . find ( query , callback ) ; } }
Finds and returns a model in storage. If no query is given it'll simply
return everything. If you pass in a string or number it'll look that up as
the ID of the model to find. Lastly, you can pass it an object to match
against.

@param {string|number|object} [query] A query to match models against
@param {function} [callback] The callback to fire after the model is found

@example
model.read(1, func); // Will find the model with an ID of 1
model.read('1'); // Same as above
//Below will find a model with foo equalling bar and hello equalling world.
model.read({ foo: 'bar', hello: 'world' });
Finds and returns a model in storage . If no query is given it ll simply return everything . If you pass in a string or number it ll look that up as the ID of the model to find . Lastly you can pass it an object to match against .