Comparing version 0.1.0 to 1.1.1
@@ -1,9 +0,1 @@ | ||
//https://www.npmjs.com/package/role-based-email-addresses | ||
//https://www.npmjs.com/package/disposable-email | ||
//https://www.npmjs.com/package/disposable-email-domains | ||
//https://www.npmjs.com/package/is-disposable-email | ||
//module.exports.disposable_email_domains = require('./disposable_email_domains.json'); | ||
//module.exports.disposable_email_wildcard_domains = require('./disposable_email_domains.json'); | ||
//module.exports.useragents = require('./useragents.json'); | ||
//module.exports.miner_wordlist = require('./miner_wordlist.json'); | ||
@@ -13,20 +5,39 @@ const path = require('path'); | ||
const userHome = require('user-home'); | ||
const Papa = require('papaparse'); | ||
const parse = require("csv-parse/lib/sync"); | ||
var generate = require('csv-generate'); | ||
var CurrentConfigDir = ""; | ||
const Config = {}; | ||
const papa = require('papaparse'); | ||
const CONFIG = {}; | ||
function AutoKentConfig(isDev){ | ||
let cfgPathLocal = path.resolve(__dirname, "AutoKent"); | ||
let cfgPathHome = path.resolve(userHome, "AutoKent"); | ||
if(isDev){ | ||
CurrentConfigDir = cfgPathLocal; | ||
// create a unique, global symbol name | ||
const OBJ_KEY = Symbol.for("csv-config"); | ||
// check if the global object has this symbol | ||
// add it if it does not have the symbol, yet | ||
var globalSymbols = Object.getOwnPropertySymbols(global); | ||
function CsvConfig(name,islocal){ | ||
if(globalSymbols.indexOf(OBJ_KEY) < 0){ | ||
global[OBJ_KEY] = CONFIG; | ||
} | ||
else{ | ||
CurrentConfigDir = cfgPathHome; | ||
CONFIG = global[OBJ_KEY]; | ||
return CONFIG; | ||
} | ||
if(typeof name == "undefined") name = "csv-config"; | ||
if(typeof islocal == "undefined") islocal = false; | ||
let cfgPathLocal = path.resolve(process.cwd(), name);; | ||
let cfgPathHome = path.resolve(userHome, name); | ||
if(islocal){ | ||
CONFIG['current-config-dir'] = cfgPathLocal; | ||
} | ||
else{ | ||
CONFIG['current-config-dir'] = cfgPathHome; | ||
if( ! fs.pathExistsSync(cfgPathHome)){ | ||
fs.mkdirsSync(cfgPathHome); | ||
fs.copySync(cfgPathLocal,cfgPathHome,{overwrite:true}); | ||
if(fs.pathExistsSync(cfgPathLocal)){ | ||
fs.copySync(cfgPathLocal,cfgPathHome,{overwrite:true}); | ||
} | ||
} | ||
@@ -38,3 +49,3 @@ } | ||
var files = fs.readdirSync(CurrentConfigDir); | ||
var files = fs.readdirSync( CONFIG['current-config-dir']); | ||
@@ -45,15 +56,15 @@ for(var i in files) { | ||
let base_name = path.basename(files[i],ext_name); | ||
let file_path = path.resolve(CurrentConfigDir,files[i]); | ||
let file_path = path.resolve(CONFIG['current-config-dir'],files[i]); | ||
let file_text = fs.readFileSync(file_path,'utf8'); | ||
Config[base_name] = Papa.parse(file_text,parse_config); | ||
CONFIG[base_name] = papa.parse(file_text,parse_config); | ||
} | ||
} | ||
Config['save'] = function (){ | ||
for (const [key, value] of Object.entries(Config)) | ||
CONFIG['save'] = function (){ | ||
for (const [key, value] of Object.entries(CONFIG)) | ||
{ | ||
if(typeof(value) !== 'function') | ||
if(typeof(value) !== 'function' && key != 'current-config-dir') | ||
{ | ||
let text = Papa.unparse(Config[key].data,unparse_config); | ||
let file_path = path.resolve(CurrentConfigDir,`${key}.csv`); | ||
let text = papa.unparse(CONFIG[key].data,unparse_config); | ||
let file_path = path.resolve( CONFIG['current-config-dir'] ,`${key}.csv`); | ||
fs.writeFileSync(file_path,text,'utf8'); | ||
@@ -63,10 +74,11 @@ } | ||
}; | ||
return Config; | ||
return CONFIG; | ||
}; | ||
module.exports = AutoKentConfig; | ||
module.exports = CsvConfig; | ||
//for testing purpose | ||
if (!module.parent) | ||
{ | ||
let config = AutoKentConfig(false); | ||
let config = CsvConfig("CsvConfig",true); | ||
config['atwords'].data[0][1] ++; | ||
@@ -73,0 +85,0 @@ config['dotwords'].data[0][1] ++; |
{ | ||
"name": "csv-config", | ||
"version": "0.1.0", | ||
"description": "A simple email extractor for obfosucated emails.", | ||
"version": "1.1.1", | ||
"description": "A `CSV` config parser and serializer for node.", | ||
"main": "csv-config.js", | ||
"keywords":[ | ||
"normalize", | ||
"url", | ||
"uri" | ||
"keywords": [ | ||
"csv-config", | ||
"config", | ||
"csv", | ||
"parser", | ||
"serializer", | ||
"ini", | ||
"conf", | ||
"configuration" | ||
], | ||
"dependencies": { | ||
"escape-string-regexp": "*" | ||
"path": "^0.12.7", | ||
"fs-extra": "^4.0.3", | ||
"user-home": "^2.0.0", | ||
"papaparse": "^4.3.6" | ||
}, | ||
@@ -20,19 +28,19 @@ "devDependencies": { | ||
"scripts": { | ||
"test": "mocha --recursive", | ||
"start": "node csv-config.js" | ||
"start": "node csv-config.js", | ||
"test": "mocha --recursive" | ||
}, | ||
"homepage":"https://gitlab.com/mehmet.kozan/csv-config", | ||
"bugs" :{ | ||
"url" : "https://gitlab.com/mehmet.kozan/csv-config/issues", | ||
"email" : "mehmet.kozan@live.com" | ||
"bugs": { | ||
"url": "https://gitlab.com/autokent/csv-config/issues", | ||
"email": "mehmet.kozan@live.com" | ||
}, | ||
"homepage": "https://gitlab.com/autokent/csv-config", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://gitlab.com/mehmet.kozan/csv-config.git" | ||
"url": "https://gitlab.com/autokent/csv-config.git" | ||
}, | ||
"author": "Mehmet Kozan", | ||
"author": "Mehmet Kozan <mehmet.kozan@live.com>", | ||
"license": "MIT", | ||
"engines": { | ||
"node": "8.2.1" | ||
"node": ">= 4.0.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
123
0
1
59
11084
4
14
+ Addedfs-extra@^4.0.3
+ Addedpapaparse@^4.3.6
+ Addedpath@^0.12.7
+ Addeduser-home@^2.0.0
+ Addedfs-extra@4.0.3(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedinherits@2.0.3(transitive)
+ Addedjsonfile@4.0.0(transitive)
+ Addedos-homedir@1.0.2(transitive)
+ Addedpapaparse@4.6.3(transitive)
+ Addedpath@0.12.7(transitive)
+ Addedprocess@0.11.10(transitive)
+ Addeduniversalify@0.1.2(transitive)
+ Addeduser-home@2.0.0(transitive)
+ Addedutil@0.10.4(transitive)
- Removedescape-string-regexp@*
- Removedescape-string-regexp@5.0.0(transitive)