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

lambda-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lambda-wrapper - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

test/test-wrapper.js

42

index.js

@@ -1,9 +0,10 @@

// Pseudowrapper for AWS Lambda
var lambdaModule;
var _runner = function(event, callback) {
if (!lambdaModule) {
return callback('Module not initialized', null);
}
// Wrapper class for AWS Lambda
function Wrapped(mod) {
this.lambdaModule = mod;
}
Wrapped.prototype.run = function(event, callback) {
var lambdacontext = {

@@ -22,3 +23,3 @@ succeed: function(success) {

try {
lambdaModule.handler(event, lambdacontext);
this.lambdaModule.handler(event, lambdacontext);
} catch (ex) {

@@ -29,8 +30,31 @@ throw(ex);

// Wrapper factory
function wrap(mod) {
var wrapped = new Wrapped(mod);
return wrapped;
}
// Static variables (for backwards compatibility)
var latest;
// Public interface for the module
module.exports = exports = {
// reusable wrap method
wrap: wrap,
// static init/run interface for backwards compatibility
init: function(mod) {
lambdaModule = mod;
latest = wrap(mod);
},
run: _runner
run: function(event, callback) {
if (typeof latest === typeof undefined) {
return callback('Module not initialized', null);
} else {
latest.run(event, callback);
}
}
};
{
"name": "lambda-wrapper",
"version": "0.0.4",
"version": "0.0.5",
"description": "Wrapper for running Amazon Lambda modules locally",

@@ -11,3 +11,3 @@ "main": "index.js",

"type": "git",
"url": "https://github.com/SC5/lambda-local.git"
"url": "https://github.com/SC5/lambda-wrapper.git"
},

@@ -20,7 +20,14 @@ "keywords": [

"author": "Mikael Puittinen (mikael.puittinen@sc5.io)",
"contributors": [
"Toni Ruottu (https://sc5.io)"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/SC5/lambda-local/issues"
"url": "https://github.com/SC5/lambda-wrapper/issues"
},
"homepage": "https://github.com/SC5/lambda-local"
"homepage": "https://github.com/SC5/lambda-wrapper",
"devDependencies": {
"chai": "3.5.0",
"mocha": "2.4.5"
}
}

@@ -10,3 +10,3 @@ # lambda-wrapper

var lambdaFunc = require('myModule/mymod.js');
var lambda = require('lambda-wrapper').init(lambdaFunc);
var lambda = require('lambda-wrapper').wrap(lambdaFunc);

@@ -25,4 +25,4 @@ ### Running the function in the Lambda module

* 2015/09/01 - v0.0.2 - Pass module object rather than path to init().
Removed automatic loading of module.
* 2015/09/01 - v0.0.2 - Pass module object rather than path to init().
Removed automatic loading of module.
* 2015/07/23 - v0.0.1 - Initial version of module

@@ -36,2 +36,2 @@

[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/SC5/lambda-local/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/SC5/lambda-local/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
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