olc
Ruins days by replacing characters with a homograph / homoglyph (like substituting semi-colons with the Greek question mark). Olc is the Irish word for bad.
Inspired by Ben Johnson's tweet;
By default, that's all that plugin does but can replace other homographs via options. See the test/expected directory for example output.
Installation
npm install olc
Basic usage (without Gulp)
You'll need to pass Vinyl files, with a Buffer / Stream as content.
var olc = ;var File = ; var file = path: 'example/directory/file.js' cwd: 'example/' base: 'example/directory' contents: fs // or contents: new Buffer(fs.readFileSync('example/directory/file.js'));// or instead of creating a new file with the vinyl module,// just use my glob-to-vinyl module var stream = ;stream; stream ;
Gulp usage
var gulp = ;var olc = ; gulp;
Options
Mode
If omitted, this option defaults to greek
.
Greek
This mode only replaces semi-colons with the Greek question mark as the specification tweet says.
One
This mode will chose a target homograph at random and replace it throughout each file. For extra confusion, if the character has multiple possible homographs, then both will used as a substitution (randomly per occurrence).
All
Will replace all instances of the homographs we look for with their counterparts.
charactersToReplace
This option (a string or array) of characters which should be replaced with their homographs. Characters which aren't one of the homographs we look for will be ignored.
If this option is given, the mode
option is ignored.