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
Post a Comment