How to use the is.defined function in is

To help you get started, we’ve selected a few 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 googleapis / nodejs-firestore / test / index.js View on Github external
it('exports all types', function() {
    // Ordering as per firestore.d.ts
    assert.ok(is.defined(Firestore.Firestore));
    assert.equal(Firestore.Firestore.name, 'Firestore');
    assert.ok(is.defined(Firestore.Timestamp));
    assert.equal(Firestore.Timestamp.name, 'Timestamp');
    assert.ok(is.defined(Firestore.GeoPoint));
    assert.equal(Firestore.GeoPoint.name, 'GeoPoint');
    assert.ok(is.defined(Firestore.Transaction));
    assert.equal(Firestore.Transaction.name, 'Transaction');
    assert.ok(is.defined(Firestore.WriteBatch));
    assert.equal(Firestore.WriteBatch.name, 'WriteBatch');
    assert.ok(is.defined(Firestore.DocumentReference));
    assert.equal(Firestore.DocumentReference.name, 'DocumentReference');
    assert.ok(is.defined(Firestore.WriteResult));
    assert.equal(Firestore.WriteResult.name, 'WriteResult');
    assert.ok(is.defined(Firestore.DocumentSnapshot));
    assert.equal(Firestore.DocumentSnapshot.name, 'DocumentSnapshot');
    assert.ok(is.defined(Firestore.QueryDocumentSnapshot));
    assert.equal(Firestore.QueryDocumentSnapshot.name, 'QueryDocumentSnapshot');
    assert.ok(is.defined(Firestore.Query));
    assert.equal(Firestore.Query.name, 'Query');
    assert.ok(is.defined(Firestore.QuerySnapshot));
    assert.equal(Firestore.QuerySnapshot.name, 'QuerySnapshot');
    assert.ok(is.defined(Firestore.CollectionReference));
    assert.equal(Firestore.CollectionReference.name, 'CollectionReference');
    assert.ok(is.defined(Firestore.FieldValue));
github googleapis / nodejs-firestore / test / index.js View on Github external
it('exports all types', function() {
    // Ordering as per firestore.d.ts
    assert.ok(is.defined(Firestore.Firestore));
    assert.equal(Firestore.Firestore.name, 'Firestore');
    assert.ok(is.defined(Firestore.Timestamp));
    assert.equal(Firestore.Timestamp.name, 'Timestamp');
    assert.ok(is.defined(Firestore.GeoPoint));
    assert.equal(Firestore.GeoPoint.name, 'GeoPoint');
    assert.ok(is.defined(Firestore.Transaction));
    assert.equal(Firestore.Transaction.name, 'Transaction');
    assert.ok(is.defined(Firestore.WriteBatch));
    assert.equal(Firestore.WriteBatch.name, 'WriteBatch');
    assert.ok(is.defined(Firestore.DocumentReference));
    assert.equal(Firestore.DocumentReference.name, 'DocumentReference');
    assert.ok(is.defined(Firestore.WriteResult));
    assert.equal(Firestore.WriteResult.name, 'WriteResult');
    assert.ok(is.defined(Firestore.DocumentSnapshot));
    assert.equal(Firestore.DocumentSnapshot.name, 'DocumentSnapshot');
    assert.ok(is.defined(Firestore.QueryDocumentSnapshot));
github googleapis / nodejs-firestore / test / index.js View on Github external
it('exports all types', function() {
    // Ordering as per firestore.d.ts
    assert.ok(is.defined(Firestore.Firestore));
    assert.equal(Firestore.Firestore.name, 'Firestore');
    assert.ok(is.defined(Firestore.Timestamp));
    assert.equal(Firestore.Timestamp.name, 'Timestamp');
    assert.ok(is.defined(Firestore.GeoPoint));
    assert.equal(Firestore.GeoPoint.name, 'GeoPoint');
    assert.ok(is.defined(Firestore.Transaction));
    assert.equal(Firestore.Transaction.name, 'Transaction');
    assert.ok(is.defined(Firestore.WriteBatch));
    assert.equal(Firestore.WriteBatch.name, 'WriteBatch');
    assert.ok(is.defined(Firestore.DocumentReference));
    assert.equal(Firestore.DocumentReference.name, 'DocumentReference');
    assert.ok(is.defined(Firestore.WriteResult));
    assert.equal(Firestore.WriteResult.name, 'WriteResult');
    assert.ok(is.defined(Firestore.DocumentSnapshot));
    assert.equal(Firestore.DocumentSnapshot.name, 'DocumentSnapshot');
    assert.ok(is.defined(Firestore.QueryDocumentSnapshot));
    assert.equal(Firestore.QueryDocumentSnapshot.name, 'QueryDocumentSnapshot');
    assert.ok(is.defined(Firestore.Query));
    assert.equal(Firestore.Query.name, 'Query');
    assert.ok(is.defined(Firestore.QuerySnapshot));
    assert.equal(Firestore.QuerySnapshot.name, 'QuerySnapshot');
    assert.ok(is.defined(Firestore.CollectionReference));
    assert.equal(Firestore.CollectionReference.name, 'CollectionReference');
    assert.ok(is.defined(Firestore.FieldValue));
    assert.equal(Firestore.FieldValue.name, 'FieldValue');
    assert.ok(is.defined(Firestore.FieldPath));
    assert.equal(Firestore.Firestore.name, 'Firestore');
    assert.ok(!Firestore.FieldValue.serverTimestamp().isEqual(
github googleapis / nodejs-firestore / test / index.js View on Github external
// Ordering as per firestore.d.ts
    assert.ok(is.defined(Firestore.Firestore));
    assert.equal(Firestore.Firestore.name, 'Firestore');
    assert.ok(is.defined(Firestore.Timestamp));
    assert.equal(Firestore.Timestamp.name, 'Timestamp');
    assert.ok(is.defined(Firestore.GeoPoint));
    assert.equal(Firestore.GeoPoint.name, 'GeoPoint');
    assert.ok(is.defined(Firestore.Transaction));
    assert.equal(Firestore.Transaction.name, 'Transaction');
    assert.ok(is.defined(Firestore.WriteBatch));
    assert.equal(Firestore.WriteBatch.name, 'WriteBatch');
    assert.ok(is.defined(Firestore.DocumentReference));
    assert.equal(Firestore.DocumentReference.name, 'DocumentReference');
    assert.ok(is.defined(Firestore.WriteResult));
    assert.equal(Firestore.WriteResult.name, 'WriteResult');
    assert.ok(is.defined(Firestore.DocumentSnapshot));
    assert.equal(Firestore.DocumentSnapshot.name, 'DocumentSnapshot');
    assert.ok(is.defined(Firestore.QueryDocumentSnapshot));
    assert.equal(Firestore.QueryDocumentSnapshot.name, 'QueryDocumentSnapshot');
    assert.ok(is.defined(Firestore.Query));
    assert.equal(Firestore.Query.name, 'Query');
    assert.ok(is.defined(Firestore.QuerySnapshot));
    assert.equal(Firestore.QuerySnapshot.name, 'QuerySnapshot');
    assert.ok(is.defined(Firestore.CollectionReference));
    assert.equal(Firestore.CollectionReference.name, 'CollectionReference');
    assert.ok(is.defined(Firestore.FieldValue));
    assert.equal(Firestore.FieldValue.name, 'FieldValue');
    assert.ok(is.defined(Firestore.FieldPath));
    assert.equal(Firestore.Firestore.name, 'Firestore');
    assert.ok(!Firestore.FieldValue.serverTimestamp().isEqual(
        Firestore.FieldValue.delete()));
  });
github googleapis / google-cloud-node / packages / vision / system-test / vision.js View on Github external
vision.detectText(IMAGES.text, options, function(err, text) {
        assert.ifError(err);

        assert(is.defined(text[0].bounds));

        done();
      });
    });
github googleapis / nodejs-compute / src / zone.js View on Github external
this.name,
        '/instanceGroupManagers/',
        json.target,
      ].join('');
    }
    if (is.defined(json.coolDown)) {
      json.autoscalingPolicy.coolDownPeriodSec = json.coolDown;
      delete json.coolDown;
    }
    if (is.defined(json.cpu)) {
      json.autoscalingPolicy.cpuUtilization = {
        utilizationTarget: json.cpu / 100,
      };
      delete json.cpu;
    }
    if (is.defined(json.loadBalance)) {
      json.autoscalingPolicy.loadBalancingUtilization = {
        utilizationTarget: json.loadBalance / 100,
      };
      delete json.loadBalance;
    }
    if (is.defined(json.maxReplicas)) {
      json.autoscalingPolicy.maxNumReplicas = json.maxReplicas;
      delete json.maxReplicas;
    }
    if (is.defined(json.minReplicas)) {
      json.autoscalingPolicy.minNumReplicas = json.minReplicas;
      delete json.minReplicas;
    }
    this.request(
      {
        method: 'POST',
github googleapis / google-cloud-node / packages / storage / src / file.js View on Github external
destination.constructor.name === 'Bucket') {
    destBucket = destination;
    destName = this.name;
  } else if (destination instanceof File) {
    destBucket = destination.bucket;
    destName = destination.name;
    newFile = destination;
  } else {
    throw noDestinationError;
  }

  var query = {};
  if (is.defined(this.generation)) {
    query.sourceGeneration = this.generation;
  }
  if (is.defined(options.token)) {
    query.rewriteToken = options.token;
  }
  if (is.defined(options.userProject)) {
    query.userProject = options.userProject;
    delete options.userProject;
  }

  newFile = newFile || destBucket.file(destName);

  this.request({
    method: 'POST',
    uri: format('/rewriteTo/b/{bucketName}/o/{fileName}', {
      bucketName: destBucket.name,
      fileName: encodeURIComponent(destName)
    }),
    qs: query,
github googleapis / nodejs-storage / src / file.js View on Github external
} else if (
      destination.constructor &&
      destination.constructor.name === 'Bucket'
    ) {
      destBucket = destination;
      destName = this.name;
    } else if (destination instanceof File) {
      destBucket = destination.bucket;
      destName = destination.name;
      newFile = destination;
    } else {
      throw noDestinationError;
    }

    const query = {};
    if (is.defined(this.generation)) {
      query.sourceGeneration = this.generation;
    }
    if (is.defined(options.token)) {
      query.rewriteToken = options.token;
    }
    if (is.defined(options.userProject)) {
      query.userProject = options.userProject;
      delete options.userProject;
    }

    newFile = newFile || destBucket.file(destName);

    const headers = {};

    if (is.defined(this.encryptionKey)) {
      headers['x-goog-copy-source-encryption-algorithm'] = 'AES256';
github googleapis / nodejs-storage / src / file.js View on Github external
const headers = {};

    if (is.defined(this.encryptionKey)) {
      headers['x-goog-copy-source-encryption-algorithm'] = 'AES256';
      headers['x-goog-copy-source-encryption-key'] = this.encryptionKeyBase64;
      headers[
        'x-goog-copy-source-encryption-key-sha256'
      ] = this.encryptionKeyHash;
    }

    if (is.defined(newFile.encryptionKey)) {
      this.setEncryptionKey(newFile.encryptionKey);
    } else if (is.defined(options.destinationKmsKeyName)) {
      query.destinationKmsKeyName = options.destinationKmsKeyName;
      delete options.destinationKmsKeyName;
    } else if (is.defined(newFile.kmsKeyName)) {
      query.destinationKmsKeyName = newFile.kmsKeyName;
    }

    if (query.destinationKmsKeyName) {
      this.kmsKeyName = query.destinationKmsKeyName;

      const keyIndex = this.interceptors.indexOf(this.encryptionKeyInterceptor);
      if (keyIndex > -1) {
        this.interceptors.splice(keyIndex, 1);
      }
    }

    this.request(
      {
        method: 'POST',
        uri: `/rewriteTo/b/${destBucket.name}/o/${encodeURIComponent(
github googleapis / google-cloud-node / packages / compute / src / zone.js View on Github external
json.target = [
      'https://content.googleapis.com/compute/v1/projects/',
      this.compute.projectId,
      '/zones/',
      this.name,
      '/instanceGroupManagers/',
      json.target
    ].join('');
  }

  if (is.defined(json.coolDown)) {
    json.autoscalingPolicy.coolDownPeriodSec = json.coolDown;
    delete json.coolDown;
  }

  if (is.defined(json.cpu)) {
    json.autoscalingPolicy.cpuUtilization = {
      utilizationTarget: json.cpu / 100
    };
    delete json.cpu;
  }

  if (is.defined(json.loadBalance)) {
    json.autoscalingPolicy.loadBalancingUtilization = {
      utilizationTarget: json.loadBalance / 100
    };
    delete json.loadBalance;
  }

  if (is.defined(json.maxReplicas)) {
    json.autoscalingPolicy.maxNumReplicas = json.maxReplicas;
    delete json.maxReplicas;

is

the definitive JavaScript type testing library

MIT
Latest version published 5 years ago

Package Health Score

71 / 100
Full package analysis