How to use the @google-cloud/common.util.isCustomType function in @google-cloud/common

To help you get started, we’ve selected a few @google-cloud/common 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 googleapis / nodejs-bigquery / src / table.ts View on Github external
sourceUris: arrify(source).map((src) => {
        if (!util.isCustomType(src, 'storage/file')) {
          throw new Error('Source must be a File object.');
        }

        // If no explicit format was provided, attempt to find a match from
        // the file's extension. If no match, don't set, and default upstream
        // to CSV.
        const format =
          FORMATS[
            path
              .extname(src.name)
              .substr(1)
              .toLowerCase()
          ];
        if (!metadata.sourceFormat && format) {
          body.configuration.load.sourceFormat = format;
        }
github googleapis / nodejs-bigquery / src / table.ts View on Github external
destinationUris: arrify(destination).map((dest) => {
        if (!util.isCustomType(dest, 'storage/file')) {
          throw new Error('Destination must be a File object.');
        }

        // If no explicit format was provided, attempt to find a match from the
        // file's extension. If no match, don't set, and default upstream to CSV.
        const format = path
          .extname(dest.name)
          .substr(1)
          .toLowerCase();
        if (!options.destinationFormat && !options.format && FORMATS[format]) {
          options.destinationFormat = FORMATS[format];
        }

        return 'gs://' + dest.bucket.name + '/' + dest.name;
      }),
    });