Wordscramble on npm

in code


Wordscramble is also my first npm package ever! I try to learn something new each Saturday, and today I wanted to create, test and publish my own npm package. The first subject to pop into my mind was my typewriter bogosort.

wordscramble

Wordscramble is gloriously useless. You pass in a JavaScript object and you get it back scrambled in some manner. Behold:

var scramble = require('wordscramble');
scramble(true);
scramble(0.123131231); // 11.32233110
scramble('heighliner'); // glhenehrii
scramble({atreides: 'Caladan', corinno: 'Kaitain'}); //{ atreides: 'ladnaCa', corinno: 'anaiKit' }
scramble(['Atreides', 'Harkonnen', 'Corrino', 'Ginaz']); // [ 'oeannHnkr', 'znaGi', 'estrAedi', 'roirnoC' ]

Probably the only good parts of Wordscramble are that (1) it has a simple interface (crap in, crap out), and (2) that I do some clever things with recursion to walk through objects.



Remap a JavaScript Object

in code

Blog Silence

in me

Run Clare 2019 Race Series

in running


Your email address will not be published. Required fields are marked *