Wednesday, January 30, 2013

critical.js beta 4

I updated critical.js to be beta 4, from beta 3. The library is rather restructured now. The biggest change is moving from modifying host objects to using the crit namespace. As a result, it now type-checks the inputs, because it can no longer be positive that print is being used on an Array object. I also used JSDoc syntax for comments in the full source. A full list of changes is as follows:
  • Moved all methods to crit namespace
  • Add clone function, to clone an object
  • Modified allBut to work on strings
  • Redid map to be simpler for me to understand
  • Merged count, nthIndexOf, and scramble into a single function for arrays and strings
  • Added support for start parameter to nthIndexOf
  • scramble for arrays no longer modifies the source array
  • Changed Array.random to crit.arandom
  • Changed Array.print to crit.aprint
  • Changed String.reverse to crit.sreverse
  • Changed String.repeat to crit.srepeat
  • Changed String.trim to crit.strim
  • Changed Boolean.toBin to crit.btoBin
  • Allow btoBin to be used on any object type parsable as a Boolean
Please try it out and report bugs!

No comments:

Post a Comment