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 - ScrollTo Effect (href to div) -

javascript - document.registerElement extending HTMLInputElement prototype while using custom tag name to avoid implicit browser style -

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