index.js
function restore(fn, obj) {
  var props = new Array(arguments.length - 2)
  var vals = new Array(arguments.length - 2)

  for (var i = 0; i < props.length; i++) {
    props[i] = arguments[i + 2]
    vals[i] = obj[props[i]]
  }

  return function(){
    // restore vals
    for (var i = 0; i < props.length; i++) {
      obj[props[i]] = vals[i]
    }

    return fn.apply(this, arguments)
  }
}
function restore(fn, obj) {
  var props = new Array(arguments.length - 2)
  var vals = new Array(arguments.length - 2)

  for (var i = 0; i < props.length; i++) {
    props[i] = arguments[i + 2]
    vals[i] = obj[props[i]]
  }

  return function(){
    // restore vals
    for (var i = 0; i < props.length; i++) {
      obj[props[i]] = vals[i]
    }

    return fn.apply(this, arguments)
  }
}
function restore ( fn , obj ) { var props = new Array ( arguments . length - 2 ) var vals = new Array ( arguments . length - 2 ) for ( var i = 0 ; i < props . length ; i ++ ) { props [ i ] = arguments [ i + 2 ] vals [ i ] = obj [ props [ i ] ] } return function ( ) { // restore vals for ( var i = 0 ; i < props . length ; i ++ ) { obj [ props [ i ] ] = vals [ i ] } return fn . apply ( this , arguments ) } }
Restore obj props after function

@private
Restore obj props after function