Skip to content

zeke/jiggle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jiggle

Jiggle arrays to slightly rearrange their values

Installation

npm install jiggle --save

Usage

var jiggle = require("jiggle")

// The jiggle() function takes an array as input and returns an array
jiggle([0,1,2,3,4,5,6,7,8,9])
// [ 1, 2, 0, 4, 3, 5, 6, 7, 9, 8 ]

// It can also jiggle strings
jiggle("jabberwocky")
// jbbeawockyr

// It always returns a new object without altering the original
var orig = ["a","b","c","d","e","f"]
var dupe = jiggle(orig)
// orig: ['a','b','c','d','e','f']
// dupe: ['a','b','d','e','c','f']

// And if you like jiggling you can keep on doing it
jiggle(jiggle(jiggle("supercalifragilisticexpialidocious")))
// supcaerligralitiiscpefaldioxciosiu

Tests

npm install
npm test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published