/** * Is this value a blank string? * * @param value The value to check. * @returns True if it was, otherwise false. */ function isBlank(value: any): boolean { return isNotString(value) || isEmpty(trim(value)) }
function getJsonFileContent(filePath) { try { filePath = trim(filePath); const content = fs.readFileSync(filePath, { encoding: "utf-8" }); return { value: filePath, data: JSON.parse(stripJsonComments(content)) }; } catch (e) { console.log(chalk.red(`Failed to process data: ${e}`)); process.exit(1); } }
export function addStartsWithCriteria (searchCriteria, propertyName, str) { str = trim(str).toLowerCase() const endStr = getEndStr(str) if (endStr) { if (!searchCriteria.$and) { searchCriteria.$and = [] } searchCriteria.$and.push({[propertyName]: {$gte: str}}) searchCriteria.$and.push({[propertyName]: {$lt: endStr}}) } else { searchCriteria[propertyName] = {$gte: str} } }
function validJsonFileExist(choice) { try { const filePath = trim(choice.value); if (!fs.existsSync(filePath)) { return "The file doe not exist or cannot read. Please re-select."; } const content = fs.readFileSync(filePath, { encoding: "utf-8" }); try { const data = JSON.parse(stripJsonComments(content)); return true; } catch (e) { return `The file content is not in valid JSON format: ${e}`; } } catch (e) { return String(e); } }
return new Promise(function (resolve, reject) { try { const filePath = trim(executeOption); if (!fs.existsSync(filePath)) { throw new Error(
function FileIcon({ fileType }) { const iconType = (() => { switch (true) { case ext.archive.includes(trim(fileType, '.')): return 'file-archive-o'; case ext.code.includes(trim(fileType, '.')): return 'file-code-o'; case ext.img.includes(trim(fileType, '.')): return 'file-image-o'; case ext.pdf.includes(trim(fileType, '.')): return 'file-pdf-o'; case ext.powerpoint.includes(trim(fileType, '.')): return 'file-powerpoint-o'; case ext.video.includes(trim(fileType, '.')): return 'file-video-o'; case ext.word.includes(trim(fileType, '.')): return 'file-word-o'; default:
configData["cluster-namespace"] = trim(configData["cluster-namespace"]); if (!configData["cluster-namespace"]) { throw new Error(