Socket
Book a DemoInstallSign in
Socket

jiggle

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jiggle

Jiggle arrays to slightly rearrange their values

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

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

Keywords

array

FAQs

Package last updated on 18 Sep 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts