build/rekord.js
function createWhere(properties, value, equals)
{
  var equality = equals || equalsStrict;

  if ( isFunction( properties ) )
  {
    return properties;
  }
  else if ( isArray( properties ) )
  {
    var parsed = [];

    for (var i = 0; i < properties.length; i++)
    {
      var where = properties[ i ];

      parsed.push( isArray( where ) ? createWhere.apply( this, where ) : createWhere( where ) );
    }

    return function whereMultiple(model)
    {
      for (var i = 0; i < parsed.length; i++)
      {
        if ( !parsed[ i ]( model ) )
        {
          return false;
        }
      }

      return true;
    };
  }
  else if ( isObject( properties ) )
  {
    var props = [];

    for (var prop in properties)
    {
      props.push({
        tester:   exprEqualsTester( properties[ prop ], equality ),
        resolver: createPropertyResolver( prop )
      });
    }

    return function whereEqualsObject(model)
    {
      for (var i = 0; i < props.length; i++)
      {
        var prop = props[ i ];

        if ( !prop.tester( prop.resolver( model ) ) )
        {
          return false;
        }
      }

      return true;
    };
  }
  else if ( isString( properties ) )
  {
    if ( properties in Wheres )
    {
      return Wheres[ properties ];
    }

    var resolver = createPropertyResolver( properties );

    if ( isValue( value ) )
    {
      var tester = exprEqualsTester( value, equality );

      return function whereEqualsValue(model)
      {
        return tester( resolver( model ) );
      };
    }
    else
    {
      return function whereHasValue(model)
      {
        return isValue( resolver( model ) );
      };
    }
  }
  else
  {
    return function whereAll(model)
    {
      return true;
    };
  }
}
function createWhere(properties, value, equals)
{
  var equality = equals || equalsStrict;

  if ( isFunction( properties ) )
  {
    return properties;
  }
  else if ( isArray( properties ) )
  {
    var parsed = [];

    for (var i = 0; i < properties.length; i++)
    {
      var where = properties[ i ];

      parsed.push( isArray( where ) ? createWhere.apply( this, where ) : createWhere( where ) );
    }

    return function whereMultiple(model)
    {
      for (var i = 0; i < parsed.length; i++)
      {
        if ( !parsed[ i ]( model ) )
        {
          return false;
        }
      }

      return true;
    };
  }
  else if ( isObject( properties ) )
  {
    var props = [];

    for (var prop in properties)
    {
      props.push({
        tester:   exprEqualsTester( properties[ prop ], equality ),
        resolver: createPropertyResolver( prop )
      });
    }

    return function whereEqualsObject(model)
    {
      for (var i = 0; i < props.length; i++)
      {
        var prop = props[ i ];

        if ( !prop.tester( prop.resolver( model ) ) )
        {
          return false;
        }
      }

      return true;
    };
  }
  else if ( isString( properties ) )
  {
    if ( properties in Wheres )
    {
      return Wheres[ properties ];
    }

    var resolver = createPropertyResolver( properties );

    if ( isValue( value ) )
    {
      var tester = exprEqualsTester( value, equality );

      return function whereEqualsValue(model)
      {
        return tester( resolver( model ) );
      };
    }
    else
    {
      return function whereHasValue(model)
      {
        return isValue( resolver( model ) );
      };
    }
  }
  else
  {
    return function whereAll(model)
    {
      return true;
    };
  }
}
function createWhere ( properties , value , equals ) { var equality = equals || equalsStrict ; if ( isFunction ( properties ) ) { return properties ; } else if ( isArray ( properties ) ) { var parsed = [ ] ; for ( var i = 0 ; i < properties . length ; i ++ ) { var where = properties [ i ] ; parsed . push ( isArray ( where ) ? createWhere . apply ( this , where ) : createWhere ( where ) ) ; } return function whereMultiple ( model ) { for ( var i = 0 ; i < parsed . length ; i ++ ) { if ( ! parsed [ i ] ( model ) ) { return false ; } } return true ; } ; } else if ( isObject ( properties ) ) { var props = [ ] ; for ( var prop in properties ) { props . push ( { tester : exprEqualsTester ( properties [ prop ] , equality ) , resolver : createPropertyResolver ( prop ) } ) ; } return function whereEqualsObject ( model ) { for ( var i = 0 ; i < props . length ; i ++ ) { var prop = props [ i ] ; if ( ! prop . tester ( prop . resolver ( model ) ) ) { return false ; } } return true ; } ; } else if ( isString ( properties ) ) { if ( properties in Wheres ) { return Wheres [ properties ] ; } var resolver = createPropertyResolver ( properties ) ; if ( isValue ( value ) ) { var tester = exprEqualsTester ( value , equality ) ; return function whereEqualsValue ( model ) { return tester ( resolver ( model ) ) ; } ; } else { return function whereHasValue ( model ) { return isValue ( resolver ( model ) ) ; } ; } } else { return function whereAll ( model ) { return true ; } ; } }
Creates a function which returns a true or false value given a test value.
This is also known as a filter function.

```javascript
Rekord.createWhere('field', true);  // when an object has property where field=true
Rekord.createWhere('field'); // when an object has the property named field
Rekord.createWhere(function(){}); // a function can be given which is immediately returned
Rekord.createWhere(['field', function(){}, ['field', true]]); // when an object meets all of the above criteria
Rekord.createWhere({foo: 1, bar: 2}); // when an object has foo=1 and bar=2
Rekord.createWhere('field', true, myEquals); // A custom comparison function can be given.
Rekord.createWhere(); // always returns true
```

@memberof Rekord
@param {whereInput} [properties] -
The first expression used to generate a filter function.
@param {Any} [value] -
When the first argument is a string this argument will be treated as a
value to compare to the value of the named property on the object passed
through the filter function.
@param {equalityCallback} [equals=Rekord.equalsStrict] -
An alternative function can be used to compare to values.
@return {whereCallback} -
A function which takes a value (typically an object) and returns a true
or false value.
@see Rekord.saveWhere
Creates a function which returns a true or false value given a test value . This is also known as a filter function .