Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
var fs = require('fs');
var path = require('path');
var async = require('async');
var fse = require('fs-extra');
var nomnom = require('nomnom');
var generateInfo = require('./generate-info');
/**
* Get the configuration from the config file. If configPath is provided
* it is assumed to be a JSON file with an 'exports' member that is a list
* of symbol names or patterns.
*
* @param {string} configPath Path to config file.
* @param {function(Error, Object)} callback Called with config object.
*/
function getConfig(configPath, callback) {
if (configPath) {
fs.readFile(configPath, function(err, data) {
if (err) {
callback(err);
return;
}
var obj;
try {
obj = JSON.parse(String(data));
} catch (err2) {
callback(new Error('Trouble parsing file as JSON: ' + configPath));
return;
}
var patterns = obj.exports;
if (patterns && !Array.isArray(patterns)) {
callback(new Error('Expected an exports array, got: ' + patterns));
return;
}
var namespace = obj.namespace;
if (namespace && typeof namespace !== 'string') {
callback(new Error('Expected an namespace string, got: ' +
namespace));
return;
}
callback(null, obj);
});
} else {
process.nextTick(function() {
callback(null, {exports: ['*']});
});
}
}
/**
* Read the symbols from info file.
* @param {Array.} patterns List of patterns to pass along.
* @param {function(Error, Array., Array.