Skip to content

Commit 189d228

Browse files
committed
Parse JSON string for del
1 parent 1472759 commit 189d228

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,17 @@ function levelgraphJSONLD(db, jsonldOpts) {
215215
graphdb.jsonld.del = function(obj, options, callback) {
216216
var blanks = {};
217217

218+
if (typeof obj === 'string') {
219+
try {
220+
obj = JSON.parse(obj);
221+
} catch (e) {
222+
// Handle case where we're trying to delete by passing an IRI
223+
if (!N3Util.isIRI(obj)) {
224+
throw e
225+
}
226+
}
227+
}
228+
218229
if (typeof options === 'function') {
219230
callback = options;
220231
options = {};

0 commit comments

Comments
 (0)