Sha256: 642202a58499ceb0b963218c3c935eb2e850f8dcb597669778318d0439c3fea8
Contents?: true
Size: 348 Bytes
Versions: 204
Compression:
Stored size: 348 Bytes
Contents
exports.encode = function encode(plaintext) { return plaintext.replace(/([\w\s])\1*/g, function(match) { return match.length > 1 ? match.length + match[0] : match[0]; }); }; exports.decode = function decode(cypher) { return cypher.replace(/(\d+)(\w|\s)/g, function(match, repeats, char) { return new Array(+repeats + 1).join(char); }); };
Version data entries
204 entries across 204 versions & 1 rubygems