lib/manager.js
function _getIdentityFields(Model, record, identityFields = []) {

    /*
     * Definition holds the schema
     * inforamtion of your model.
     */
    let schema = Model.definition;

    let definition;
    /*
     * Collect all unique keys in schema.
     * We can check record and see if we have
     * any present that we did not specify in
     * our `identityFields`.
     * If we do, we are good.
     */
    Object.keys(schema).map(key => {
        definition = schema[key];
        if (definition.unique) {
            if (!identityFields.includes(key)) {
                identityFields.push(key);
            }
        }
    });

    return identityFields;
}
function _getIdentityFields(Model, record, identityFields = []) {

    /*
     * Definition holds the schema
     * inforamtion of your model.
     */
    let schema = Model.definition;

    let definition;
    /*
     * Collect all unique keys in schema.
     * We can check record and see if we have
     * any present that we did not specify in
     * our `identityFields`.
     * If we do, we are good.
     */
    Object.keys(schema).map(key => {
        definition = schema[key];
        if (definition.unique) {
            if (!identityFields.includes(key)) {
                identityFields.push(key);
            }
        }
    });

    return identityFields;
}
function _getIdentityFields ( Model , record , identityFields = [ ] ) { /*
     * Definition holds the schema
     * inforamtion of your model.
     */ let schema = Model . definition ; let definition ; /*
     * Collect all unique keys in schema.
     * We can check record and see if we have
     * any present that we did not specify in
     * our `identityFields`.
     * If we do, we are good.
     */ Object . keys ( schema ) . map ( key => { definition = schema [ key ] ; if ( definition . unique ) { if ( ! identityFields . includes ( key ) ) { identityFields . push ( key ) ; } } } ) ; return identityFields ; }
Get the fields from a model attributes that we will use
to make our query's criteria.

@param       {Object} Model               Waterline collection
@param       {Object} record              Instance attributes
@param       {Array}  [identityFields=[]] Default fields
@return      {Array}                     Complete list of identity fields
Get the fields from a model attributes that we will use to make our query s criteria .