lib/util/npm-utils.js
function fetchPeerDependencies(packageName) {
    const npmProcess = spawn.sync(
        "npm",
        ["show", "--json", packageName, "peerDependencies"],
        { encoding: "utf8" }
    );

    const error = npmProcess.error;

    if (error && error.code === "ENOENT") {
        return null;
    }
    const fetchedText = npmProcess.stdout.trim();

    return JSON.parse(fetchedText || "{}");


}
function fetchPeerDependencies(packageName) {
    const npmProcess = spawn.sync(
        "npm",
        ["show", "--json", packageName, "peerDependencies"],
        { encoding: "utf8" }
    );

    const error = npmProcess.error;

    if (error && error.code === "ENOENT") {
        return null;
    }
    const fetchedText = npmProcess.stdout.trim();

    return JSON.parse(fetchedText || "{}");


}
function fetchPeerDependencies ( packageName ) { const npmProcess = spawn . sync ( "npm" , [ "show" , "--json" , packageName , "peerDependencies" ] , { encoding : "utf8" } ) ; const error = npmProcess . error ; if ( error && error . code === "ENOENT" ) { return null ; } const fetchedText = npmProcess . stdout . trim ( ) ; return JSON . parse ( fetchedText || "{}" ) ; }
Fetch `peerDependencies` of the given package by `npm show` command.
@param {string} packageName The package name to fetch peerDependencies.
@returns {Object} Gotten peerDependencies. Returns null if npm was not found.
Fetch peerDependencies of the given package by npm show command .