What are these properties prefixing underscore used for in package.json?

走远了吗. 提交于 2019-12-22 06:36:17

问题


I found these properties prefixing underscore in package.json. What are they used for? why prefixing underscore on properties?

  "_from": "react-scripts@0.9.3",
  "_id": "react-scripts@0.9.3",
  "_inCache": true,
  "_location": "/react-scripts",
  "_nodeVersion": "6.0.0",
  "_npmOperationalInternal": {
    "host": "packages-18-east.internal.npmjs.com",
    "tmp": "tmp/react-scripts-0.9.3.tgz_1488303928068_0.6415497597772628"
  },
  "_npmUser": {
    "name": "gaearon",
    "email": "dan.abramov@gmail.com"
  },

回答1:


Those are meta data reserved for package registries. All properties beginning with _ or $ are reserved for package registries to use at their discretion. wiki common "Reserved Properties" section explains it.




回答2:


Underscore is the reserved property of package.json, it is used for reserved keys. So, it is clearly mentioned in Documentation of package.json , we can't start a name with an underscore.



来源:https://stackoverflow.com/questions/42625563/what-are-these-properties-prefixing-underscore-used-for-in-package-json

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