functionobject_list () {return Newobject_list.fn.init (arguments); } Object_list.fn= Object_list.prototype ={constructor:object_list, init:function(args) { This. usedefaultlist =true; This. Object = {}; return This; } }; Object_list.fn.init.prototype=Object_list.fn; Object_list.prototype.clear=function(){ varK = Arguments[0]; if(k && This. has (k)) {Delete This. Object[k];} Else{ This. Object = {};} } Object_list.prototype.push=function(k,v) {if( This. Usedefaultlist) { if(! This. Object[k]) { This. object[k] =NewArray (); } This. Object[k].push (v); }Else{ if(! This. Object[k]) { This. object[k] =v; }Else{ varL = This. Object[k]; vararr =NewArray (); Arr.push (l); Arr.push (v); This. object[k] =arr; } } return This; }; Object_list.prototype.has=function(k) {return This. object[k]! =undefined;}; Object_list.prototype.get=function(k) {return This. Object[k]; }; Object_list.prototype.safe_get_call=function(k,target,_func_) {if( This. has (k)) {_func_.call ( ThisK This. Get (k)); } }; Object_list.prototype.get_with_default=function(k,d) {return This. has (k)? This. Get (k):d; }; Object_list.prototype. for=function () { varf = arguments[0]; varRstr= arguments[1]! = Undefined?arguments[1]: ""; varR = (R.tolowercase (). IndexOf ("r")! =-1)?true:false; for(varKinch This. Object) { if(!R) {f (k,0, This. Object[k]); }Else{ if(Is_array ( This. Object[k])) { for(varJinch This. Object[k]) {f (k,j, This. Object[k][j]); } }Else{f (k,0, This. Object[k]); } } } }; Object_list.prototype.for_with_target=function () { varf = arguments[0]; vartarget = arguments[1]; varRstr= arguments[2]! = undefined?arguments[2]: ""; varR = (R.tolowercase (). IndexOf ("r")! =-1)?true:false; for(varKinch This. Object) { if(!R) {f (k,0, This. Object[k]); }Else{ if(Is_array ( This. Object[k])) { for(varJinch This. Object[k]) {F.call (target,k,j, This. Object[k][j]); } }Else{f.call (target,k,0, This. Object[k]); } } } }; Win.object_list= Object_list;
"All-station engineer Practice Notes" Web front-end Custom JS object object_list