nullify

1.0.0 • Public • Published

nullify Build Status

Wrap a function to only run on non-null values

Install

$ npm install --save nullify

Usage

var nullify = require('nullify')
 
nullify(reverse)('foo')
//=> oof
 
nullify(reverse)(null)
//=> null
 
function reverse (string) {
  return string.split('').reverse().join('')
}

API

nullify(fn) -> function

Returns a function that passes through to fn when the outer function receives a non-null value.

fn

Required
Type: function

License

MIT © Ben Drucker

Package Sidebar

Install

npm i nullify

Weekly Downloads

5

Version

1.0.0

License

MIT

Last publish

Collaborators

  • bendrucker