daily pastebin goal
50%
SHARE
TWEET

Untitled

a guest Feb 20th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function createObjectRecursive(initOb) {
  2.     const obj = { ...initOb }
  3.  
  4.     return new Proxy(obj, {
  5.         get(_, prop) {
  6.             if (!obj.hasOwnProperty(prop)){
  7.                 obj[prop] = stub()
  8.             }
  9.             return obj[prop]
  10.         }
  11.     })
  12. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top