Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aws-lambda-helper

Package Overview
Dependencies
Maintainers
4
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-lambda-helper

Collection of helper methods for lambda

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-97.37%
Maintainers
4
Weekly downloads
 
Created
Source

aws-lambda-helper

Collection of helper methods for lambda

Installation

$ npm install aws-lambda-helper --save

Usage

const helper = require('aws-lambda-helper');

getEnvironment

Function to get environment from context object

Example:

  const context = {
    invokedFunctionArn: 'arn:123:abs:prod'
  };

  var env = helper.getEnvironment(context); // 'prod';

In case of incorrect context or misconfigured function ARN it will return null.

validateWithSchema

Function to validate input data with defined schema

  import payloadSchema from '../schemas/validationSchema';

  const data = {
    a: 1,
    b: 'Hello World'
  };

  var result = helper.validateWithSchema(data, payloadSchema); // true

In case of validation error it will throw an error, so for safest coding practices use try/catch statements.

  try {
    helper.validateWithSchema(data, payloadSchema);
  } catch (error) {
    // handle an error
  }

FAQs

Package last updated on 24 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc