json-engine.js
function del(id, callback) {

    callback = callback || emptyFn

    if (typeof callback !== 'function') {
      throw new TypeError('callback must be a function or empty')
    }

    if (!idIndexData[id]) {
      return callback(new Error('No object found with \'' + options.idProperty +
          '\' = \'' + id + '\''))
    }

    self.emit('delete', id)

    delete idIndexData[id]

    // Work around for dynamic property
    var find = {}
    find[options.idProperty] = id

    data.splice(_.findIndex(data, find), 1)

    saveFile('afterDelete', id, callback)
  }
function del(id, callback) {

    callback = callback || emptyFn

    if (typeof callback !== 'function') {
      throw new TypeError('callback must be a function or empty')
    }

    if (!idIndexData[id]) {
      return callback(new Error('No object found with \'' + options.idProperty +
          '\' = \'' + id + '\''))
    }

    self.emit('delete', id)

    delete idIndexData[id]

    // Work around for dynamic property
    var find = {}
    find[options.idProperty] = id

    data.splice(_.findIndex(data, find), 1)

    saveFile('afterDelete', id, callback)
  }
function del ( id , callback ) { callback = callback || emptyFn if ( typeof callback !== 'function' ) { throw new TypeError ( 'callback must be a function or empty' ) } if ( ! idIndexData [ id ] ) { return callback ( new Error ( 'No object found with \'' + options . idProperty + '\' = \'' + id + '\'' ) ) } self . emit ( 'delete' , id ) delete idIndexData [ id ] // Work around for dynamic property var find = { } find [ options . idProperty ] = id data . splice ( _ . findIndex ( data , find ) , 1 ) saveFile ( 'afterDelete' , id , callback ) }
Deletes one object. Returns an error if the object can not be found
or if the ID property is not present.

@param {Object} object to delete
@param {Function} callback
@api public
Deletes one object . Returns an error if the object can not be found or if the ID property is not present .