UNPKG

@qrvey/formula-lang

Version:

QFormula support for qrvey projects

51 lines 1.44 kB
import { AST_PRIMITIVES } from '../constants'; import { isStringParam } from '../utils'; /** * `REPLACE` Returns the string give it in lower case. */ export const REPLACE = { identifier: 'REPLACE', parameters: [ { identifier: 'STRING', optional: false, expectedPrimitive: AST_PRIMITIVES.STRING, validator: [isStringParam], }, { identifier: 'TARGET', optional: false, expectedPrimitive: AST_PRIMITIVES.STRING, validator: [isStringParam], }, { identifier: 'REPLACEMENT', optional: false, expectedPrimitive: AST_PRIMITIVES.STRING, validator: [isStringParam], }, ], transpiler: { elasticsearch, snowflake, redshift, postgresql, }, primitiveResult: AST_PRIMITIVES.STRING, }; function elasticsearch(str, target, replacement) { return `REPLACE(${str}, ${target}, ${replacement})`; } function SQL(str, target, replacement) { return `REPLACE(${str}, ${target}, ${replacement})`; } function snowflake(str, target, replacement) { return SQL(str, target, replacement); } function redshift(str, target, replacement) { return SQL(str, target, replacement); } function postgresql(str, target, replacement) { return SQL(str, target, replacement); } //# sourceMappingURL=replace.js.map