<repo_name>shieldfy/is-serverless<file_sep>/lib/is-azure-function.js
'use strict'

module.exports = !!(
    process.env.AzureWebJobsStorage ||
    false
)
<file_sep>/test/isAzurefunction.js
'use strict'

var assert = require('assert')

//------- Azure --------
process.env.AzureWebJobsStorage = 'Value'
var isServerless = require('../')
assert(isServerless.result)
assert.equal(isServerless.whichOne,'Azure')<file_sep>/lib/is-cloudflare-worker.js
'use strict'

module.exports = !!(
    process.env.CLOUDFLARE_ZONE_ID ||
    false
)
<file_sep>/README.md
# is-serverless

Detection library for serverless environment, currently supports ([AWS Lambda](https://aws.amazon.com/lambda/), [GCP cloud functions](https://cloud.google.com/functions/), [Azure functions](https://azure.microsoft.com/en-in/services/functions/), [Cloudflare workers](https://workers.cloudflare.com))

## Inspiration

This package inspired by `is-lambda` package by [@watson](https://github.com/watson)

## Installation

```
npm install is-serverless
```

## Usage

```js
var isServerless = require('is-serverless')

if (isServerless.result) {
  console.log('The code is running on a serverless environment : ' + isServerless.whichOne)
}
```

## Contribution

Feel free to fork, commit and submit pull request if you find a bug, or you want to add support to a new environment. Contributions are very welcome.


## License

MIT<file_sep>/lib/index.js
'use strict'

module.exports = {
    'isAWSLambda' : require('./is-aws-lambda'),
    'isGCPCloudfunction' : require('./is-gcp-cloudfunction.js'),
    'isAzureFunction' : require('./is-azure-function.js'),
    'isCloudflareWorker' : require('./is-cloudflare-worker.js'),
    'isVercel' : require('./is-vercel.js')
}<file_sep>/lib/is-aws-lambda.js
'use strict'

var isLambda = require('is-lambda')

module.exports = isLambda;<file_sep>/test/isLambda.js
'use strict'

var assert = require('assert')

//------ AWS -----------
process.env.AWS_EXECUTION_ENV = 'AWS_Lambda_nodejs6.10'
process.env.LAMBDA_TASK_ROOT = '/var/task'

var isServerless = require('../')
assert(isServerless.result)
assert.equal(isServerless.whichOne,'AWS')