Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

baselinejs

Package Overview
Dependencies
Maintainers
4
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

baselinejs - npm Package Compare versions

Comparing version 8.2.0 to 9.0.0

36

collectionService.js

@@ -6,2 +6,3 @@ var _ = require( 'underscore' );

var $ = require( 'jquery' );
var whereQuery = require( 'where-query' );

@@ -291,12 +292,23 @@ require('es6-promise').polyfill();

// Return records with matching attributes. Useful for simple cases of
// `filter`.
where : function( attrs, first, ignoreMissingData ) {
// `filter`. Unlike in underscore, if values of attrs is an array, then
// a record will be included in the return if the corresponding attribute
// on the record is included in the elements of attrs.
where : function( attrs, options ) {
var _this = this;
if( _.isEmpty( attrs ) ) return first ? void 0 : [];
return this[ first ? 'find' : 'filter' ]( function( thisRecordId ) {
for( var key in attrs ) {
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;
options = _.defaults( {}, options, {
first : false,
ignoreMissingData : false,
} );
if( _.isEmpty( attrs ) ) return options.first ? void 0 : [];
return this[ options.first ? 'find' : 'filter' ]( function( thisRecordId ) {
if( ! ignoreMissingData ) {
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 + '\'.' );
}
}
return true;
return whereQuery.matches( _this._recordsById[ thisRecordId ], attrs );
} );

@@ -307,4 +319,8 @@ },

// of `find`.
findWhere : function( attrs, ignoreMissingData ) {
return this.where( attrs, true, ignoreMissingData );
findWhere : function( attrs, options ) {
options = _.defaults( {}, options, {
ignoreMissingData : false,
} );
return this.where( attrs, { first : true, ignoreMissingData : options.ignoreMissingData } );
},

@@ -311,0 +327,0 @@

{
"name": "baselinejs",
"version": "8.2.0",
"version": "9.0.0",
"description": "Share code and data between the client and the server in full stack JavaScript applications.",

@@ -12,3 +12,4 @@ "main": "baseline.js",

"backbone-events-standalone": "^0.2.1",
"class-con-leche": "~0.0.0",
"matches-where-query": "^1.0.0",
"class-con-leche": "^0.0.0",
"es6-promise": "^4.1.1",

@@ -15,0 +16,0 @@ "jquery": "^2.1.4",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc