Navigation Menu

Skip to content

Commit

Permalink
Don't modify the original object given to toGrnDumpRecord
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 13, 2012
1 parent 7f18499 commit 6478874
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lib/database/domain.js
Expand Up @@ -359,9 +359,12 @@ Domain.prototype = {
},

toGrnDumpRecord: function(record) {
record['_key'] = record['id'];
delete record['id'];
return record;
var grnDumpRecord = {};
Object.keys(record).forEach(function(key) {
var grnDumpKey = key == '_key' ? 'id' : key ;
grnDumpRecord[grnDumpKey] = record[key];
});
return grnDumpRecord;
},

addRecordSync: function(record) {
Expand All @@ -372,12 +375,6 @@ Domain.prototype = {
});
},

toDumpRecord: function(record) {
record['id'] = record['_key'];
delete record['_key'];
return record;
},

deleteRecordSync: function(id) {
this.context.commandSync('delete', {
table: this.tableName,
Expand Down

0 comments on commit 6478874

Please sign in to comment.