dist/bbn.js
/**
     * Checks whether the data contained in the given objects is identical.
     * 
     * The properties starting with a non alphanumerical character and the 
     * inherited ones are removed for the comparison, then the properties are 
     * compared individually without the order being taken into account.
     *
     * @method   isSame
     * @global
     * @example
     * ```javascript
     * bbn.fn.isSame(
     *   {name: "Wonka", fname: "Willy"},
     *   {fname: "Willy", name: "Wonka"}
     * );
     * // true
     * ```
     * @example
     * ```javascript
     * // Doesn't take into account properties starting with non-alphanumeric characters
     * bbn.fn.isSame(
     *   {name: "Wonka", fname: "Willy", _bbn_timestamp: 1587269593987},
     *   {fname: "Willy", name: "Wonka"}
     * );
     * // true
     * ```
     * @example
     * ```javascript
     * bbn.fn.isSame(
     *   {name: "Wonka", fname: "Willy", real: false},
     *   {fname: "Willy", name: "Wonka"}
     * );
     * // false
     * ```
     * @memberof bbn.fn
     * @param    {Object} obj1
     * @param    {Object} obj2
     * @returns  {Boolean}
     */
Checks whether the data contained in the given objects is identical.

The properties starting with a non alphanumerical character and the
inherited ones are removed for the comparison, then the properties are
compared individually without the order being taken into account.


Checks whether the data contained in the given objects is identical . The properties starting with a non alphanumerical character and the inherited ones are removed for the comparison then the properties are compared individually without the order being taken into account .
isSame(obj1, obj2){
      if ( obj1 === obj2 ){
        return true;
      }
      if ( obj1 && obj2 && (typeof(obj1) === 'object') && (typeof(obj2) === 'object') ){
        let tmp1 = Object.keys(bbn.fn.removePrivateProp(obj1)).sort(),
            tmp2 = Object.keys(bbn.fn.removePrivateProp(obj2)).sort();
        if ( JSON.stringify(tmp1) !== JSON.stringify(tmp2) ){
          return false;
        }
        let ok = true;
        bbn.fn.each(tmp1, a => {
          if (bbn.fn.isObject(obj1[a], obj2[a])) {
            if (!bbn.fn.isSame(obj1[a], obj2[a])) {
              ok = false;
              return false;
            }
          }
          else if (bbn.fn.numProperties(bbn.fn.diffObj(obj1[a], obj2[a]))) {
            ok = false;
            return false;
          }
        });
        return ok;
      }
      return false;
    }
isSame ( obj1 , obj2 ) { if ( obj1 === obj2 ) { return true ; } if ( obj1 && obj2 && ( typeof ( obj1 ) === 'object' ) && ( typeof ( obj2 ) === 'object' ) ) { let tmp1 = Object . keys ( bbn . fn . removePrivateProp ( obj1 ) ) . sort ( ) , tmp2 = Object . keys ( bbn . fn . removePrivateProp ( obj2 ) ) . sort ( ) ; if ( JSON . stringify ( tmp1 ) !== JSON . stringify ( tmp2 ) ) { return false ; } let ok = true ; bbn . fn . each ( tmp1 , a => { if ( bbn . fn . isObject ( obj1 [ a ] , obj2 [ a ] ) ) { if ( ! bbn . fn . isSame ( obj1 [ a ] , obj2 [ a ] ) ) { ok = false ; return false ; } } else if ( bbn . fn . numProperties ( bbn . fn . diffObj ( obj1 [ a ] , obj2 [ a ] ) ) ) { ok = false ; return false ; } } ) ; return ok ; } return false ; }
Checks whether the data contained in the given objects is identical.
Checks whether the data contained in the given objects is identical .
// Case where the keys are different /* else if (obj1[a] !== obj2[a]) {
            ok = false;
            return false;
          } */