compacteq: logical {AND,OR} assignment

This commit is contained in:
Miraclx 2021-01-16 01:22:04 +01:00
parent 88b4530c4e
commit e86cf55b35
No known key found for this signature in database
GPG Key ID: A9BC9FCFBEF15C92
3 changed files with 4 additions and 4 deletions

2
cli.js
View File

@ -396,7 +396,7 @@ async function init(queries, options) {
'-t, --meta-tries', '-t, --meta-tries',
'number', 'number',
); );
options.cover = options.cover && xpath.basename(options.cover); options.cover &&= xpath.basename(options.cover);
options.chunks = CHECK_FLAG_IS_NUM(options.chunks, '-n, --chunks', 'number'); options.chunks = CHECK_FLAG_IS_NUM(options.chunks, '-n, --chunks', 'number');
options.timeout = CHECK_FLAG_IS_NUM(options.timeout, '--timeout', 'number'); options.timeout = CHECK_FLAG_IS_NUM(options.timeout, '--timeout', 'number');
options.bitrate = CHECK_BIT_RATE_VAL(options.bitrate); options.bitrate = CHECK_BIT_RATE_VAL(options.bitrate);

View File

@ -27,9 +27,9 @@ function hookupListeners() {
} }
async function genFile(opts) { async function genFile(opts) {
opts = opts || {}; opts ||= {};
if (opts.filename) { if (opts.filename) {
opts.tmpdir = opts.tmpdir || tmpdir(); opts.tmpdir ||= tmpdir();
if (!(await exists(opts.tmpdir))) throw new Error('tmpdir does not exist'); if (!(await exists(opts.tmpdir))) throw new Error('tmpdir does not exist');
const dir = join(opts.tmpdir, opts.dirname || '.'); const dir = join(opts.tmpdir, opts.dirname || '.');
await mkdirp(dir); await mkdirp(dir);

View File

@ -66,7 +66,7 @@ class StackLogger {
* @param {boolean} [opts.autoTick] Whether or not to auto tick printers. * @param {boolean} [opts.autoTick] Whether or not to auto tick printers.
*/ */
constructor(opts) { constructor(opts) {
opts = opts || {}; opts ||= {};
this.#store.isTTY = opts.isTTY || false; this.#store.isTTY = opts.isTTY || false;
this.#store.persist = opts.persist || false; this.#store.persist = opts.persist || false;
this.#store.output = opts.output; this.#store.output = opts.output;