"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const npa = require("@zkochan/npm-package-arg");
function default_1(deps, opts) {
    if (!deps)
        return [];
    return Object.keys(deps).map(pkgName => depToSpec({
        pkgName,
        pkgVersion: deps[pkgName],
        where: opts.where,
        dev: !!opts.devDependencies[pkgName],
        optional: !!opts.optionalDependencies[pkgName],
    }));
}
exports.default = default_1;
function similarDepsToSpecs(deps, opts) {
    if (!deps)
        return [];
    return Object.keys(deps).map(pkgName => depToSpec({
        pkgName,
        pkgVersion: deps[pkgName] || opts.existingSpecs[pkgName],
        where: opts.where,
        dev: opts.dev || !!opts.devDependencies[pkgName],
        optional: opts.optional || !!opts.optionalDependencies[pkgName],
    }));
}
exports.similarDepsToSpecs = similarDepsToSpecs;
function depToSpec(opts) {
    const spec = npa.resolve(opts.pkgName, opts.pkgVersion, opts.where);
    spec.dev = opts.dev;
    spec.optional = opts.optional;
    return spec;
}
//# sourceMappingURL=depsToSpecs.js.map