You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
194 B

4 years ago
  1. 'use strict';
  2. module.exports = function when(value, fn, defaultFn) {
  3. if (value) {
  4. return fn(this, value);
  5. }
  6. if (defaultFn) {
  7. return defaultFn(this, value);
  8. }
  9. return this;
  10. };