Formatting : the splitting of conditionals into separate lines is overdone, function
rig_props
is the worst case of overdoing it. You can find a fairly authoritative style guide here : http://javascript.crockford.com/code.htmlhere.Arrow head coding : http://www.codinghorror.com/blog/2006/01/flattening-arrow-code.htmlArrow head coding. If code has the following, then it was done wrong:
} ); } ); } } return obj; } } ); } return obj; }
} ); } ); } } return obj; } } ); } return obj; }
Naming : please use camelCasing and meaningful names, the. The code is too hard to follow (
slc
,t
,nl
,un
,_tm
.. ),. I understand you are used to it, but if you ever want other people to understand/maintain this, then you need to fix this.Naming : underscores used to indicate private properties/functions, they. They seem bad form for parameters (
_host_
,_aproto
) , see. See also the Crockford style guide.It defines .each()
.each()
, and you should really look into usingForEach()
instead. Also, also look intoreverse()
forflgIterBw
. forEachforEach
can be many times faster than a jsJS loop.Functions like
_aproto.keep
should have at least a one-liner comment as to what it does.Come to think of it, the code that enhances the array prototype should really be an object on it'sits own, and not stashed away in Timer
Timer
as the code is re-usable. This would follow the principle of Separation of Concerns.All in all, the code is hard to maintain, not evenly commented and it does not seem to consider the advances made in jsJS 1.6 ( ForEach
ForEach
, filter, etc. ) but it still counts on indexOf()indexOf()
.Finally, if the code were to be rewritten with the above in mind, it could get more meaningful code reviews because more reviewers could then grok it.