How to use the ts-util-is.isBoolean function in ts-util-is

To help you get started, we’ve selected a few ts-util-is examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github justinlettau / sql-source-control / src / generators / mssql.ts View on Github external
private safeValue(value: any): any {
    if (isNull(value)) {
      return 'NULL';
    }

    if (isString(value)) {
      value = value.replace("'", "''");
      return `'${value}'`;
    }

    if (isDate(value)) {
      value = value.toISOString();
      return `'${value}'`;
    }

    if (isBoolean(value)) {
      return value ? 1 : 0;
    }

    return value;
  }
github justinlettau / sql-source-control / src / sql / script.ts View on Github external
function safeValue(value: any): any {
  if (isString(value)) {
    value = value.replace("'", "''");
    return `'${value}'`;
  }

  if (isDate(value)) {
    value = value.toISOString();
    return `'${value}'`;
  }

  if (isBoolean(value)) {
    return value ? 1 : 0;
  }

  return value;
}

ts-util-is

TypeScript typeof utility helper with no dependencies.

MIT
Latest version published 8 months ago

Package Health Score

61 / 100
Full package analysis