How to use nodejs cuid module?

I am trying to generate a token using cuid module located at https://github.com/dilvie/cuid

When I try the following:

require('cuid');
var test = cuid();
console.log(test);

I get:

var test = cuid();
           ^
ReferenceError: cuid is not defined

I have made sure I do an npm install cuid prior to running the code.

Can someone advise on what I am missing?

You need to store the function exported by the cuid module to a variable. E.g:

var cuid = require('cuid');