Commit afc8ddf6 authored by Безуглый Андрей's avatar Безуглый Андрей
Browse files

Fixed registry location in package.json

parent 0b876d60
......@@ -170,14 +170,7 @@ function loadLocaleFromCsv(session, dirName, locale, entityName, attrs, keyAttrs
dataLoader.localizeEntity(session, localizationConfig, locale)
}
/**
* Load data from CSV with delimiter (";" by default)
* @param {string} fileName Full path to file
* @param {number} [startRow=0] Start from this CSV file row
* @param {string} [delimiter=';'] CSV file delimiter
*/
function loadCsvAsArray(fileName, startRow = 1, delimiter = ';') {
function loadFile(fileName) {
let fContent = fs.readFileSync(fileName, 'utf8')
if (!fContent) {
throw new Error(`File ${fileName} is empty or not exist`)
......@@ -189,6 +182,17 @@ function loadCsvAsArray(fileName, startRow = 1, delimiter = ';') {
fContent = fContent.trim()
}
return fContent
}
/**
* Load data from CSV with delimiter (";" by default)
* @param {string} fileName Full path to file
* @param {number} [startRow=0] Start from this CSV file row
* @param {string} [delimiter=';'] CSV file delimiter
*/
function loadCsvAsArray(fileName, startRow = 1, delimiter = ';') {
const fContent = loadFile(fileName)
const csvData = csv.parse(fContent, delimiter)
if (!Array.isArray(csvData)) throw new Error(`Invalid CSV format or file ${fileName} not found`)
......@@ -372,11 +376,7 @@ function loadParticipantsCsv(conn, dirName, entityName) {
console.log(`\t\tLoading participants for "${entityName}" instances...`)
const fileName = `${dirName}/${entityName}_ppt-${getModelName(dirName)}.csv`
let fContent = fs.readFileSync(fileName)
if (!fContent) {
throw new Error('File ' + fileName + ' is empty or not exist')
}
fContent = fContent.trim()
const fContent = loadFile(fileName)
const csvData = csv.parse(fContent, ';')
if (!Array.isArray(csvData)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment