Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.com",
    "tmp": "tmp/react-scripts-0.9.3.tgz_1488303928068_0.6415497597772628"
  },
  "_npmUser": {
    "name": "gaearon",
    "email": "[email protected]"
  },
like image 463
Rodson Avatar asked Mar 06 '17 12:03

Rodson


People also ask

What is main property in package json?

The main property of a package. json is a direction to the entry point to the module that the package. json is describing. In a Node. js application, when the module is called via a require statement, the module's exports from the file named in the main property will be what's returned to the Node.

What is the use of keywords in package json?

keywords. Put keywords in it. It's an array of strings. This helps people discover your package as it's listed in npm search .

What is the main purpose of the package log dot JSON file?

The goal of package-lock. json file is to keep track of the exact version of every package that is installed so that a product is 100% reproducible in the same way even if packages are updated by their maintainers. This solves a very specific problem that package.


2 Answers

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.

like image 146
Damien Leroux Avatar answered Oct 07 '22 02:10

Damien Leroux


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.

like image 22
Bidisha Pyne Avatar answered Oct 07 '22 01:10

Bidisha Pyne