How to use the is.undefined 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 firebase / user-privacy / functions / node_modules / @google-cloud / common-grpc / node_modules / @google-cloud / common / src / util.js View on Github external
var wrapper = function() {
    var context = this;
    var last;

    for (last = arguments.length - 1; last >= 0; last--) {
      var arg = arguments[last];

      if (is.undefined(arg)) {
        continue; // skip trailing undefined.
      }

      if (!is.fn(arg)) {
        break; // non-callback last argument found.
      }

      return originalMethod.apply(context, arguments);
    }

    // peel trailing undefined.
    var args = slice.call(arguments, 0, last + 1);

    var PromiseCtor = Promise;

    // Because dedupe will likely create a single install of
github googleapis / nodejs-bigquery / src / table.ts View on Github external
static encodeValue_(value) {
    if (is.undefined(value) || is.null(value)) {
      return null;
    }

    if (value instanceof Buffer) {
      return value.toString('base64');
    }

    if (value instanceof Big) {
      return value.toFixed();
    }

    const customTypeConstructorNames = [
      'BigQueryDate',
      'BigQueryDatetime',
      'BigQueryTime',
      'BigQueryTimestamp',
github darukjs / daruk / build / core / daruk_init_module.js View on Github external
middlewareOrder.forEach(function useMiddleware(name) {
            const middleware = self.module.middleware[name];
            assert(is.undefined(middleware) === false, `[middleware] ${name} is not found`);
            if (isFn(middleware)) {
                self.use(middleware, name);
            }
        });
        this.prettyLog(JSON.stringify(utils_1.filterBuiltInModule('middleware', middlewareOrder)), {
github googleapis / nodejs-spanner / src / codec.ts View on Github external
constructor(value) {
    if (arguments.length > 1) {
      throw new TypeError([
        'The spanner.date function accepts a Date object or a',
        'single argument parseable by Date\'s constructor.',
      ].join(' '));
    }
    if (is.undefined(value)) {
      value = new Date();
    }
    this.value = new Date(value).toJSON().replace(/T.+/, '');
  }
}
github owsas / parse-cloud-class / src / ParseCloudClass.ts View on Github external
static setDefaultValues (obj: Parse.Object, defaultValues: any): Parse.Object {
    const object = obj.clone();

    for (const key of Object.keys(defaultValues)) {
      if (is.undefined(object.get(key))) {
        object.set(key, defaultValues[key]);
      }
    }

    return object;
  }
github googleapis / google-cloud-node / packages / datastore / src / entity.js View on Github external
function keyToKeyProto(key) {
  if (is.undefined(key.kind)) {
    throw new InvalidKeyError({
      code: 'MISSING_KIND'
    });
  }

  var keyProto = {
    path: []
  };

  if (key.namespace) {
    keyProto.partitionId = {
      namespaceId: key.namespace
    };
  }

  var numKeysWalked = 0;
github GitbookIO / markup-it / lib / models / rule.js View on Github external
return this.match(function(state, text) {
        var block = {};

        var match = re.exec(text);
        if (!match) return null;

        if (propsFn) block = propsFn.call(null, state, match);
        if (!block) return null;
        if (is.array(block)) return block;

        block.raw = is.undefined(block.raw)? match[0] : block.raw;

        return block;
    });
};
github owsas / parse-cloud-class / src / ParseCloudClass.ts View on Github external
static checkAndCorrectMinimumValues (
    object: Parse.Object,
    minimumValues: {[key: string]: number} = {},
  ): Parse.Object {
    const obj = object.clone();

    for (const key in minimumValues) {
      if (is.undefined(obj.get(key)) || (obj.get(key) < minimumValues[key])) {
        obj.set(key, minimumValues[key]);
      }
    }

    return obj;
  }
github firebase / user-privacy / functions / node_modules / @google-cloud / common-grpc / src / service.js View on Github external
ObjectToStructConverter.prototype.convert = function(obj) {
  var convertedObject = {
    fields: {}
  };

  this.seenObjects.add(obj);

  for (var prop in obj) {
    if (obj.hasOwnProperty(prop)) {
      var value = obj[prop];

      if (is.undefined(value)) {
        continue;
      }

      convertedObject.fields[prop] = this.encodeValue_(value);
    }
  }

  this.seenObjects.delete(obj);

  return convertedObject;
};
github GitbookIO / markup-it / lib / rule.js View on Github external
Rule.prototype.option = function option(key, value) {
    if (is.undefined(value)) return this.opts[key];
    this.opts[key] = value;
    return this;
};

is

the definitive JavaScript type testing library

MIT
Latest version published 5 years ago

Package Health Score

71 / 100
Full package analysis