npmextra/dist/index.js

31 lines
2.1 KiB
JavaScript
Raw Normal View History

2016-07-16 23:23:22 +00:00
"use strict";
const plugins = require("./npmextra.plugins");
const paths = require("./npmextra.paths");
let allData;
exports.dataFor = (toolNameArg, cwdArg) => {
if (typeof allData == "undefined") {
let lookupPath;
if (cwdArg) {
lookupPath = plugins.path.join(cwdArg, "npmextra.json");
}
else {
lookupPath = paths.configFile;
}
;
allData = plugins.smartfile.fs.toObjectSync(plugins.path.join(lookupPath));
}
;
if (toolNameArg) {
if (allData[toolNameArg]) {
return allData[toolNameArg];
}
else {
plugins.beautylog.error(`There is no data for ${toolNameArg}`);
return undefined;
}
}
else {
return allData;
}
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsTUFBWSxPQUFPLFdBQU0sb0JBQ3pCLENBQUMsQ0FENEM7QUFDN0MsTUFBWSxLQUFLLFdBQU0sa0JBQWtCLENBQUMsQ0FBQTtBQUMxQyxJQUFJLE9BQU8sQ0FBQztBQUVELGVBQU8sR0FBRyxDQUFDLFdBQWtCLEVBQUMsTUFBYztJQUNuRCxFQUFFLENBQUEsQ0FBQyxPQUFPLE9BQU8sSUFBSSxXQUFXLENBQUMsQ0FBQSxDQUFDO1FBQzlCLElBQUksVUFBVSxDQUFDO1FBQ2YsRUFBRSxDQUFBLENBQUMsTUFBTSxDQUFDLENBQUEsQ0FBQztZQUNQLFVBQVUsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxNQUFNLEVBQUMsZUFBZSxDQUFDLENBQUM7UUFDM0QsQ0FBQztRQUFDLElBQUksQ0FBQyxDQUFDO1lBQ0osVUFBVSxHQUFHLEtBQUssQ0FBQyxVQUFVLENBQUM7UUFDbEMsQ0FBQztRQUFBLENBQUM7U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