Skip to content

Commit ab7dc1b

Browse files
author
Vlad Balin
committed
Hotfix - subsetOf.length
1 parent 4450015 commit ab7dc1b

File tree

7 files changed

+22
-4
lines changed

7 files changed

+22
-4
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/relations/subsetOf.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/relations/subsetOf.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/relations/subsetOf.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ function defineSubsetCollection( CollectionConstructor : typeof Collection ) {
9797
// Subset is always valid.
9898
_validateNested(){ return 0; }
9999

100+
get length() : number {
101+
return this.models.length || ( this.refs ? this.refs.length : 0 );
102+
}
103+
100104
// Must be shallow copied on clone.
101105
clone( owner? ){
102106
var Ctor = (<any>this).constructor,

tests/typescript/dist/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3358,6 +3358,13 @@ function defineSubsetCollection(CollectionConstructor) {
33583358
this.models.map(function (model) { return model.id; });
33593359
};
33603360
SubsetOfCollection.prototype._validateNested = function () { return 0; };
3361+
Object.defineProperty(SubsetOfCollection.prototype, "length", {
3362+
get: function () {
3363+
return this.models.length || (this.refs ? this.refs.length : 0);
3364+
},
3365+
enumerable: true,
3366+
configurable: true
3367+
});
33613368
SubsetOfCollection.prototype.clone = function (owner) {
33623369
var Ctor = this.constructor, copy = new Ctor([], {
33633370
model: this.model,

tests/typescript/dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)