dist/bbn.js
/**
     * Creates and returns a perfect clone - but different - from the given object.
     *
     * @method   clone
     * @global
     * @example
     * ```javascript
     * let obj = {name: "Thomas"};
     * let objCopy = bbn.fn.clone(obj);
     * obj.name = "Julie";
     * // obj:     {name: "Julie"}
     * // objCopy: {name: "Thomas"}
     * ```
     * @memberof bbn.fn
     * @param    {Object} obj The source object
     * @returns  {Object} A new object
     */
Creates and returns a perfect clone - but different - from the given object.
Creates and returns a perfect clone - but different - from the given object .
clone(obj){
      if ( bbn.fn.isArray(obj) ){
        return obj.slice().map((a) => {
          return typeof(a) === 'object' ? bbn.fn.clone(a) : a;
        });
      }
      if ( bbn.fn.isObject(obj) ){
        return bbn.fn.extend(true, {}, obj);
      }
      return obj;
    }
clone ( obj ) { if ( bbn . fn . isArray ( obj ) ) { return obj . slice ( ) . map ( ( a ) => { return typeof ( a ) === 'object' ? bbn . fn . clone ( a ) : a ; } ) ; } if ( bbn . fn . isObject ( obj ) ) { return bbn . fn . extend ( true , { } , obj ) ; } return obj ; }
Creates and returns a perfect clone - but different - from the given object.
Creates and returns a perfect clone - but different - from the given object .