1.0.13 • Published 5 years ago

textmutant v1.0.13

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

textmutant

Node package to mutate text into various other forms.

Install:

$ npm install textmutant

Examples:

const mutant = require('textmutant');

let text = 'Hello, how are you.';

console.log('Upper:', mutant.upper(text)); // Upper: HELLO, HOW ARE YOU.

console.log('Flip:', mutant.flip(text)); // Flip: ˙noʎ ǝɹɐ ʍoɥ 'ollǝH

console.log('Reverse:', mutant.reverse(text)); // Reverse: .uoy era woh ,olleH

console.log('Random:', mutant.random(text)); // Random: ˙oaleol,yw hu ro .He

console.log('Teen:', mutant.teen(text)); // Teen: HELlo, hOw are yOU.

console.log('Color to hex:', mutant.colortohex('hotpink')); // Color to hex: #ff69b4

var bin = mutant.toBinary(text);
console.log('Text to binary:', bin); // Text to binary: [binary stuff]
console.log('Binary to text:', mutant.fromBinary(bin)); // Binary to text: Hello, how are you.

Socket.io example

Mutate incoming text using short cuts (ie: /reverse text to reverse).

const mutant = require('textmutant');

// input example: /reverse Hello, how are you 
// output: .uoy era woh ,olleH
if (msg.charAt(0) == '/') {
    let func = msg.match(/^\/([a-zA-Z0-9]+)\s+/);
    if (func.length >= 1) {
        func = func[1]; 
    	if (func.length && typeof mutant[func] === 'function') { 
        	data.msg = mutant[func](msg.replace('/'+func+' ', ''));
    	}
    }
}
1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago