Skip to content

Commit 97119b9

Browse files
committed
Improve code.
1 parent aa9d6da commit 97119b9

3 files changed

Lines changed: 13 additions & 17 deletions

File tree

index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -335,28 +335,28 @@ global.$QUERY = function(schema, options, callback, controller) {
335335
schema = parseSchema(schema);
336336
var o = framework_builders.getschema(schema[0], schema[1]);
337337
o && o.query(options, callback, controller);
338-
return o ? true : false;
338+
return !!o;
339339
};
340340

341341
global.$GET = function(schema, options, callback, controller) {
342342
schema = parseSchema(schema);
343343
var o = framework_builders.getschema(schema[0], schema[1]);
344344
o && o.get(options, callback, controller);
345-
return o ? true : false;
345+
return !!o;
346346
};
347347

348348
global.$WORKFLOW = function(schema, name, options, callback, controller) {
349349
schema = parseSchema(schema);
350350
var o = framework_builders.getschema(schema[0], schema[1]);
351351
o && o.workflow2(name, options, callback, controller);
352-
return o ? true : false;
352+
return !!o;
353353
};
354354

355355
global.$TRANSFORM = function(schema, name, options, callback, controller) {
356356
schema = parseSchema(schema);
357357
var o = framework_builders.getschema(schema[0], schema[1]);
358358
o && o.transform2(name, options, callback, controller);
359-
return o ? true : false;
359+
return !!o;
360360
};
361361

362362
global.$ASYNC = function(schema, callback, index, controller) {
@@ -376,7 +376,7 @@ global.$OPERATION = function(schema, name, options, callback, controller) {
376376
schema = parseSchema(schema);
377377
var o = framework_builders.getschema(schema[0], schema[1]);
378378
o && o.operation2(name, options, callback, controller);
379-
return o ? true : false;
379+
return !!o;
380380
};
381381

382382
global.DB = global.DATABASE = function() {
@@ -476,7 +476,7 @@ global.SUCCESS = function(success, value) {
476476
} else if (success == null)
477477
success = true;
478478

479-
SUCCESSHELPER.success = success ? true : false;
479+
SUCCESSHELPER.success = !!success;
480480
SUCCESSHELPER.value = value == null ? undefined : value;
481481
SUCCESSHELPER.error = err ? err : undefined;
482482
return SUCCESSHELPER;
@@ -5928,7 +5928,7 @@ F.isProcessed = function(filename) {
59285928
F.isProcessing = function(filename) {
59295929

59305930
if (!filename.url)
5931-
return F.temporary.processing[filename] ? true : false;
5931+
return !!F.temporary.processing[filename];
59325932

59335933
var name = filename.url;
59345934
var index = name.indexOf('?');
@@ -5937,7 +5937,7 @@ F.isProcessing = function(filename) {
59375937
name = name.substring(0, index);
59385938

59395939
filename = U.combine(F.config['directory-public'], $decodeURIComponent(name));
5940-
return F.temporary.processing[filename] ? true : false;
5940+
return !!F.temporary.processing[filename];
59415941
};
59425942

59435943
/**

internal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3268,7 +3268,7 @@ exports.parseBlock = function(name, content) {
32683268

32693269
function existsSync(filename) {
32703270
try {
3271-
return Fs.statSync(filename) ? true : false;
3271+
return !!Fs.statSync(filename);
32723272
} catch (e) {
32733273
return false;
32743274
}

mail.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,9 @@ Message.prototype.reply = function(address, clear) {
245245
};
246246

247247
Message.prototype.attachment = function(filename, name) {
248-
if (!name)
249-
name = framework_utils.getName(filename);
248+
!name && (name = framework_utils.getName(filename));
250249
var extension = framework_utils.getExtension(name);
251-
if (!this.files)
252-
this.files = [];
250+
!this.files && (this.files = []);
253251
this.files.push({ name: name, filename: filename, contentType: framework_utils.getContentType(extension), extension: extension });
254252
return this;
255253
};
@@ -275,10 +273,8 @@ Message.prototype.manually = function() {
275273
* @returns {Message}
276274
*/
277275
Message.prototype.attachmentInline = function(filename, name, contentId) {
278-
if (!name)
279-
name = framework_utils.getName(filename);
280-
if (!this.files)
281-
this.files = [];
276+
!name && (name = framework_utils.getName(filename));
277+
!this.files && (this.files = []);
282278
var extension = framework_utils.getExtension(name);
283279
this.files.push({ name: name, filename: filename, contentType: framework_utils.getContentType(extension), disposition: 'inline', contentId: contentId, extension: extension });
284280
return this;

0 commit comments

Comments
 (0)