diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-03-27 21:01:33 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-03-27 21:01:33 +0100 |
commit | cc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch) | |
tree | 92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/beeper/index.js | |
parent | 3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff) |
remove node_modules
Diffstat (limited to 'node_modules/beeper/index.js')
-rw-r--r-- | node_modules/beeper/index.js | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/node_modules/beeper/index.js b/node_modules/beeper/index.js deleted file mode 100644 index 2bf65032a..000000000 --- a/node_modules/beeper/index.js +++ /dev/null @@ -1,60 +0,0 @@ -'use strict'; - -var BEEP_DELAY = 500; - -function beep() { - process.stdout.write('\u0007'); -} - -function melodicalBeep(val, cb) { - if (val.length === 0) { - cb(); - return; - } - - setTimeout(function () { - if (val.shift() === '*') { - beep(); - } - - melodicalBeep(val, cb); - }, BEEP_DELAY); -} - -module.exports = function (val, cb) { - if (!process.stdout.isTTY || - process.argv.indexOf('--no-beep') !== -1 || - process.argv.indexOf('--beep=false') !== -1) { - return; - } - - cb = cb || function () {}; - - if (val === parseInt(val)) { - if (val < 0) { - throw new TypeError('Negative numbers are not accepted'); - } - - if (val === 0) { - cb(); - return; - } - - for (var i = 0; i < val; i++) { - setTimeout(function (i) { - beep(); - - if (i === val - 1) { - cb(); - } - }, BEEP_DELAY * i, i); - } - } else if (!val) { - beep(); - cb(); - } else if (typeof val === 'string') { - melodicalBeep(val.split(''), cb); - } else { - throw new TypeError('Not an accepted type'); - } -}; |