_withContext()

This commit is contained in:
alex 2022-02-25 11:19:12 +00:00
parent fc739d1283
commit 29bdfb2d90
2 changed files with 17 additions and 0 deletions

View file

@ -312,6 +312,10 @@ class Pattern {
return this._withEvent(event => event.setContext(context))
}
_withContext(func) {
return this._withEvent(event => event.setContext(func(event.context)))
}
withLocation(location) {
return this.fmap(value => {
value = typeof value === 'object' && !Array.isArray(value) ? value : { value };