JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 399
  • Score
    100M100P100Q100191F
  • License MIT

Determines the environment the lambda function is running in.

Package Exports

  • aws-lambda-env

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (aws-lambda-env) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

aws-lambda-env

Build Status

Determines the environment the lambda function is running in.

Installation

$ npm install --save aws-lambda-env

Usage

For instance, if the name of your lambda function is staging_MyLambdaFunction, the library will return staging as environment.

// Retrieve the environment
var env = require('aws-lambda-env')() || 'production';

// Load the correct config information
var config = require('./config.json')[env];

If you want to change the default delimiter to something else, for instance if the name of your lambda function is staging:MyLambdaFunction, you can pass the delimiter as argument.

// Retrieve the environment
var env = require('aws-lambda-env')(':') || 'production';

Note: The library will return the lowercase name of the environment specified.

API

plugin([delimiter])

delimiter

Type: string

The delimiter to split the lambda function name on.

Author

License

MIT © Sam Verschueren