javascript - Check module version -


i need check if module of version.

i can check if module exists in same folder doing this:

var other; try {   other = require("../theothermodule"); } catch(e){   // module doesn't exist or } 

however, doesn't tell me version of module. need able tell if module of version or higher.

i don't think there's built-in function this. instead, can version package.json file:

var packagejson = require('./package.json'); console.log(packagejson.version); 

Comments

Popular posts from this blog

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

java - Reading data from multiple zip files and combining them to one -