I know that maybe this question is very silly, but I can't make nanoid to work on my NodeJS app.
I already read the docs.
This is my app.js configuration:
var nanoid = require("nanoid");
var ID = nanoid();
And I get the error message:
TypeError: nanoid is not a function
at Object.<anonymous> (myapp.js directory)
Maybe I need to import the function inside nanoid but I dont know how to do it. Help would be appreciate. Thanks.
A tiny, secure, URL-friendly, unique string ID generator for JavaScript. “An amazing level of senseless perfectionism, which is simply impossible not to respect.”
Introducing Nano ID It is a tiny, secure, URL-friendly, unique string ID generator. Nano ID has smaller size as compared to UUID. This size reduction impacts a lot. Making use of NanoID is easier for transferring information and storage space.
The above benchmarks show the performance of NanoID compared to other major id generators. It can generate over 2.2 million unique IDs per second with its default alphabet and over 1.8 million unique IDs per second when using the custom alphabet.
nanoid is a function inside the module try this
var { nanoid } = require("nanoid");
var ID = nanoid();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With