Skip to content

Commit

Permalink
Merge pull request #307 from Fdawgs/chore/order
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Aug 2, 2023
2 parents 843f6df + 5dfee8e commit e00d5c9
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
10 changes: 5 additions & 5 deletions scripts/license-checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

"use strict";

const checker = require("license-checker");
const copyLeftLicenses = require("spdx-copyleft");
const { promisify } = require("util");

const init = promisify(checker.init);
const { init } = require("license-checker");
const copyLeftLicenses = require("spdx-copyleft");
const path = require("upath");

const check = promisify(init);

/**
* @author Frazer Smith
* @description Checks licenses of all direct production dependencies to
Expand Down Expand Up @@ -52,7 +52,7 @@ async function checkLicenses() {
// Merge copyleft licenses with deprecated licenses list
copyLeftLicenses.push(...deprecatedLicenseList);

const licenses = await init({
const licenses = await check({
direct: true,
production: true,
start: path.joinSafe(__dirname, ".."),
Expand Down
12 changes: 6 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"use strict";

const fs = require("fs/promises");
const path = require("upath");
const semver = require("semver");
const { execFile, spawn } = require("child_process");
const { promisify } = require("util");
const { readFile } = require("fs/promises");
const { gt, lt } = require("semver");
const path = require("upath");

const execFileAsync = promisify(execFile);

Expand Down Expand Up @@ -42,7 +42,7 @@ function parseOptions(acceptedOptions, options, version) {
if (
acceptedOptions[key].minVersion &&
version &&
semver.lt(version, acceptedOptions[key].minVersion)
lt(version, acceptedOptions[key].minVersion)
) {
invalidArgs.push(
`Invalid option provided for the current version of the binary used. '${key}' was introduced in v${acceptedOptions[key].minVersion}, but received v${version}`
Expand All @@ -53,7 +53,7 @@ function parseOptions(acceptedOptions, options, version) {
if (
acceptedOptions[key].maxVersion &&
version &&
semver.gt(version, acceptedOptions[key].maxVersion)
gt(version, acceptedOptions[key].maxVersion)
) {
invalidArgs.push(
`Invalid option provided for the current version of the binary used. '${key}' is only present up to v${acceptedOptions[key].maxVersion}, but received v${version}`
Expand Down Expand Up @@ -166,7 +166,7 @@ class UnRTF {
let buff;
try {
// eslint-disable-next-line security/detect-non-literal-fs-filename
buff = await fs.readFile(path.normalizeTrim(file));
buff = await readFile(path.normalizeTrim(file));
} catch {
throw new Error("File missing");
}
Expand Down
13 changes: 6 additions & 7 deletions src/index.test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
/* eslint-disable jest/no-conditional-expect */
/* eslint-disable security/detect-non-literal-fs-filename */

"use strict";

const isHtml = require("is-html");
const path = require("upath");
const semver = require("semver");
const { execFile } = require("child_process");
const { promisify } = require("util");
const generateCombos = require("../test_resources/utils/genCombos");
const isHtml = require("is-html");
const { gt, lt } = require("semver");
const path = require("upath");
const generateCombos = require("../test_resources/utils/gen-combos");

const execFileAsync = promisify(execFile);
const { UnRTF } = require("./index");
Expand Down Expand Up @@ -210,7 +209,7 @@ describe("Convert function", () => {
noPictures: true,
outputRtf: true,
};
if (semver.lte(version, "0.21.3")) {
if (lt(version, "0.21.3")) {
await expect(unRtf.convert(file, options)).rejects.toThrow(
`Invalid option provided for the current version of the binary used. 'outputRtf' was introduced in v0.21.3, but received v${version}`
);
Expand All @@ -223,7 +222,7 @@ describe("Convert function", () => {
noPictures: true,
outputPs: true,
};
if (semver.gt(version, "0.19.4")) {
if (gt(version, "0.19.4")) {
await expect(unRtf.convert(file, options)).rejects.toThrow(
`Invalid option provided for the current version of the binary used. 'outputPs' is only present up to v0.19.4, but received v${version}`
);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const btPowerSetRecursive = require("./btPowerSet");
const btPowerSetRecursive = require("./bt-power-set");

/**
* @author Frazer Smith
Expand Down

0 comments on commit e00d5c9

Please sign in to comment.