to-null

Converts nullsy values to null (undefined, false, NaN), else returns the value

Usage no npm install needed!

<script type="module">
  import toNull from 'https://cdn.skypack.dev/to-null';
</script>

README

to-null

Converts "nullsy" values to null (undefined, false, NaN), else returns the value

npm install --save to-null
var toNull = require("to-null");

toNull(false); // null
toNull(undefined); // null
toNull(""); // "" not really null
toNull([1,2,3]); // [1,2,3]