0.1.2 • Published 8 years ago

baraja v0.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

baraja

Build Status Dependency status Downloads Always useful

Shuffle, just about anything!

Install

npm install --save baraja

Use

const baraja = require('baraja');

API

.weave(array, sort) -> {String}

Weave multiple strings into one. array: An array of strings to be weave into one. sort: asc || desc - Order strings by length before weaving them.

const baraja = require('baraja');

baraja.weave([
  'hello',
  'developer',
  'friends'
]);
// 'hdfeerlvileeolnopders'

baraja.weave([
  'hello',
  'developer',
  'friends'
], 'asc');
// 'hfderelivleeonldsoper'

baraja.weave([
  'hello',
  'developer',
  'friends'
], 'desc');
// 'dfherevileellnoodpser'

.across(array) -> {Object}

Cross shuffle a list of words. The input array is always sorted alphabetically. array: An array of strings to be shuffled across.

const baraja = require('baraja');

baraja.across([
  'Peter',
  'Paul',
  'Merry',
  'Andrew'
]);
// {
    "Andrew": "Merry",
    "Merry": "Paul",
    "Paul": "Peter",
    "Peter": "Andrew"
}

Contribute

fork https://github.com/aichholzer/baraja/

License

MIT

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago