Skip to content

Commit

Permalink
comment cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alechp committed Jul 19, 2019
1 parent 357b22e commit 6d63eeb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
8 changes: 1 addition & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { printLine, printMirror } from "tacker";
export function getPkgProp(szProperty, pkg) {
//TODO: Debug why objects are being caught as strings
let sourceType = is(pkg);
// printMirror({ sourceType }, "cyan", "grey");
try {
switch (sourceType) {
case "undefined":
Expand All @@ -36,11 +35,9 @@ export async function handleUndefined(szProperty) {
return handleString(szProperty, pkgPath);
}

//TODO: Change call order to match getPkgProp
export async function handleString(szProperty, szPkgPath = process.cwd()) {
let pkgJSON,
pkgPath = szPkgPath;
// printMirror({ pkgPath }, "magenta", "blue");
if (pkgPath.endsWith("package.json") === false) {
pkgPath = path.resolve(pkgPath, "package.json");
}
Expand All @@ -54,7 +51,6 @@ export async function handleString(szProperty, szPkgPath = process.cwd()) {
return handleObject(szProperty, pkgJSON);
}

//TODO: Change call order to match getPkgProp
export async function handleObject(szProperty, oPkgJSON) {
let propValue;
let pkgJSON = oPkgJSON;
Expand All @@ -70,13 +66,11 @@ export async function handleObject(szProperty, oPkgJSON) {
});
}
}
// printLine("blue");
// printMirror({ propValue }, "blue", "grey");
// printLine("blue");
return propValue;
}

export function handleError(szFnName, szCustomErr, szErr) {
//TODO: Move to tacker
//TODO: Add initial undefined & emptyString check. Then concat all instead of piecemeal
printLine("red");
if (!is.undefined(szFnName)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/handle.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
getPkgProp
} from "../src/index";
import { printMirror, printLine } from "tacker";
import is from "@sindresorhus/is";
const { name } = require("../package.json");

test("handleUndefined gets package from get-pkg-prop", async t => {
let shouldBeName = await handleUndefined("name");
t.is(name, shouldBeName);
Expand Down

0 comments on commit 6d63eeb

Please sign in to comment.