adds last, first, remove, contains, isEmpty and few more methods/properties to Array utilizing Object.defineProperty
Array instead 1 2 3;Array instead Mathmin;Array instead Mathmax;array instead array != -1array instead array //remove returns true when o was removedarray instead arrayarray = n;array instead array0;arrayclear instead arraylength = 0array instead arrayarray instead array
Usable in any environment that supports Object.defineProperty(oldest would probably be IE9).
Available through npm and bower, just require(or include with regular script tag) and you should be good to go.
npm install array-sugar bower install array-sugar jspm install npm:array-sugar
Then require('array-sugar'); and you're done.
Angular ngSanitize module in it's method assigns to arr.last and this collides with our 'last' getter.
If I am writing a web app, NOT a library/framework, I don't consider this a bad practice. I have quite few libraries and I do not use array-sugar in them even if It would be helpful most of the time. Users of these libraries would have their Array unexpectedly extended and that is not a good practice. If you are building an end product used by end-user, I think it is quite allright to have these methods straight on array.prototype.
Missing any sugar? Please do submit a pull or feature request.