balderdashy/anchor — pull request #24 by ragulka (2013-10-30 08:25:30+00:00)
Title: Allow providing "this" context for custom types

Trying to find a solution to https://github.com/balderdashy/waterline/issues/146 I realized that it is required to modify anchor in order to allow setting "this" context for custom types. So this PR does exactly that. It is possible now to do the following:

```javascript
var user = { password: 'passW0rd', passwordConfirmation: 'passW0rd' };

anchor.define('password', function (password) {
return password === this.passwordConfirmation;
});

var outcome = anchor(user.password).to({ type: 'password' }, user);

assert.equal(false, outcome);
```

If no context is provided, nothing breaks, so this should be 100% backward-compatible.