rymdjs/data-storage — pull request #8 by johanbrook (2014-03-07 20:15:15+00:00)
Title: Module can destroy a record

**API**

```javascript
db.destroy(String|Array).then(function(){
console.log("Success")
})
```

```javascript
describe("destroy", function() {

it("should destroy a given record from its GUID", function() {
var guid;

return db.save({foo: "bar"})
.then(function(id) {
return guid = id
})
.then(db.destroy.bind(db))
.then(function() {
return db.get(guid)	// try to fetch the record again
})
.then(function(rec) {
var res = rec === undefined	// rec should not exist
res.should.be.true
})
})

it("should destroy an array of given record GUIDs and return them", function() {
var guids

return db.save([ {foo: "bar"}, {bar: "foo"}])
.then(function(ids) {
return guids = ids
})
.then(db.destroy.bind(db))
.then(function() {
return db.get(guids)	// try to fetch the record again
})
.then(function(records) {	// values in array should be undefined
records.every(function(record){ return record === undefined }).should.be.true
})
})
})
```