findDupes (value, type) {
    let keys = '';

    if (!value) {
      // we have no value to check : nothing to find
      return Bluebird.resolve({list: []});
    }

    switch (type) {
      case 'email':
        keys = ['contact.email'];
        value = this.yggdrasil.lib.utils.format.email(value);
        break;
      case 'phone':
        keys = ['contact.phones.mobile', 'contact.phones.office'];
        value = this.yggdrasil.lib.utils.format.phone(value);
        break;
      case 'trigram':
        keys = ['identity.trigram'];
        value = value.toUpperCase();
        break;
      default:
        keys = castArray(type);
        break;
    }
    return super.findDupes(value, keys);
  }
/**
   * Find objects sharing the same data depending on the type
   * @param value = the value to find
   * @param type - what type of property do we have to check
   * @returns {Promise<Array>} the found objects list
   */
Find objects sharing the same data depending on the type
@param value = the value to find
@param type - what type of property do we have to check
@returns {Promise} the found objects list
Find objects sharing the same data depending on the type @param value = the value to find @param type - what type of property do we have to check @returns { Promise } the found objects list
findDupes (value, type) {
    let keys = '';
    if (!value) {
      return Bluebird.resolve({list: []});
    }
    switch (type) {
      case 'email':
        keys = ['contact.email'];
        value = this.yggdrasil.lib.utils.format.email(value);
        break;
      case 'phone':
        keys = ['contact.phones.mobile', 'contact.phones.office'];
        value = this.yggdrasil.lib.utils.format.phone(value);
        break;
      case 'trigram':
        keys = ['identity.trigram'];
        value = value.toUpperCase();
        break;
      default:
        keys = castArray(type);
        break;
    }
    return super.findDupes(value, keys);
  }
findDupes ( value , type ) { let keys = '' ; if ( ! value ) { return Bluebird . resolve ( { list : [ ] } ) ; } switch ( type ) { case 'email' : keys = [ 'contact.email' ] ; value = this . yggdrasil . lib . utils . format . email ( value ) ; break ; case 'phone' : keys = [ 'contact.phones.mobile' , 'contact.phones.office' ] ; value = this . yggdrasil . lib . utils . format . phone ( value ) ; break ; case 'trigram' : keys = [ 'identity.trigram' ] ; value = value . toUpperCase ( ) ; break ; default : keys = castArray ( type ) ; break ; } return super . findDupes ( value , keys ) ; }
Find objects sharing the same data depending on the type
 @param value = the value to find
 @param type - what type of property do we have to check
 @returns {Promise<Array>} the found objects list
Find objects sharing the same data depending on the type @param value = the value to find @param type - what type of property do we have to check @returns { Promise<Array > } the found objects list
// we have no value to check : nothing to find