TradeMe/ensure

Support custom "getter" value guards

Closed this issue · 1 comments

isNotNull is currently special-cased to only run on get. Can we support marking custom value guard functions to run on get?

An attribute would be petty cool, e.g.

import { Guard } from '@trademe/ensure';

@Guard({ onGet: true })
function myGuard () {
   ...
}

TIL you can’t do a @decorator on a function...