js-lambda-expression

It is possible lambda expression that can be used JavaScript.

npm install js-lambda-expression
6 downloads in the last week
8 downloads in the last month

JS Lambda

  • It is possible lambda expression that can be used JavaScript.
  • you just got a function F();

History

  • v1.1 Fixed bug expression body. (2013-07-22)
  • v1.0 Released v1.0 (2013-07-21)

Use it

Nuget

PM> Install-Package JS.Lambda

Node.JS

$ npm install js-lambda-expression

require('js-lambda-expression');

1. Simple Examples

Before

    function func(a,b) {
        return a + b;
    }
    console.info( func(4,6) );

    // Result
    10

After with JS-Lambda

    var func = F("a,b => a + b");
    console.info( func(4,6) );

Or you can invoke directly

Before

    function anonymousMethod(a,b) {
        return a + b;
    }
    console.info( anonymousMethod(4,6) );

    // Result
    10

After with JS-Lambda

    console.info( F("a,b => a + b")(4,6) );

2. Callback Examples

Before

    function callback( func ) {
        if( func ) func();
    }

    callback( function() { console.info('My name is Junil Um'); } );

After with JS-Lambda

    callback(  F("() => console.info('My name is Junil Um');")  );

    // Result
    My name is Junil Um

3. With jQuery

Before

    var li = $("item li");

    li.each( function(i, o) {
        $(o).addClass("some");
    } );

After

    var li = $("item li");

    li.each( F("(i, o) => $(o).addClass('some');") );
npm loves you