convert-csv-to-json2
Version:
Convert CSV to JSON
28 lines • 742 B
JavaScript
// src/util/stringUtils.ts
function trimPropertyName(isTrimHeaderFieldWhiteSpace, value) {
if (isTrimHeaderFieldWhiteSpace) {
return value.replace(/\s/g, "");
}
return value.trim();
}
function getValueFormatByType(value) {
let retVal = value;
if (value === void 0 || value === "") {
retVal = "";
} else if (!isNaN(Number(value)) && typeof value === "string" && value.trim() !== "") {
retVal = Number(value);
} else if (value === "true" || value === "false") {
retVal = value === "true";
}
return retVal;
}
var stringUtils_default = {
trimPropertyName,
getValueFormatByType
};
export {
stringUtils_default as default,
getValueFormatByType,
trimPropertyName
};
//# sourceMappingURL=stringUtils.js.map