Comparing version 1.0.3 to 1.0.4
@@ -99,6 +99,18 @@ module.exports = function(utils) { | ||
Store.prototype.remove = function(type, id) { | ||
var index; | ||
index = this.records.indexOf(this.findRecord(type, id)); | ||
if (!(index < 0)) { | ||
return this.records.splice(index, 1); | ||
var records, remove; | ||
type = this.types[type] || type; | ||
remove = (function(_this) { | ||
return function(record) { | ||
var index; | ||
index = _this.records.indexOf(record); | ||
if (!(index < 0)) { | ||
return _this.records.splice(index, 1); | ||
} | ||
}; | ||
})(this); | ||
if (id != null) { | ||
return remove(this.findRecord(type, id)); | ||
} else { | ||
records = this.findRecords(type); | ||
return records.forEach(remove); | ||
} | ||
@@ -110,5 +122,7 @@ }; | ||
this.setupRelations(data.links); | ||
delete data.links; | ||
_results = []; | ||
for (name in data) { | ||
if (name === 'meta' || name === 'links') { | ||
continue; | ||
} | ||
value = data[name]; | ||
@@ -115,0 +129,0 @@ add = (function(_this) { |
{ | ||
"name": "yayson", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A library for serializing and reading JSON API standardized data in JavaScript.", | ||
@@ -5,0 +5,0 @@ "main": "lib/yayson.js", |
16830
390