0.0.1 • Published 9 years ago

swap-reverse v0.0.1

Weekly downloads
4
License
GPL-3
Repository
github
Last release
9 years ago

swap-reverse

A very fast algorithm for reversing strings and arrays.

More than 2 times faster compared to the native javascript Array.prototype.reverse().

  • tiny ( 394 bytes )
  • accepts strings and arrays
  • no dependencies
  • for modules and amd loaders
  • leaves Array.prototype.reverse untouched

usage:

var swapRev= require( 'swap-reverse' );

console.log( swapRev('!dlroW olleH') );
// Hello World!

console.log( swapRev([ 3, 2, 1 ]) );
// [ 1, 2, 3 ]