Skip to content

returnedBy( getter(lastSet) )

Compare
Choose a tag to compare
@justinbmeyer justinbmeyer released this 31 Oct 00:28
· 14 commits to master since this release

This adds the ability to set observables returned by value.returnedBy if they are passed a getter() that takes an argument.

import {value} from "can";

var age = value.returnedBy(function(lastSet){
  return lastSet == null ? 0 : +lastSet;
});
age.value //-> 0
age.value = "5";
age.value //-> 5