How to use ts-util-is - 10 common examples

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 / dist / common / utility.js View on Github external
function getConns(config) {
    if (config.connection) {
        // deprecated (v1.1.0)
        console.warn(chalk_1.default.yellow('Warning! The config `connection` object is deprecated. Use `connections` instead.'));
        var legacyConn = config.connection;
        config.connections = (ts_util_is_1.isString(legacyConn) ? legacyConn : [legacyConn]);
    }
    if (ts_util_is_1.isString(config.connections)) {
        // get form web config
        return getWebConfigConns(config.connections);
    }
    else {
        return config.connections;
    }
}
exports.getConns = getConns;
github justinlettau / sql-source-control / dist / common / utility.js View on Github external
function getConns(config) {
    if (config.connection) {
        // deprecated (v1.1.0)
        console.warn(chalk_1.default.yellow('Warning! The config `connection` object is deprecated. Use `connections` instead.'));
        var legacyConn = config.connection;
        config.connections = (ts_util_is_1.isString(legacyConn) ? legacyConn : [legacyConn]);
    }
    if (ts_util_is_1.isString(config.connections)) {
        // get form web config
        return getWebConfigConns(config.connections);
    }
    else {
        return config.connections;
    }
}
exports.getConns = getConns;
github justinlettau / sql-source-control / src / common / config.ts View on Github external
getConnections() {
    if (!isString(this.connections)) {
      return this.connections;
    }

    const configFile = /\.config$/;

    if (configFile.test(this.connections)) {
      return Config.getConnectionsFromWebConfig(this.connections);
    } else {
      return this.getConnectionsFromJson(this.connections);
    }
  }
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;
}
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;
}
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;
}
github justinlettau / sql-source-control / dist / commands / pull.js View on Github external
function include(config, file) {
    if (!config.files || !config.files.length) {
        return true;
    }
    if (!ts_util_is_1.isArray(file)) {
        file = [file];
    }
    var results = multimatch(file, config.files);
    return !!results.length;
}
/**

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