baselinejs
Advanced tools
Comparing version 7.0.2 to 7.1.0
@@ -272,3 +272,3 @@ var _ = require( 'underscore' ); | ||
// `filter`. | ||
where : function( attrs, first ) { | ||
where : function( attrs, first, ignoreMissingData ) { | ||
var _this = this; | ||
@@ -278,3 +278,3 @@ if( _.isEmpty( attrs ) ) return first ? void 0 : []; | ||
for( var key in attrs ) { | ||
if( _.isUndefined( _this._recordsById[ thisRecordId ][ key ] ) ) throw new Error( 'Field \'' + key + '\' is not present for record id ' + thisRecordId + ' in table \'' + _this.collectionName + '\'.' ); | ||
if( ! ignoreMissingData && _.isUndefined( _this._recordsById[ thisRecordId ][ key ] ) ) throw new Error( 'Field \'' + key + '\' is not present for record id ' + thisRecordId + ' in table \'' + _this.collectionName + '\'.' ); | ||
if( attrs[ key ] !== _this._recordsById[ thisRecordId ][ key ] ) return false; | ||
@@ -288,4 +288,4 @@ } | ||
// of `find`. | ||
findWhere : function( attrs ) { | ||
return this.where( attrs, true ); | ||
findWhere : function( attrs, ignoreMissingData ) { | ||
return this.where( attrs, true, ignoreMissingData ); | ||
}, | ||
@@ -339,3 +339,3 @@ | ||
if( method != 'create' && ! _.isArray( recordIdOrIds ) ) { | ||
if( _.contains( [ 'update', 'delete', 'patch', 'get' ], method ) && ! _.isArray( recordIdOrIds ) ) { | ||
endpoint = endpoint.replace( /([^\/])$/, '$1/' ) + encodeURIComponent( recordId ); | ||
@@ -388,3 +388,4 @@ } | ||
'delete' : 'DELETE', | ||
'get' : 'GET' | ||
'get' : 'GET', | ||
'search' : 'SEARCH' | ||
}; | ||
@@ -398,3 +399,3 @@ | ||
contentType : 'application/json', | ||
data : method === 'get' ? undefined : JSON.stringify( payload ) | ||
data : _.isEmpty( payload ) ? undefined : JSON.stringify( payload ) | ||
}; | ||
@@ -401,0 +402,0 @@ |
{ | ||
"name": "baselinejs", | ||
"version": "7.0.2", | ||
"version": "7.1.0", | ||
"description": "Share code and data between the client and the server in full stack JavaScript applications.", | ||
@@ -5,0 +5,0 @@ "main": "baseline.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
109341
379
10