{"maintainers":[{"name":"anonymous","email":"james@talmage.io"},{"name":"anonymous","email":"takuto.wada@gmail.com"}],"keywords":[],"dist-tags":{"latest":"0.0.2"},"author":{"name":"James Talmage","email":"james@talmage.io","url":"github.com/jamestalmage"},"description":"Parse / Generate Method Signatures","readme":"# call-signature [![Build Status](https://travis-ci.org/jamestalmage/call-signature.svg?branch=master)](https://travis-ci.org/jamestalmage/call-signature)\n\n> Parse / Generate Method Signatures\n\n\n## Install\n\n```\n$ npm install --save call-signature\n```\n\n\n## Usage\n\n```js\nvar signature = require('call-signature');\n\n// parse a call signature definition\nvar parsed = signature.parse('t.equal(expected, actual, [message])');\n\nconsole.log(parsed);\n/* =>  \n       {\n         callee: {\n           type: 'MemberExpression',\n           object: 't',\n           member: 'equal'\n         },\n         args: [\n           {\n             name: 'actual',\n             optional: false\n           },\n           {\n             name: 'expected',\n             optional: false\n           },\n           {\n             name: 'message',\n             optional: true\n           }\n         ]\n       }\n*/\n\n\n// Create signature definitions from the parsed object.\nsignature.generate(parsed);\n\n//=> \"t.equal(expected, actual, [message])\"\n```\n\n\n## API\n\n### callSignature.parse(input)\n\n#### input\n\nType: `string`\n\nA string that matches the call signature spec:\n\n`object.member(required_arg1, required_arg2, [optional_arg1])`\n`name(required_arg1, required_arg2, [optional_arg1])`\n\n`object`, `member` and `name` can be any identifiers, but currently the callee must be a `MemberExpression` or an `Identifier` (that requirement may loosen in the future).\n \nYou can have any number of arguments. Optional arguments are denoted by placing the argument name between square `[`brackets`]`.\n\n#### returns\n\nA simple JS Object with three properties `callee` and `args`.\n\n`callee` will be an object containing `type` property and its corresponding properties.\n\nwhen matched against `MemberExpression` like `foo.bar(baz)`, `object` and `member` will be strings.\n\n    callee: {\n      type: 'MemberExpression',\n      object: 'foo',\n      member: 'bar'\n    }\n\nwhen matched against `Identifier` like `foo(baz)`, `name` will be string.\n\n    callee: {\n      type: 'Identifier',\n      name: 'foo'\n    }\n\n`args` will be an array. Each item of the array will have two properties `name`, and `optional`. \n `name` will be the `string` name of the arg. `optional` will be a boolean value.\n\n### callSignature.generate(parsed)\n\n#### input\n\nType: `Object`\n\nMust have the same definition as the return value from the `parse` method.\n\n#### returns\n\nA `string` signature definition that will parse to exactly the provided input.\n\n## Related\n\n- [escallmatch](https://www.npmjs.com/package/escallmatch) - Similar, with compatible string definitions to this library. Can be used to match AST Nodes to parsed signatures.\n\n## License\n\nMIT © [James Talmage](http://github.com/jamestalmage)\n","repository":{"type":"git","url":"git+https://github.com/jamestalmage/call-signature.git"},"bugs":{"url":"https://github.com/jamestalmage/call-signature/issues"},"license":"MIT","versions":{"0.0.1":{"name":"call-signature","version":"0.0.1","description":"Parse / Generate Method Signatures","license":"MIT","repository":{"type":"git","url":"git+https://github.com/jamestalmage/call-signature.git"},"author":{"name":"James Talmage","email":"james@talmage.io","url":"github.com/jamestalmage"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":[],"dependencies":{},"devDependencies":{"ava":"^0.5.0","xo":"^0.11.2"},"xo":{"ignores":["test.js"]},"gitHead":"ccc9589bd02825246b19ab0ccc3259da2519995c","bugs":{"url":"https://github.com/jamestalmage/call-signature/issues"},"homepage":"https://github.com/jamestalmage/call-signature#readme","_id":"call-signature@0.0.1","_shasum":"930d260e71a2f30296801cf0b768a22b0474e8f1","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.1.0","_npmUser":{"name":"anonymous","email":"james@talmage.io"},"dist":{"shasum":"930d260e71a2f30296801cf0b768a22b0474e8f1","tarball":"http://repository.ncinga.com/nexus/content/groups/npm-all/call-signature/-/call-signature-0.0.1.tgz","integrity":"sha512-IICYKWfxHq8rsaOoX8mXGUXs8z9FkW3auEJSaw1vi4Tl1qp7lpo+oQq6AutPwEXlokxmQstS2TKPFG4ewu383Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBaMBWU8Y74+1vykPc1xWeou6lxNrytPQIdFg0Ar9ijTAiEAvgaQ/9b/8P56oCETpeOTaipboe85Fot8YIHxtTgrAtk="}]},"maintainers":[{"name":"anonymous","email":"james@talmage.io"}]},"0.0.2":{"name":"call-signature","version":"0.0.2","description":"Parse / Generate Method Signatures","license":"MIT","repository":{"type":"git","url":"git+https://github.com/jamestalmage/call-signature.git"},"author":{"name":"James Talmage","email":"james@talmage.io","url":"github.com/jamestalmage"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":[],"dependencies":{},"devDependencies":{"ava":"^0.5.0","xo":"^0.11.2"},"xo":{"ignores":["test.js"]},"gitHead":"df5278d361778c37824256ed5a3abc63e40a9759","bugs":{"url":"https://github.com/jamestalmage/call-signature/issues"},"homepage":"https://github.com/jamestalmage/call-signature#readme","_id":"call-signature@0.0.2","_shasum":"a84abc825a55ef4cb2b028bd74e205a65b9a4996","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.1.0","_npmUser":{"name":"anonymous","email":"takuto.wada@gmail.com"},"maintainers":[{"name":"anonymous","email":"james@talmage.io"},{"name":"anonymous","email":"takuto.wada@gmail.com"}],"dist":{"shasum":"a84abc825a55ef4cb2b028bd74e205a65b9a4996","tarball":"http://repository.ncinga.com/nexus/content/groups/npm-all/call-signature/-/call-signature-0.0.2.tgz","integrity":"sha512-qvYvkAVcoae0obt8OsZn0VEBHeEpvYIZDy1gGYtZDJG0fHawew+Mi0dBjieFz8F8dzQ2Kr19+nsDm+T5XFVs+Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD4AE+4iDnhck0YGGtQIazW8GTsTXqU2wcfwKfDPY1TCwIhAMj1Z1jAhsj9oAV19tJ2tzz219H2vRxxxm4q655CgD6+"}]}}},"name":"call-signature","time":{"modified":"2022-06-13T05:26:03.775Z","created":"2015-11-23T05:47:47.512Z","0.0.1":"2015-11-23T05:47:47.512Z","0.0.2":"2015-11-23T17:46:41.444Z"},"readmeFilename":"readme.md","homepage":"https://github.com/jamestalmage/call-signature#readme"}