"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const npa = require("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],
        where: opts.where,
        dev: opts.dev,
        optional: opts.optional,
    }));
}
exports.similarDepsToSpecs = similarDepsToSpecs;
function depToSpec(opts) {
    const raw = `${opts.pkgName}@${opts.pkgVersion}`;
    const spec = npa(raw, opts.where);
    spec.dev = opts.dev;
    spec.optional = opts.optional;
    return spec;
}
//# sourceMappingURL=depsToSpecs.js.map