{"size": 1648, "ext": "js", "max_stars_repo_path": "loud-array.micro.min.js", "max_stars_repo_name": "the1076/loud-array", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "loud-array.micro.min.js", "max_issues_repo_name": "the1076/loud-array", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "loud-array.micro.min.js", "max_forks_repo_name": "the1076/loud-array", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 1648.0, "max_line_length": 1648, "alphanum_fraction": 0.7961165049}
export default class LoudArray extends Array{constructor(listeners,...fromValues){super(...fromValues),this._private={listeners:listeners||[]};const mutatorMethods="copyWithin fill pop push reverse shift sort splice unshift".split(" ");for(let i=0;i<mutatorMethods.length;i++){let method=mutatorMethods[i];this._private[method]=this[method].bind(this),this[method]=(...args)=>{let listeners=this._private.listeners.filter(value=>{if("copyWithin"===method&&"copy-within"==value.event)return!0;let event=value.event.toLowerCase();return event==method||"any"==event||"all"==event}),returnValue=this._private[method](...args);return _dispatchEvents(this,listeners,"after",args),returnValue}}this._private.slice=this.slice.bind(this),this.slice=(...args)=>{let returnValue=this._private.slice(...args);return returnValue=new Array(...returnValue)}}addEventListener(event,handler){let listenerIndex=_array_findListener(this,listener.event,listener.handler);return listenerIndex>-1?this._private.listeners[listenerIndex]:(this._private.listeners.push({event:event,handler:handler}),listener)}removeEventListener(event,handler){let listenerIndex=_array_findListener(this,event,handler);-1!=listenerIndex&&this._private.listeners.splice(listenerIndex,1)}}function _array_findListener(target,event,handler){let index=-1;for(let i=0;i<target._private.listeners.length;i++){let listener=target._private.listeners[i],listenerEvent;if(listener.event.toLowerCase()==event&&listener.handler==handler){index=i;break}}return index}function _dispatchEvents(target,listeners,args){for(let i=0;i<listeners.length;i++){let listener;listeners[i].handler(target,...args)}}