UNPKG

@qrvey/formula-lang

Version:

QFormula support for qrvey projects

42 lines 1.23 kB
import { AST_PRIMITIVES, OPERATION_SCOPE } from '../constants'; import { isStringParam } from '../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. */ export const PROPER = { identifier: 'PROPER', operationScope: OPERATION_SCOPE.RAW, functionScope: [OPERATION_SCOPE.RAW], parameters: [ { identifier: 'STRING', optional: false, expectedPrimitive: AST_PRIMITIVES.STRING, validator: [isStringParam], }, ], transpiler: { elasticsearch, snowflake, redshift, postgresql, databricks, }, primitiveResult: 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})`; } function databricks(current) { return `INITCAP(${current})`; } //# sourceMappingURL=proper.js.map