Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function coo(x) {
- let sec = arguments[1]
- const y = x || {}
- if (y.arr) y.arr.push(sec)
- if (!y.arr){
- y.arr = sec ? [sec] : []
- }
- return new Proxy(y, {
- get(a, b) {
- a.arr.reduce((hash, x) => {
- if (!hash[x]){
- hash[x] = {}
- }
- return hash[x]
- }, a)
- return coo(a, b)
- }
- })
- }
Add Comment
Please, Sign In to add comment