Skip to content

Commit

Permalink
v1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fptavares committed Apr 18, 2019
1 parent 67b49a2 commit df5ea1b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ There is also a plugin to collect latency data (traces) from your application on

## AWS Lambda

Applications of type `aws` creates a handler for AWS Lambda using API Gateway events.
Applications of type `aws` create a handler for AWS Lambda using API Gateway events.
You can force your application to return a handler of this type by setting the
type option:

Expand All @@ -145,7 +145,7 @@ exports.handler = modofun(myModule, { type: 'aws' })

## Azure Functions

Applications of type `azure` creates a handler for Azure Functions using an HTTP trigger.
Applications of type `azure` create a handler for Azure Functions using an HTTP trigger.
You can force your application to return a handler of this type by setting the
type option:

Expand Down Expand Up @@ -212,6 +212,14 @@ exports.user = app

Which generates a 400 error if the request doesn't match the expected function arity.

Note that, in Javascript, a function's arity is only counted up to the first optional argument (i.e. the first argument with a default value). As an example of this, the following function is considered to have an arity of 2:

```js
function foo(one, two, three='optional', four) {
//...
}
```


# Specification

Expand All @@ -229,9 +237,14 @@ Creates an application with a list of global middleware to execute before the in
Create an application with an options object.
* `options`: An object with configuration options according to the [options specification](#options).

#### modofun.arity(amount)
Enforces a specific amount of arguments for functions. Can be applied as an operation specific middleware, or even as a global middleware (if all your functions happen to have the same arity).
* `amount`: An integer number.
#### modofun.arity(minimum)
Enforces a minimum amount of arguments for functions. Can be applied as an operation specific middleware, or even as a global middleware (if all your functions happen to have the same arity).
* `minimum`: An integer number.

#### modofun.arity(minimum, maximum)
Same as above, except that the additional `maximum` adds an upper limit for the allowed amount of arguments for functions.
* `minimum`: An integer number.
* `maximum`: An integer number.

## Handlers

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "modofun",
"description": "A fast function router for serverless Node.js applications with middleware support",
"version": "1.2.1",
"version": "1.2.2",
"author": "Filipe Tavares",
"license": "MIT",
"repository": "modofunjs/modofun",
Expand Down

0 comments on commit df5ea1b

Please sign in to comment.