Permalink
Browse files

Fixed global var leakage.

  • Loading branch information...
1 parent c234edd commit 60a6891652569ef107d07466738c5949052aba7e @bnoguchi bnoguchi committed May 9, 2011
Showing with 3 additions and 1 deletion.
  1. +2 −0 lib/mongoose/document.js
  2. +1 −1 lib/mongoose/schematype.js
View
@@ -188,6 +188,7 @@ Document.prototype.pre = function (method, fn) {
*/
Document.prototype.set = function (path, val, type) {
+ var adhocs;
if (type) {
adhocs = this._adhocPaths || (this._adhocPaths = {});
adhocs[path] = Schema.interpretAsType(path, type);
@@ -353,6 +354,7 @@ Document.prototype.doCast = function (path) {
*/
Document.prototype.get = function (path, type) {
+ var adhocs;
if (type) {
adhocs = this._adhocPaths || (this._adhocPaths = {});
adhocs[path] = Schema.interpretAsType(path, type);
@@ -180,7 +180,7 @@ SchemaType.prototype.applySetters = function (value, scope) {
var v = value
, setters = this.setters
, l = setters.length;
- for (k = l - 1; k >= 0; k--){
+ for (var k = l - 1; k >= 0; k--){
v = setters[k].call(scope, v);
if (v === null || v === undefined) return v;
v = this.cast(v, scope);

0 comments on commit 60a6891

Please sign in to comment.