Simple Data Analysis Core - v2.1.14
    Preparing search index...

    Function parseValue

    • Converts a JavaScript value to a SQL literal. Strings are quoted with embedded quotes escaped, dates become quoted ISO strings, and null, undefined, or NaN become "NULL". Numbers and booleans are returned unchanged.

      Parameters

      • value: unknown

        A string, number, boolean, Date, null, or undefined.

      Returns string | number | boolean

      A SQL literal, or the original number or boolean.

      import { parseValue } from "@nshiab/simple-data-analysis-core/helpers";
      console.log(parseValue("O'Brien")); // "'O''Brien'"
      console.log(parseValue(null)); // "NULL"

      If the value has an unsupported type.