Skip to content

Commit ccdc1ff

Browse files
committed
Merge pull request #97 from aisk/master
add relation constructor type check
2 parents 713f60a + 7c6a30e commit ccdc1ff

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/relation.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
* </p>
2020
*/
2121
AV.Relation = function(parent, key) {
22+
if (! _.isString(key)) {
23+
throw TypeError('key must be a string');
24+
}
2225
this.parent = parent;
2326
this.key = key;
2427
this.targetClassName = null;

test/query.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,3 +353,5 @@ describe("Queries",function(){
353353
});
354354

355355
});
356+
357+
});

0 commit comments

Comments
 (0)