@qrvey/formula-lang
Version:
QFormula support for qrvey projects
39 lines • 1.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PROPER = void 0;
const constants_1 = require("../constants");
const utils_1 = require("../utils");
/**
* `PROPER` Capitalizes the first letter in a string and any other letters in the text placed next to any character other than a letter. Converts the rest of the letters to lowercase.
*/
exports.PROPER = {
identifier: 'PROPER',
parameters: [
{
identifier: 'STRING',
optional: false,
expectedPrimitive: constants_1.AST_PRIMITIVES.STRING,
validator: [utils_1.isStringParam],
},
],
transpiler: {
elasticsearch,
snowflake,
redshift,
postgresql,
},
primitiveResult: constants_1.AST_PRIMITIVES.STRING,
};
function elasticsearch(current) {
return `PROPER_STRING(${current})`;
}
function snowflake(current) {
return `INITCAP(${current}, ' !"#$%&\\'()*+,-./:;<=>\\?@[\\\\]^_\`{|}~')`;
}
function redshift(current) {
return `INITCAP(${current})`;
}
function postgresql(current) {
return `INITCAP(${current})`;
}
//# sourceMappingURL=proper.js.map