funcifyr.js
function(collection, fn) {
        if ( Array.isArray(collection) ) {
          var result = [];

          for (var i = 0; i < collection.length; i++) {
            result[i] = fn(collection[i], i, collection);
          }

          return result;
        }
        else if ( Object.prototype.toString.call(collection) === '[object Object]' ) {
          var result = {};

          for (var key in collection) {
            if ( collection.hasOwnProperty(key) ) {
              result[key] = fn(collection[key]);
            }
          }

          return result;
        }
        else throw new TypeError('Invalid type. First argument must be an array or an object.');
      }
function(collection, fn) {
        if ( Array.isArray(collection) ) {
          var result = [];

          for (var i = 0; i < collection.length; i++) {
            result[i] = fn(collection[i], i, collection);
          }

          return result;
        }
        else if ( Object.prototype.toString.call(collection) === '[object Object]' ) {
          var result = {};

          for (var key in collection) {
            if ( collection.hasOwnProperty(key) ) {
              result[key] = fn(collection[key]);
            }
          }

          return result;
        }
        else throw new TypeError('Invalid type. First argument must be an array or an object.');
      }
function ( collection , fn ) { if ( Array . isArray ( collection ) ) { var result = [ ] ; for ( var i = 0 ; i < collection . length ; i ++ ) { result [ i ] = fn ( collection [ i ] , i , collection ) ; } return result ; } else if ( Object . prototype . toString . call ( collection ) === '[object Object]' ) { var result = { } ; for ( var key in collection ) { if ( collection . hasOwnProperty ( key ) ) { result [ key ] = fn ( collection [ key ] ) ; } } return result ; } else throw new TypeError ( 'Invalid type. First argument must be an array or an object.' ) ; }
Maps over a collection and runs a callback on each item.

map :: (obj, fn) → arr

@param (collection, fn) - An array or object to iterate over, and a callback function to run
@returns array or object
Maps over a collection and runs a callback on each item .