src/back/models/Entity.js
function _getFindFunction(CurrentEntity) {
  return function (query, params) {
    expect(arguments).to.have.length.within(
      1,
      2,
      'Invalid arguments length when finding an Entity ' +
      '(it has to be passed 1 or 2 arguments)'
    );

    expect(query).to.be.an(
      'object',
      'Invalid argument when finding an Entity (it has to be an object)'
    );

    return Promise.try(function () {
      var adapter = CurrentEntity.adapter;
      return adapter.findObjects(CurrentEntity, query, params);
    });
  };
}
function _getFindFunction(CurrentEntity) {
  return function (query, params) {
    expect(arguments).to.have.length.within(
      1,
      2,
      'Invalid arguments length when finding an Entity ' +
      '(it has to be passed 1 or 2 arguments)'
    );

    expect(query).to.be.an(
      'object',
      'Invalid argument when finding an Entity (it has to be an object)'
    );

    return Promise.try(function () {
      var adapter = CurrentEntity.adapter;
      return adapter.findObjects(CurrentEntity, query, params);
    });
  };
}
function _getFindFunction ( CurrentEntity ) { return function ( query , params ) { expect ( arguments ) . to . have . length . within ( 1 , 2 , 'Invalid arguments length when finding an Entity ' + '(it has to be passed 1 or 2 arguments)' ) ; expect ( query ) . to . be . an ( 'object' , 'Invalid argument when finding an Entity (it has to be an object)' ) ; return Promise . try ( function ( ) { var adapter = CurrentEntity . adapter ; return adapter . findObjects ( CurrentEntity , query , params ) ; } ) ; } ; }
Private function used to get the `find` function specific for the current
Entity class.
@name module:back4app-entity/models.Entity~_getFindFunction
@function
@param {!Class} CurrentEntity The current entity class for which the new
function will be created.
@returns {function} The find function.
@private
@example
Entity.find = _getFindFunction(Entity);
Private function used to get the find function specific for the current Entity class .