var constantize = (obj) => {
  Object.freeze(obj);
  Object.keys(obj).forEach( (key, i) => {
    if ( typeof obj[key] === 'object' ) {
      constantize( obj[key] );
    }
  });
};

 

posted on 2018-07-31 15:57  tt-wedos  阅读(177)  评论(0编辑  收藏  举报