Use semver package to convert ^4.2.3 to 4.2.3

给你一囗甜甜゛ 提交于 2019-12-13 10:29:07

问题


Using the semver NPM package https://docs.npmjs.com/misc/semver

is there a way to convert a package version like so ^4.2.3, to one that is without the ^? I just need to do string manipulation to remove any preceding characters that are not numbers, I suppose.


回答1:


Ah yes, the answer is in the docs, of course: https://docs.npmjs.com/misc/semver

it says:

semver.clean('  =v1.2.3   ') // '1.2.3'


来源:https://stackoverflow.com/questions/48348948/use-semver-package-to-convert-4-2-3-to-4-2-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!