How to use the is.bool 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 alibaba / vanex / src / vanex-model.js View on Github external
function parse(val) {
            if (val instanceof MobxModel) {
                return val.toJS();
            }
            if (Array.isArray(val) || isObservableArray(val)) {
                return val.map(item => parse(item));
            } else if (
                !val ||
                is.date(val) ||
                is.bool(val) ||
                is.fn(val) ||
                is.number(val) ||
                is.string(val) ||
                is.regexp(val)
            ) {
                return val;
            } else if (val && typeof val === "object") {
                return mapValues(val, item => parse(item));
            }

            return toJS(val);
        }
github GitbookIO / markup-it / src / markdown / liquid / stringifyTag.js View on Github external
function stringifyLiteral(value) {
    if (is.bool(value)) {
        return value ? 'true' : 'false';
    } else if (is.string(value)) {
        return `"${escape(value)}"`;
    }

    return String(value);
}
github segment-integrations / analytics.js-integration-google-analytics / lib / index.js View on Github external
each(group, function(prop, key) {
      var value = dot(obj, prop) || obj[prop];
      if (is.bool(value)) value = value.toString();
      if (value || value === 0) ret[key] = value;
    });
  });
github googleapis / google-cloud-node / packages / bigquery / src / index.js View on Github external
if (value instanceof BigQuery.date) {
    typeName = 'DATE';
  } else if (value instanceof BigQuery.datetime) {
    typeName = 'DATETIME';
  } else if (value instanceof BigQuery.time) {
    typeName = 'TIME';
  } else if (value instanceof BigQuery.timestamp) {
    typeName = 'TIMESTAMP';
  } else if (value instanceof Buffer) {
    typeName = 'BYTES';
  } else if (is.array(value)) {
    return {
      type: 'ARRAY',
      arrayType: BigQuery.getType_(value[0])
    };
  } else if (is.bool(value)) {
    typeName = 'BOOL';
  } else if (is.number(value)) {
    typeName = value % 1 === 0 ? 'INT64' : 'FLOAT64';
  } else if (is.object(value)) {
    return {
      type: 'STRUCT',
      structTypes: Object.keys(value).map(function(prop) {
        return {
          name: prop,
          type: BigQuery.getType_(value[prop])
        };
      })
    };
  } else if (is.string(value)) {
    typeName = 'STRING';
  }
github caolan / forms / lib / widgets.js View on Github external
var isScalar = function (value) {
    return !value || is.string(value) || is.number(value) || is.bool(value);
};
github TRUEPIC / queryql / src / schema.js View on Github external
page(isEnabledOrOptions = true) {
    if (is.bool(isEnabledOrOptions)) {
      this.pageOptions = { isEnabled: isEnabledOrOptions }
    } else {
      this.pageOptions = {
        ...isEnabledOrOptions,
        isEnabled:
          isEnabledOrOptions.isEnabled !== undefined
            ? isEnabledOrOptions.isEnabled
            : true,
      }
    }

    return this
  }
github segmentio / analytics.js-integrations / integrations / google-analytics / lib / index.js View on Github external
each(group, function(prop, key) {
      var value = dot(obj, prop) || obj[prop];
      if (is.bool(value)) value = value.toString();
      if (value || value === 0) ret[key] = value;
    });
  });

is

the definitive JavaScript type testing library

MIT
Latest version published 5 years ago

Package Health Score

71 / 100
Full package analysis