call-matcher
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -0,1 +1,9 @@ | ||
## [1.1.0](https://github.com/twada/call-matcher/releases/tag/v1.1.0) (2018-08-23) | ||
#### Features | ||
* add index of matched argument to result of `#matchArgument` ([15e22d14](https://github.com/twada/call-matcher/commit/15e22d14dff614ba6e6836337e4d1342cefe173f)) | ||
### [1.0.1](https://github.com/twada/call-matcher/releases/tag/v1.0.1) (2016-12-31) | ||
@@ -2,0 +10,0 @@ |
@@ -7,3 +7,3 @@ /** | ||
* | ||
* Copyright (c) 2015-2016 Takuto Wada | ||
* Copyright (c) 2015-2018 Takuto Wada | ||
* Licensed under the MIT license. | ||
@@ -113,6 +113,7 @@ * https://github.com/twada/call-matcher/blob/master/MIT-LICENSE.txt | ||
function toArgumentSignature (argSignatureNode) { | ||
function toArgumentSignature (argSignatureNode, idx) { | ||
switch(argSignatureNode.type) { | ||
case syntax.Identifier: | ||
return { | ||
index: idx, | ||
name: argSignatureNode.name, | ||
@@ -123,2 +124,3 @@ kind: 'mandatory' | ||
return { | ||
index: idx, | ||
name: argSignatureNode.elements[0].name, | ||
@@ -125,0 +127,0 @@ kind: 'optional' |
@@ -1,2 +0,2 @@ | ||
Copyright (c) 2015-2016 Takuto Wada, https://github.com/twada/call-matcher | ||
Copyright (c) 2015-2018 Takuto Wada, https://github.com/twada/call-matcher | ||
@@ -3,0 +3,0 @@ Permission is hereby granted, free of charge, to any person obtaining |
{ | ||
"name": "call-matcher", | ||
"description": "ECMAScript CallExpression matcher made from function/method signature", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"author": { | ||
@@ -23,6 +23,6 @@ "name": "Takuto Wada", | ||
"dereserve": "^1.0.0", | ||
"esprima": "^3.0.0", | ||
"esprima": "^4.0.0", | ||
"jshint": "^2.8.0", | ||
"licensify": "^3.1.1", | ||
"mocha": "^3.0.0", | ||
"mocha": "^5.0.0", | ||
"package-json-filterify": "^1.0.4" | ||
@@ -29,0 +29,0 @@ }, |
@@ -8,3 +8,2 @@ call-matcher | ||
[![NPM version][npm-image]][npm-url] | ||
[![Dependency Status][depstat-image]][depstat-url] | ||
[![License][license-image]][license-url] | ||
@@ -139,3 +138,3 @@ | ||
- Returns `null` if not matched. | ||
- If matched, returns object like `{name: 'actual', kind: 'mandatory'}`, whose `name` is an argument name in the signature and `kind` is `'mandatory'` or `'optional'`. | ||
- If matched, returns object like `{index: 0, name: 'actual', kind: 'mandatory'}`, whose `index` is an index of matched argument, `name` is an argument name in the signature and `kind` is `'mandatory'` or `'optional'`. | ||
@@ -152,3 +151,3 @@ `node` and `parentNode` should be AST node objects defined in [The ESTree Spec](https://github.com/estree/estree) (formerly known as [Mozilla SpiderMonkey Parser API](https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API)). | ||
Returns array of argument signature objects based on signature passed to `CallMatcher` function. Returns array of objects like `[{name: 'actual', kind: 'mandatory'}]`, whose `name` is an argument name in the signature and `kind` is `'mandatory'` or `'optional'`. | ||
Returns array of argument signature objects based on signature passed to `CallMatcher` function. Returns array of objects like `[{index: 0, name: 'actual', kind: 'mandatory'}]`, whose `index` is an index of matched argument, `name` is an argument name in the signature and `kind` is `'mandatory'` or `'optional'`. | ||
@@ -196,6 +195,3 @@ | ||
[depstat-url]: https://gemnasium.com/twada/call-matcher | ||
[depstat-image]: https://gemnasium.com/twada/call-matcher.svg | ||
[license-url]: https://github.com/twada/call-matcher/blob/master/MIT-LICENSE.txt | ||
[license-image]: https://img.shields.io/badge/license-MIT-brightgreen.svg |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
116825
2732
194