# lambda-30

> A Lambda String implementation for Node.js that supports some ES6

Latest version **0.0.5** (published 2016-08-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install lambda-30
pnpm add lambda-30
yarn add lambda-30
bun add lambda-30
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2016-08-12 |
| First published | 2015-07-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jeremy Darling |
| Maintainers | jdarling |
| Keywords | Lambda, Node.js |

## Links

- npm: https://www.npmjs.com/package/lambda-30
- npm.io page: https://npm.io/package/lambda-30

## Recent versions

- 0.0.5 (latest) — 2016-08-12
- 0.0.4 — 2015-09-22
- 0.0.3 — 2015-09-22
- 0.0.2 — 2015-07-15
- 0.0.1 — 2015-07-14

## README

Lambda-30
===

A Lambda String implementation for Node.js that supports some ES6.

Install
---

```shell
npm install lambda-30
```

Testing
---

```shell
npm test
```

Usage
---

###Basic

```javascript
var L = require('lambda-30').Lambda;
var f = L('(a, b)=>a+b');
var val = f(5, 8);
// val is 13
f = L('$.a+$.b'); // No params supplied used $ as self reference
val = f({a: 3, b: 5});
// val is 8
```

###Options

```javascript
var Lambda = require('lambda-30').Lambda;
var L = new Lambda({selfSymbol: 'self'});
var f = L.compile('self.a+self.b');
var val = f({a: 3, b: 5});
// val is 8
// or you can do
var val = L.execute({a: 3, b: 5});
// val is still 8
```

###Multi-line

```javascript
var L = require('lambda-30').Lambda;
// note: long string form used for convience only
var f = L(`(a, b)=>{
    var c = 2;
    var sum = a+b;
    var avg = sum / c;
    return {
      count: c,
      sum: sum,
      avg: avg
    };
}`);
```

###...rest

```javascript
var L = require('lambda-30').Lambda;
// note: long string form used for convience only
var f = L(`(...nums)=>{
    var c = nums.length;
    var sum = nums.reduce(function(curr, next){
      return curr + next;
    }, 0);
    var avg = sum / c;
    return {
      count: c,
      sum: sum,
      avg: avg
    };
}`);
```

###toJSON

Really this should be called toString but I didn't want to override the default toString implementation.
```javascript
var L = require('lambda-30').Lambda;
var expected = '(a, b)=>{return a+b}';
var e = L(expected);
var js = e.toJSON();
assert(js===expected);

var e = Lambda(function($){
    return $.a+$.b;
  });
var s = e.toJSON();
var expected = '($)=>{\n        return $.a+$.b;\n      }';
assert(s===expected);
```

---
_Source: https://npm.io/package/lambda-30 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
