Wizcorp/node-tomes — pull request #29 by antoniogs (2013-11-26 06:37:19+00:00)
Title: Update index.js

The swap method has been updated, for be able of to swap two elements using the keys or the values, something as array.swap(key1, key2) or array.swap(someKey, someValue).

Now we can make:
var myArray = [ 'bread', 'bacon', 'lettuce', 'tomato', 'egg','cheese' ];
myArrayTome.swap(0,1);
myArrayTome.swap('cheese','egg');
myArrayTome.swap(1,'tomato');
myArrayTome.swap('bread',2);