Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
"func-names": "off",
"global-require": "off",
"guard-for-in": "off",
"indent": "off",
"indent": ["error", 2],
"import/no-extraneous-dependencies": "off",
"import/no-unresolved": "off",
"import/newline-after-import": "off",
Expand Down
62 changes: 31 additions & 31 deletions lib/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,14 @@ function build_eager(transformations) {
*/
function build_custom_headers(headers) {
switch (true) {
case headers == null:
return void 0;
case isArray(headers):
return headers.join("\n");
case isObject(headers):
return entries(headers).map(([k, v]) => `${k}:${v}`).join("\n");
default:
return headers;
case headers == null:
return void 0;
case isArray(headers):
return headers.join("\n");
case isObject(headers):
return entries(headers).map(([k, v]) => `${k}:${v}`).join("\n");
default:
return headers;
}
}

Expand Down Expand Up @@ -1100,15 +1100,15 @@ const OFFSET_ANY_PATTERN_RE = RegExp(`(${OFFSET_ANY_PATTERN})\\.\\.(${OFFSET_ANY
// Split a range into the start and end values
function split_range(range) { // :nodoc:
switch (range.constructor) {
case String:
if (!OFFSET_ANY_PATTERN_RE.test(range)) {
return range;
}
return range.split("..");
case Array:
return [first(range), last(range)];
default:
return [null, null];
case String:
if (!OFFSET_ANY_PATTERN_RE.test(range)) {
return range;
}
return range.split("..");
case Array:
return [first(range), last(range)];
default:
return [null, null];
}
}

Expand All @@ -1131,23 +1131,23 @@ function norm_range_value(value) { // :nodoc:
*/
function process_video_params(param) {
switch (param.constructor) {
case Object: {
let video = "";
if ('codec' in param) {
video = param.codec;
if ('profile' in param) {
video += ":" + param.profile;
if ('level' in param) {
video += ":" + param.level;
}
case Object: {
let video = "";
if ('codec' in param) {
video = param.codec;
if ('profile' in param) {
video += ":" + param.profile;
if ('level' in param) {
video += ":" + param.level;
}
}
return video;
}
case String:
return param;
default:
return null;
return video;
}
case String:
return param;
default:
return null;
}
}
/**
Expand Down
12 changes: 6 additions & 6 deletions lib/utils/parsing/toArray.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ const isArray = require('lodash/isArray');
*/
function toArray(arg) {
switch (true) {
case arg == null:
return [];
case isArray(arg):
return arg;
default:
return [arg];
case arg == null:
return [];
case isArray(arg):
return arg;
default:
return [arg];
}
}

Expand Down
8 changes: 4 additions & 4 deletions test/api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,10 @@ describe("api", function () {
({ public_id }) => cloudinary.v2.api.resources({ type: "upload" })
.then(result => [public_id, result])
.then(([public_id, result]) => {
let resource = findByAttr(result.resources, "public_id", public_id);
expect(resource).to.be.an(Object);
expect(resource.type).to.eql("upload");
}));
let resource = findByAttr(result.resources, "public_id", public_id);
expect(resource).to.be.an(Object);
expect(resource.type).to.eql("upload");
}));
});
it("should allow listing resources by prefix", function () {
this.timeout(TIMEOUT.MEDIUM);
Expand Down
18 changes: 9 additions & 9 deletions test/spechelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ const allExamples = {};

function sharedExamples(name, examples) {
switch (true) {
case isFunction(examples):
allExamples[name] = examples;
return examples;
case allExamples.hasOwnProperty(name):
return allExamples[name];
default:
return function () {
console.log(`Shared example ${name} was not found!`);
};
case isFunction(examples):
allExamples[name] = examples;
return examples;
case allExamples.hasOwnProperty(name):
return allExamples[name];
default:
return function () {
console.log(`Shared example ${name} was not found!`);
};
}
}

Expand Down