node package manager


A lightweight, and docile, JavaScript library to help embracing functional programming.

Lamb, because it's docile like a lamb.

A lightweight, and docile, JavaScript (ES5) library to help embracing functional programming.

The API documentation is here.

Install it with npm:

npm install lamb

Require it in node.js:

var _ = require("lamb");

It's useful to alias it to have a shorter symbol, like _, as I did above and throughout the documentation: it's cleaner and the lamb object itself can be used as a placeholder argument in partial application.

In a browser, simply include the version you want from the dist folder:

<script src="dist/lamb.js"></script>


<script src="dist/lamb.min.js"></script>

Doing so a lamb variable will be created in the global object. The source map for the minified file is in the same dist folder.

Lamb it's also delivered on a CDN, courtesy of unpkg:

<script src=""></script>

The URL above will retrieve the latest version, but you can target a specific one:

<script src=""></script>

You can try it right now in your browser, too.

Lamb uses semantic versioning and please be aware that, as long as the major version is 0, any bump in the minor version could involve a breaking change in the API. You can check the recent or the full changelog to see if your code is affected.

  • Is another JavaScript library really needed? Don't know, really. The story here is that I like to write my own code and, time permitting, to even reinvent the wheel: it's part of my learning process. This library is only a means for me to gather some utilities I wrote, clean them up a bit and put them together with some new tools to make a documented, reusable package.

  • Are your wheels rounder? Not at all, but I do try my best to add better suspension; and you do realise that you're reading a guy talking to himself, don't you?

  • Why ECMAScript 5? Because this is simply me tidying up some old code, and will hopefully be my goodbye to ES5 before fully diving into the world of transpilers.

  • What about ES4 environments? In my make-believe world they don't exist, but in case I can be proven wrong you can load some shims / polyfills before my library. There's plenty of those in the JavaScript Reference on MDN, and there are many pre-made packages as well out there.

  • Are there plans for the future? Absolutely yes: this isn't a complete work at all, only a first public release. I need better documentation and examples for starters, and I also want to add a bunch of other functions and concepts into the mix.

  • I really like Lamb's logo: are you the designer? I like it a lot too and, no, it isn't my doing: the author is a very talented designer who never signs his works by choice and doesn't want to be credited for it. Other than being eternally grateful, the least I can do is offer my services as a middleman and put you in touch if you need his craft.

  • Why "Lamb"? See the main header: because it's docile like a lamb.

You can also check the full changelog.

  • v0.41.0 - 2016/09/08

    • Fully compatible with versions down to 0.40.x
    • Added findWhere, findIndexWhere, hasPathValue
    • find now uses findIndex to perform the search to avoid duplicate code
    • Minor performance gain when aritize needs to add undefined arguments
  • v0.40.0 - 2016/09/02

    • API change: hasKeyValue now uses the “SameValueZero" comparison
    • Fixed: updatePath and updatePathIn treated unassigned positive indexes in sparse arrays as non existent properties
    • Updated tests for hasKeyValue
    • Updated tests for “pick” and “skip” functions
    • Updated tests for “pairs”, “tear” and “values” functions
    • Updated tests of array accessors
    • Updated tests of object and path accessors
    • Improved performance of hasKeyValue
  • v0.39.0 - 2016/08/26

    • Fully compatible with versions down to 0.37.x
    • Added every, everyIn, some, someIn
    • Updated tests for functions using predicates
    • Made intersection use everyIn instead of the native method
    • Updated doc comments, examples and tests for uniques
    • Minor performance improvement of uniques
  • v0.38.0 - 2016/08/19

    • Fully compatible with versions down to 0.37.x
    • Improved performance of flatMap, flatMapWith, flatten and shallowFlatten
    • Greatly improved performance of all grouping functions
    • Greatly improved performance of transpose, improved performance of zip as a consequence
    • Greatly improved performance of getArgAt
  • v0.37.0 - 2016/08/10

    • API change: sortedInsert now returns an array copy of the given array-like if there is no element to insert, though still accepts undefined values if they are passed explicitly
    • Greatly improved performance of all curry (and curried) functions
    • Optimized invoker and invokerOn
    • Minor performance improvements in the usage of the arguments object