Skip to content

Commit

Permalink
Refactor typeof usage for metasync
Browse files Browse the repository at this point in the history
PR-URL: #368
  • Loading branch information
JuliaGerasymenko committed Aug 20, 2018
1 parent 56dd8aa commit f169114
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/adapters.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const callbackify = (
source // promise or regular synchronous function
// Returns: callback, function
) => {
if (typeof(source) === 'function') {
if (typeof source === 'function') {
return (...args) => {
const callback = common.unsafeCallback(args);
if (callback) callback(null, source(...args));
Expand Down
2 changes: 1 addition & 1 deletion lib/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const reduce = (
) => {
done = done || common.emptyness;
const len = items.length;
let count = typeof(initial) === 'undefined' ? 1 : 0;
let count = typeof initial === 'undefined' ? 1 : 0;

if (!len) {
const err = count ? new TypeError(EMPTY_ARR) : null;
Expand Down
2 changes: 1 addition & 1 deletion lib/collector.functor.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const collect = (
expected // number or array of string, count or keys
// Returns: functor, collector
) => {
const isCount = typeof(expected) === 'number';
const isCount = typeof expected === 'number';
const isKeys = Array.isArray(expected);
if (!(isCount || isKeys)) throw new TypeError(TYPE_ERROR);
let keys = null;
Expand Down
4 changes: 2 additions & 2 deletions lib/composition.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const compose = (
) => {
const comp = (data, callback) => {
if (!callback) {
if (typeof(data) === 'function') {
if (typeof data === 'function') {
callback = data;
data = {};
} else {
Expand Down Expand Up @@ -104,7 +104,7 @@ Composition.prototype.collect = function(err, result) {
if (result !== this.context && result !== undefined) {
if (this.arrayed) {
this.context.push(result);
} else if (typeof(result) === 'object') {
} else if (typeof result === 'object') {
Object.assign(this.context, result);
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/control.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const parallel = (
}
if (result !== context && result !== undefined) {
if (isArray) context.push(result);
else if (typeof(result) === 'object') Object.assign(context, result);
else if (typeof result === 'object') Object.assign(context, result);
}
if (++counter === len) done(null, context);
};
Expand Down Expand Up @@ -80,7 +80,7 @@ const sequential = (
const finish = (err, result) => {
if (result !== context && result !== undefined) {
if (isArray) context.push(result);
else if (typeof(result) === 'object') Object.assign(context, result);
else if (typeof result === 'object') Object.assign(context, result);
}
if (err) {
done(err);
Expand Down

0 comments on commit f169114

Please sign in to comment.