Have ideas to improve npm?Join in the discussion! »

    mapcar

    1.2.0 • Public • Published

    Mapcar License NPM version Dependency Status Build Status

    Mapcar applies function fn to elements of lists with same index.

    Each application result is put into resulting list.

    Length of resulting list is the length of the shortest list argument.

    Came from lisp.

    Install

    npm i mapcar --save
    bower i mapcar --save
    

    How to use?

    mapcar(sum, [1,2,3,4], [1,2]);
    // returns
    [2,4]
     
    function sum(array) {
        return array.reduce(function(value, item) {
            return value + item;
        }, 0);
    }
     

    License

    MIT

    Install

    npm i mapcar

    DownloadsWeekly Downloads

    0

    Version

    1.2.0

    License

    MIT

    Last publish

    Collaborators

    • avatar