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

camo

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

camo - npm Package Compare versions

Comparing version 0.5.4 to 0.5.5

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## 0.5.5 (2015-07-15)
Bugfixes:
- Fixed issue where _id was being reassigned in Mongo, and fixed issue with populating references in Mongo.
- Fixed issue with Mongo driver where reference validation checks failed.
- Fixed test Issues.#4 for when running in Mongo.
## 0.5.4 (2015-07-09)

@@ -2,0 +9,0 @@

2

lib/base-document.js

@@ -395,3 +395,3 @@ "use strict";

dereferences.forEach(function(d) {
if (DB().toCanonicalId(d.id) === id) deref = d;
if (DB().toCanonicalId(d.id) === DB().toCanonicalId(id)) deref = d;
});

@@ -398,0 +398,0 @@

@@ -60,2 +60,6 @@ "use strict";

toNativeId(id) {
return this.nativeIdType()(id);
}
nativeIdType() {

@@ -62,0 +66,0 @@ throw new TypeError('You must override nativeIdType.');

@@ -98,2 +98,5 @@ "use strict";

_.keys(that._values).forEach(function(key) {
// Never care about _id
if (key === '_id') return;
if (isReferenceable(that._values[key]) || // isReferenceable OR

@@ -100,0 +103,0 @@ (isArray(that._values[key]) && // isArray AND contains value AND value isReferenceable

@@ -71,3 +71,3 @@ var _ = require('lodash');

} else if (type.documentClass && type.documentClass() === 'document') {
return isDocument(value) || isString(value);
return isDocument(value) || DB().isNativeId(value);
} else if (type.documentClass && type.documentClass() === 'embedded') {

@@ -74,0 +74,0 @@ return isEmbeddedDocument(value);

{
"name": "camo",
"version": "0.5.4",
"version": "0.5.5",
"description": "A class-based ES6 ODM for Mongo-like databases.",

@@ -5,0 +5,0 @@ "author": {

@@ -121,2 +121,38 @@ "use strict";

});
it('should allow nested initialization of embedded types', function(done) {
class Discount extends EmbeddedDocument {
constructor() {
super();
this.authorized = Boolean;
this.amount = Number;
}
}
class Product extends Document {
constructor() {
super('products');
this.name = String;
this.discount = Discount;
}
}
var product = Product.create({
name: 'bike',
discount: {
authorized: true,
amount: 9.99
}
});
product.save().then(function() {
validateId(product);
expect(product.name).to.be.equal('bike');
expect(product.discount).to.be.a('object');
expect(product.discount instanceof Discount).to.be.true;
expect(product.discount.authorized).to.be.equal(true);
expect(product.discount.amount).to.be.equal(9.99);
}).then(done, done);
});
});

@@ -123,0 +159,0 @@

@@ -87,3 +87,3 @@ "use strict";

// Get user1
var u1 = users[0].id === user1.id ? users[0] : users[1];
var u1 = String(users[0].id) === String(user1.id) ? users[0] : users[1];

@@ -93,8 +93,8 @@ // Ensure we have correct number of eyes...

var e1 = u1.eyes[0].id === eye1.id ? u1.eyes[0] : u1.eyes[1];
var e2 = u1.eyes[1].id === eye2.id ? u1.eyes[1] : u1.eyes[0];
var e1 = String(u1.eyes[0].id) === String(eye1.id) ? u1.eyes[0] : u1.eyes[1];
var e2 = String(u1.eyes[1].id) === String(eye2.id) ? u1.eyes[1] : u1.eyes[0];
// ...and that we have the correct eyes
expect(e1.id).to.be.equal(eye1.id);
expect(e2.id).to.be.equal(eye2.id);
expect(String(e1.id)).to.be.equal(String(eye1.id));
expect(String(e2.id)).to.be.equal(String(eye2.id));
}).then(done, done);

@@ -101,0 +101,0 @@ });

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