{"_id":"get-package-type","_rev":"94256","name":"get-package-type","description":"Determine the `package.json#type` which applies to a location","dist-tags":{"latest":"0.1.0"},"maintainers":[{"name":"coreyfarrell","email":"git@cfware.com"}],"time":{"modified":"2021-06-03T10:31:22.000Z","created":"2020-05-19T09:28:37.496Z","0.1.0":"2020-05-19T09:28:37.496Z"},"users":{},"author":{"name":"Corey Farrell"},"repository":{"type":"git","url":"git+https://github.com/cfware/get-package-type.git"},"versions":{"0.1.0":{"name":"get-package-type","version":"0.1.0","description":"Determine the `package.json#type` which applies to a location","type":"module","main":"index.cjs","exports":"./index.cjs","scripts":{"pretest":"if-ver -ge 10 || exit 0; cfware-lint .","tests-only":"nyc -s node test.cjs","test":"npm run -s tests-only","posttest":"nyc report --check-coverage"},"engines":{"node":">=8.0.0"},"author":{"name":"Corey Farrell"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/cfware/get-package-type.git"},"bugs":{"url":"https://github.com/cfware/get-package-type/issues"},"homepage":"https://github.com/cfware/get-package-type#readme","dependencies":{},"devDependencies":{"@cfware/lint":"^1.4.3","@cfware/nyc":"^0.7.0","if-ver":"^1.1.0","libtap":"^0.3.0","nyc":"^15.0.1"},"gitHead":"53f035a197b349125e43f60c8b8896664daf3942","_id":"get-package-type@0.1.0","_nodeVersion":"14.2.0","_npmVersion":"6.14.5","dist":{"shasum":"8de2d803cff44df3bc6c456e6668b36c3926e11a","size":2604,"noattachment":false,"key":"/get-package-type/-/get-package-type-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/get-package-type/download/get-package-type-0.1.0.tgz"},"maintainers":[{"name":"coreyfarrell","email":"git@cfware.com"}],"_npmUser":{"name":"coreyfarrell","email":"git@cfware.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/get-package-type_0.1.0_1589880517396_0.942783043169866"},"_hasShrinkwrap":false,"publish_time":1589880517496,"_cnpm_publish_time":1589880517496}},"readme":"# get-package-type [![NPM Version][npm-image]][npm-url]\n\nDetermine the `package.json#type` which applies to a location.\n\n## Usage\n\n```js\nconst getPackageType = require('get-package-type');\n\n(async () => {\n  console.log(await getPackageType('file.js'));\n  console.log(getPackageType.sync('file.js'));\n})();\n```\n\nThis function does not validate the value found in `package.json#type`.  Any truthy value\nfound will be returned.  Non-truthy values will be reported as `commonjs`.\n\nThe argument must be a filename.\n```js\n// This never looks at `dir1/`, first attempts to load `./package.json`.\nconst type1 = await getPackageType('dir1/');\n\n// This attempts to load `dir1/package.json`.\nconst type2 = await getPackageType('dir1/index.cjs');\n```\n\nThe extension of the filename does not effect the result.  The primary use case for this\nmodule is to determine if `myapp.config.js` should be loaded with `require` or `import`.\n\n[npm-image]: https://img.shields.io/npm/v/get-package-type.svg\n[npm-url]: https://npmjs.org/package/get-package-type\n","_attachments":{},"homepage":"https://github.com/cfware/get-package-type#readme","bugs":{"url":"https://github.com/cfware/get-package-type/issues"},"license":"MIT"}