Start by installing the Jdenticon NPM package. It comes with up-to-date typings.
npm install jdenticon
Now you can use any of the API methods to generate an identicon.
Using ES imports
import { toSvg } from "jdenticon"; const svgString = toSvg("value", 100); console.log(svgString);
Using CommonJS require
import jdenticon = require("jdenticon"); const svgString = jdenticon.toSvg("value", 100); console.log(svgString);
If esModuleInterop
is enabled you can also use the default import syntax.
import jdenticon from "jdenticon"; const svgString = jdenticon.toSvg("value", 100); console.log(svgString);