dist/bbn.js
/**
     * Shortens all the strings contained in the object properties or element in a array.
     * 
     * Modifies directly the given object by cuttin all its too long strings, and adding ellipsis (...) in this case.
     *
     * @method   shortenObj
     * @global
     * @example
     * ```javascript
     * bbn.fn.shortenObj({
     *   title: "Once upon a time in the west",
     *   synopsis: "There's a single piece of land around Flagstone with water on it, and rail baron Morton (Gabriele Ferzetti) aims to have it, knowing the new railroad will have to stop there. He sends his henchman Frank (Henry Fonda) to scare the land's owner, McBain (Frank Wolff), but Frank kills him instead and pins it on a known bandit, Cheyenne (Jason Robards). Meanwhile, a mysterious gunslinger with a score to settle (Charles Bronson) and McBain's new wife, Jill (Claudia Cardinale), arrive in town."
     * }, 50)
     * // {
     * //   "title": "Once upon a time in the west",
     * //   "synopsis": "There's a single piece of land around Flagstone wi..."
     * // }
     * ```
     * @memberof bbn.fn
     * @param    {(Object|Array)} obj
     * @param    {Number}         [max=100]
     * @returns  {(Object|Array)} The same object, modified
     */
Shortens all the strings contained in the object properties or element in a array.

Modifies directly the given object by cuttin all its too long strings, and adding ellipsis (...) in this case.

@method   shortenObj
@global
@example
```javascript
bbn.fn.shortenObj({
title: "Once upon a time in the west",
synopsis: "There's a single piece of land around Flagstone with water on it, and rail baron Morton (Gabriele Ferzetti) aims to have it, knowing the new railroad will have to stop there. He sends his henchman Frank (Henry Fonda) to scare the land's owner, McBain (Frank Wolff), but Frank kills him instead and pins it on a known bandit, Cheyenne (Jason Robards).
Shortens all the strings contained in the object properties or element in a array . Modifies directly the given object by cuttin all its too long strings and adding ellipsis ( ... ) in this case . @method shortenObj @global @example ` ` ` javascript bbn . fn . shortenObj ( { title : " Once upon a time in the west " synopsis : " There ' s a single piece of land around Flagstone with water on it and rail baron Morton ( Gabriele Ferzetti ) aims to have it knowing the new railroad will have to stop there . He sends his henchman Frank ( Henry Fonda ) to scare the land ' s owner McBain ( Frank Wolff ) but Frank kills him instead and pins it on a known bandit Cheyenne ( Jason Robards ) .
shortenObj(obj, max = 100){
      let o = bbn.fn.clone(obj);
      bbn.fn.each(o, (a, n) => {
        if (bbn.fn.isString(a) && (a.length > max)) {
          o[n] = bbn.fn.shorten(a, max);
        }
        else if (a && (typeof a === 'object')) {
          o[n] = bbn.fn.shortenObj(a);
        }
      });
      return o;
    }
shortenObj ( obj , max = 100 ) { let o = bbn . fn . clone ( obj ) ; bbn . fn . each ( o , ( a , n ) => { if ( bbn . fn . isString ( a ) && ( a . length > max ) ) { o [ n ] = bbn . fn . shorten ( a , max ) ; } else if ( a && ( typeof a === 'object' ) ) { o [ n ] = bbn . fn . shortenObj ( a ) ; } } ) ; return o ; }
Shortens all the strings contained in the object properties or element in a array.
Shortens all the strings contained in the object properties or element in a array .