omnibelt/map-reject-nil.js

  1. const isNotNil = require('./is-not-nil');
  2. const mapFilter = require('./map-filter');
  3. /**
  4. * Maps an array by the given transform, but only the transformed values that are not nil
  5. * are included in the resulting array.
  6. *
  7. * @signature xf -> [*] -> [*]
  8. */
  9. const mapRejectNil = mapFilter(isNotNil);
  10. module.exports = mapRejectNil;