11/**
22* @author Jason Dobry <jason.dobry@gmail.com>
33* @file angular-data.js
4- * @version 0.9.0 - Homepage <http://angular-data.codetrain.io/>
4+ * @version 0.9.1 - Homepage <http://angular-data.codetrain.io/>
55* @copyright (c) 2014 Jason Dobry <https://github.com/jmdobry/>
66* @license MIT <https://github.com/jmdobry/angular-data/blob/master/LICENSE>
77*
@@ -1570,7 +1570,9 @@ function DSHttpAdapterProvider() {
15701570 options = options || { } ;
15711571 options . params = options . params || { } ;
15721572 if ( params ) {
1573- params . query = params . query ? defaults . queryTransform ( resourceConfig . name , params . query ) : params . query ;
1573+ if ( params . query ) {
1574+ params . query = defaults . queryTransform ( resourceConfig . name , params . query ) ;
1575+ }
15741576 DSUtils . deepMixIn ( options . params , params ) ;
15751577 }
15761578 return this . DEL (
@@ -1591,7 +1593,9 @@ function DSHttpAdapterProvider() {
15911593 options = options || { } ;
15921594 options . params = options . params || { } ;
15931595 if ( params ) {
1594- params . query = params . query ? defaults . queryTransform ( resourceConfig . name , params . query ) : params . query ;
1596+ if ( params . query ) {
1597+ params . query = defaults . queryTransform ( resourceConfig . name , params . query ) ;
1598+ }
15951599 DSUtils . deepMixIn ( options . params , params ) ;
15961600 }
15971601 return this . GET (
@@ -1613,7 +1617,9 @@ function DSHttpAdapterProvider() {
16131617 options = options || { } ;
16141618 options . params = options . params || { } ;
16151619 if ( params ) {
1616- params . query = params . query ? defaults . queryTransform ( resourceConfig . name , params . query ) : params . query ;
1620+ if ( params . query ) {
1621+ params . query = defaults . queryTransform ( resourceConfig . name , params . query ) ;
1622+ }
16171623 DSUtils . deepMixIn ( options . params , params ) ;
16181624 }
16191625 return this . PUT (
@@ -2302,7 +2308,7 @@ function _findAll(utils, resourceName, params, options) {
23022308 * ```
23032309 *
23042310 * @param {string } resourceName The resource type, e.g. 'user', 'comment', etc.
2305- * @param {object } params Parameter object that is serialized into the query string. Properties:
2311+ * @param {object= } params Parameter object that is serialized into the query string. Properties:
23062312 *
23072313 * - `{object=}` - `query` - The query object by which to filter items of the type specified by `resourceName`. Properties:
23082314 * - `{object=}` - `where` - Where clause.
@@ -2332,6 +2338,7 @@ function findAll(resourceName, params, options) {
23322338 _this = this ;
23332339
23342340 options = options || { } ;
2341+ params = params || { } ;
23352342
23362343 if ( ! this . definitions [ resourceName ] ) {
23372344 deferred . reject ( new this . errors . RuntimeError ( errorPrefix + resourceName + ' is not a registered resource!' ) ) ;
@@ -4048,7 +4055,7 @@ var errorPrefix = 'DS.filter(resourceName, params[, options]): ';
40484055 * - `{UnhandledError}`
40494056 *
40504057 * @param {string } resourceName The resource type, e.g. 'user', 'comment', etc.
4051- * @param {object } params Parameter object that is serialized into the query string. Properties:
4058+ * @param {object= } params Parameter object that is serialized into the query string. Properties:
40524059 *
40534060 * - `{object=}` - `query` - The query object by which to filter items of the type specified by `resourceName`. Properties:
40544061 * - `{object=}` - `where` - Where clause.
@@ -4065,7 +4072,7 @@ function filter(resourceName, params, options) {
40654072
40664073 if ( ! this . definitions [ resourceName ] ) {
40674074 throw new this . errors . RuntimeError ( errorPrefix + resourceName + ' is not a registered resource!' ) ;
4068- } else if ( ! this . utils . isObject ( params ) ) {
4075+ } else if ( params && ! this . utils . isObject ( params ) ) {
40694076 throw new this . errors . IllegalArgumentError ( errorPrefix + 'params: Must be an object!' , { params : { actual : typeof params , expected : 'object' } } ) ;
40704077 } else if ( ! this . utils . isObject ( options ) ) {
40714078 throw new this . errors . IllegalArgumentError ( errorPrefix + 'options: Must be an object!' , { options : { actual : typeof options , expected : 'object' } } ) ;
@@ -4077,7 +4084,7 @@ function filter(resourceName, params, options) {
40774084 _this = this ;
40784085
40794086 // Protect against null
4080- params . query = params . query || { } ;
4087+ params = params || { } ;
40814088
40824089 var queryHash = this . utils . toJson ( params ) ;
40834090
@@ -4090,6 +4097,7 @@ function filter(resourceName, params, options) {
40904097 }
40914098 }
40924099
4100+ params . query = params . query || { } ;
40934101 // The query has been completed, so hit the cache with the query
40944102 var filtered = this . utils . filter ( resource . collection , function ( attrs ) {
40954103 var keep = true ,
0 commit comments