1.0.0 • Published 9 years ago

nullify v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

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