This commit is contained in:
Daniel Odendahl Jr
2017-06-01 08:44:02 +00:00
parent 7802bb49cb
commit 14f85f94bd
129 changed files with 1915 additions and 1720 deletions
+8 -5
View File
@@ -12,11 +12,14 @@ module.exports = class BinaryCommand extends Command {
key: 'text',
prompt: 'What text would you like to convert to binary?',
type: 'string',
validate: text => {
if (this.binary(text).length < 2000) return true;
return 'Your text is too long.';
validate: (text) => {
if (this.binary(text).length < 2000) {
return true;
} else {
return 'Your text is too long.';
}
},
parse: text => this.binary(text)
parse: (text) => this.binary(text)
}
]
});
@@ -28,7 +31,7 @@ module.exports = class BinaryCommand extends Command {
}
binary(text) {
return unescape(encodeURIComponent(text)).split('').map(str => {
return unescape(encodeURIComponent(text)).split('').map((str) => {
const converted = str.charCodeAt(0).toString(2);
return `${'00000000'.slice(converted.length)}${converted}`;
}).join('');