dist/bbn.js
/**
     * Returns a new array generated by the execution of a function for each item of the given array.
     * 
     * The deepProp argument is the name of property which should contain a nested array on which
     * the function should also be applied recursively.
     * 
     * @method   map
     * @global
     * @example
     * ```javascript
     * bbn.fn.map([1, 2, 3, 4], a => {
     *   return a + 1;
     * });
     * // [2, 3, 4, 5]
     * ```
     * @example
     * ```javascript
     * bbn.fn.map(
     *   [{
     *     name: "tools",
     *     items: [
     *       {
     *          name: "hammers"
     *       }, {
     *          name: "screwdrivers",
     *          items: [
     *            {name: "flat screwdrivers"},
     *            {name: "slotted screwdrivers"},
     *            {name: "Hex screwdrivers"},
     *          ]
     *       }
     *     ]
     *   }, {
     *     name: "Kitchenware"
     *   }],
     *   d => {
     *     d.warranty = d.name === "Hex screwdrivers" ? "10 years" : "1 year";
     *     return d;
     *   },
     *   "items"
     * );
     * // [
     * //    {
     * //       name: "tools",
     * //       warranty: "1 year",
     * //       items: [
     * //         {
     * //            name: "hammers",
     * //            warranty: "1 year",
     * //         }, {
     * //            name: "screwdrivers",
     * //            warranty: "1 year",
     * //            items: [
     * //              {name: "flat screwdrivers", warranty: "1 year"},
     * //              {name: "slotted screwdrivers", warranty: "1 year"},
     * //              {name: "Hex screwdrivers", warranty: "10 year"},
     * //            ]
     * //         }
     * //       ]
     * //    }, {
     * //       name: "Kitchenware",
     * //       warranty: "1 year"
     * //    }
     * // ]
     * ```
     * @memberof bbn.fn
     * @param    {Array}    arr
     * @param    {Function} fn
     * @param    {Boolean}  deepProp
     * @param    {Number}   level
     * @returns  {Array}
     */
Returns a new array generated by the execution of a function for each item of the given array.

The deepProp argument is the name of property which should contain a nested array on which
the function should also be applied recursively.


Returns a new array generated by the execution of a function for each item of the given array . The deepProp argument is the name of property which should contain a nested array on which the function should also be applied recursively .
map(arr, fn, deepProp, level = 0){
      return arr.map((a, i) => {
        a = fn(a, i, level);
        if ( deepProp && a[deepProp] && bbn.fn.isArray(a[deepProp]) ){
          a[deepProp] = bbn.fn.map(a[deepProp], fn, deepProp, level + 1);
        }
        return a;
      });
    }
map ( arr , fn , deepProp , level = 0 ) { return arr . map ( ( a , i ) => { a = fn ( a , i , level ) ; if ( deepProp && a [ deepProp ] && bbn . fn . isArray ( a [ deepProp ] ) ) { a [ deepProp ] = bbn . fn . map ( a [ deepProp ] , fn , deepProp , level + 1 ) ; } return a ; } ) ; }
Returns a new array generated by the execution of a function for each item of the given array.
Returns a new array generated by the execution of a function for each item of the given array .