最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - What are these properties prefixing underscore used for in package.json? - Stack Overflow

programmeradmin3浏览0评论

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

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

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

  "_from": "[email protected]",
  "_id": "[email protected]",
  "_inCache": true,
  "_location": "/react-scripts",
  "_nodeVersion": "6.0.0",
  "_npmOperationalInternal": {
    "host": "packages-18-east.internal.npmjs.",
    "tmp": "tmp/react-scripts-0.9.3.tgz_1488303928068_0.6415497597772628"
  },
  "_npmUser": {
    "name": "gaearon",
    "email": "[email protected]"
  },
Share Improve this question asked Mar 6, 2017 at 12:22 RodsonRodson 5764 silver badges10 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

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

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.

发布评论

评论列表(0)

  1. 暂无评论