Another JavaScript library for generating vector-based cartoon faces is Faces.JS.
Each generated face is drawn as Scalable Vector Graphics (SVG), and is also represented by a small JavaScript object that you can store and redraw the same face later.
To install it from NPM, use the following command:
The minimal code required to generate a face is as follows:
You also check out their source code on Github.