src/server/mixins.js
function createId (coll) {
  var _ = this
  var idProperty = _.__id()
  if (_.isEmpty(coll)) {
    return 1
  } else {
    var id = _.maxBy(coll, function (doc) {
      return doc[idProperty]
    })[idProperty]

    if (_.isFinite(id)) {
      // Increment integer id
      return ++id
    } else {
      // Generate string id
      return uuid()
    }
  }
}
function createId (coll) {
  var _ = this
  var idProperty = _.__id()
  if (_.isEmpty(coll)) {
    return 1
  } else {
    var id = _.maxBy(coll, function (doc) {
      return doc[idProperty]
    })[idProperty]

    if (_.isFinite(id)) {
      // Increment integer id
      return ++id
    } else {
      // Generate string id
      return uuid()
    }
  }
}
function createId ( coll ) { var _ = this var idProperty = _ . __id ( ) if ( _ . isEmpty ( coll ) ) { return 1 } else { var id = _ . maxBy ( coll , function ( doc ) { return doc [ idProperty ] } ) [ idProperty ] if ( _ . isFinite ( id ) ) { // Increment integer id return ++ id } else { // Generate string id return uuid ( ) } } }
Return incremented id or uuid Used to override underscore-db's createId with utils.createId
Return incremented id or uuid Used to override underscore - db s createId with utils . createId