Update index.js

Added the capability to have items that are undefined appear as null.