{"name":"ast-module-types","version":"2.7.1","description":"Collection of useful helper functions when trying to determine module type (CommonJS or AMD) properties of an AST node.","main":"index.js","scripts":{"test":"mocha test/test.js"},"repository":{"type":"git","url":"git+https://github.com/mrjoelkemp/node-ast-module-types.git"},"keywords":["esprima","module","type","define","require","factory"],"author":{"name":"Joel Kemp","email":"joel@mrjoelkemp.com","url":"http://www.mrjoelkemp.com/"},"license":"MIT","bugs":{"url":"https://github.com/mrjoelkemp/node-ast-module-types/issues"},"homepage":"https://github.com/mrjoelkemp/node-ast-module-types","devDependencies":{"mocha":"^2.0.1","node-source-walk":"^3.0.0"},"gitHead":"68f7b79fc7763d41c9ee7abb8c95fc834e5ef993","_id":"ast-module-types@2.7.1","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"mrjoelkemp","email":"joel@mrjoelkemp.com"},"dist":{"integrity":"sha512-Rnnx/4Dus6fn7fTqdeLEAn5vUll5w7/vts0RN608yFa6si/rDOUonlIIiwugHBFWjylHjxm9owoSZn71KwG4gw==","shasum":"3f7989ef8dfa1fdb82dfe0ab02bdfc7c77a57dd3","tarball":"http://registry-npm.ywwl.com/ast-module-types/download/ast-module-types-2.7.1.tgz","fileCount":5,"unpackedSize":16987,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfntidCRA9TVsSAnZWagAAIXQP/j1jSNVkt0TD/VLE0HrK\nNs4AEDJx6xG0DTibGmRMlvpERGcCG9lI1qjIrJXJSUreihak1f02n+OHt/Vo\niJW+r/zumos1b18+M3NPI2QPAsDNKhU7WNbI/mZtSdSHrF3svkxb56wTCRlM\n+TuFXyQklWn9WQwpPRV4Bbmh9iEig9Qi0o8VabpCL2+8P6TdsMVuSmMFUBoA\nwKDS5dMpgtZ0gUhtxQ3CAEV8TmlZr5QEyNYnzzxUr0/v7lNyYDVVoRDxxzwp\nBFwwlUsSRmHLM/GGmyjc1qA/cxpWOTOKl1HQkGDq/TkWohrlT0Gvhtu3Qsfy\nKdPcRRt01qnf/HkMCX3IkY1G4abjQ7Q/VIYHyuTtm54t6pVLdNpdNeYrj1Sd\ndUqLV2BhNYFIkmp1K06VF6SObWeFVv6BX6w8SOms/yWzG9w3i4hPKj89Ld3A\nkICV2sJHsZ+ZGf2Z3w6H2b2q4GWARrJmMnCC0DjXh//LtWrPDVbbnF+EBcDM\nnN+QU8i/IJ7m4HLxkbOCkwITHOA0WivW762ffLoRTzTKYiEyJ2wZY3DKQ3VB\nwCSrwrHnRIek470/l0XxYR+FR3Hrszw325yvl9MFmTSDtbqAmjLnNyU15jhc\nnnT2/fo6ejiXGktumQsXRtN634+M14KKLAiuOsBwR2k1cqjOiunSl1+5Qn8o\nA67d\r\n=Wj25\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDE+nCgcQcpqo6HZtVptC9OEFXBmrVaGiQtEefLYQk1GAiAQdX6nSfET1jzmA3KH0xzeb7JcQbbX2jOdfvlxQWGHSQ=="}],"size":3910,"noattachment":false,"key":"/ast-module-types/-/ast-module-types-2.7.1.tgz"},"maintainers":[{"name":"mrjoelkemp","email":"joel@mrjoelkemp.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ast-module-types_2.7.1_1604245660810_0.32615606816836884"},"_hasShrinkwrap":false,"readme":"# ast-module-types\n\n[![CI](https://img.shields.io/github/actions/workflow/status/dependents/node-ast-module-types/ci.yml?branch=main&label=CI&logo=github)](https://github.com/dependents/node-ast-module-types/actions/workflows/ci.yml?query=branch%3Amain)\n[![npm version](https://img.shields.io/npm/v/ast-module-types?logo=npm&logoColor=fff)](https://www.npmjs.com/package/ast-module-types)\n[![npm downloads](https://img.shields.io/npm/dm/ast-module-types)](https://www.npmjs.com/package/ast-module-types)\n\nCollection of useful helper functions when trying to determine\nmodule type (CommonJS or AMD) properties of an AST node.\n\n**AST checks are based on the Esprima (Spidermonkey) format**\n\n```sh\nnpm install ast-module-types\n```\n\n## API\n\nEach of these takes in a single AST node argument\nand returns a boolean.\n\n* `isDefineAMD`: if node matches any form of an AMD `define` function call\n* `isRequire`: if node matches a `require` function all (declaring a dependency)\n* `isTopLevelRequire`: if node matches a `require` at the very top of the file.\n* `isAMDDriverScriptRequire`: if node matches an AMD driver script's require call `require([deps], function)`\n* `isExports`: if the node matches CommonJS `module.exports` or `exports` (defining a module)\n\nDetecting the various forms of defining an AMD module\n\n* `isNamedForm`: if the node is a define call of the form: `define('name', [deps], func)`\n* `isDependencyForm`: if the node is a define call of the form: `define([deps], func)`\n* `isFactoryForm`: if the node is a define call of the form: `define(func(require))`\n* `isNoDependencyForm`: if the node is a define call of the form: `define({})`\n* `isREMForm`: if the node matches the form: `define(function(require, exports, module){});`\n\nES6 Types\n\n*All types abide by the [EStree spec](https://github.com/estree/estree/blob/master/es2015.md)*\n\n* `isES6Import`: if the node is any of the es6 import forms\n* `isES6Export`: if the node is of any es6 export forms\n\n## Usage\n\n```js\nconst types = require('ast-module-types');\n\n// Assume node is some node of an AST that you parsed using esprima or esprima-fb\n// ...\n\nconsole.log(types.isDefineAMD(node));\n```\n\n## License\n\n[MIT](LICENSE)\n","publish_time":1604245660951,"_cnpm_publish_time":1604245660951,"dist-tags":{"latest":"7.0.0"}}