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

ampersand-collection

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ampersand-collection - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

11

ampersand-collection.js

@@ -304,5 +304,10 @@ var BackboneEvents = require('backbone-events-standalone');

Object.defineProperty(Collection.prototype, 'length', {
get: function () {
return this.models.length;
Object.defineProperties(Collection.prototype, {
length: {
get: function () {
return this.models.length;
}
},
isCollection: {
value: true
}

@@ -309,0 +314,0 @@ });

{
"name": "ampersand-collection",
"version": "1.2.0",
"version": "1.3.0",
"author": "Henrik Joreteg <henrik@andyet.net>",

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

@@ -66,2 +66,10 @@ # ampersand-collection

```
## A quick note about instanceof checks
With npm and browserify for module deps you can sometimes end up with a situation where, the same `collection` constructor wasn't used to build a `collection` object. As a result `instanceof` checks will fail.
In order to deal with this (because sometimes this is a legitimate scenario), `collection` simply creates a read-only `isCollection` property on all collection objects that can be used to check whether or a not a given object is in fact a collection object no matter what its constructor was.
<!-- starthide -->

@@ -68,0 +76,0 @@

@@ -225,1 +225,9 @@ var test = require('tape');

});
test('Ensure `isCollection` exists and is immutable', function (t) {
var c = new Collection();
t.ok(c.isCollection);
c.isCollection = false;
t.ok(c.isCollection);
t.end();
});
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