How to use is

Comprehensive is code examples:

How to use is.throwErrors:

118
119
120
121
122
123
124
125
126
127

Clears out all registered Chains

returns `is`

### is.throwErrors()

If `is.valid` is false, throw `is.errorMessages` as an Exception

### is.configure.addValidator(name, fn, [ options ])

How to use is.testCount:

100
101
102
103
104
105
106
107
108
109

### is.valid

Returns false if any registered Chain has any errors

### is.testCount

Returns the total number of tests of all registered Chains

### is.errorCount

How to use is.instanceof:

53
54
55
56
57
58
59
60
61
62
if (is.nil(val)) {
  return {
    nullValue: 'NULL_VALUE'
  };
}
if (is.instanceof(val, Buffer) || is.instanceof(val, Uint8Array)) {
  return {
    bytesValue: val
  };
}

How to use is.METHOD:

169
170
171
172
173
174
175
176
177
178
is('abc').toExponent(2).errorMessage;
// 'value must be a number'

```

### is.METHOD(val, args*)

All validation and manipulation methods are available as properties of is.

```javascript

How to use is.clear:

112
113
114
115
116
117
118
119
120
121

### is.errorMessages

Returns an array of error messages from all registered Chains

### is.clear()

Clears out all registered Chains

returns `is`

How to use is.undef:

12
13
14
15
16
17
18
19
20
21
if (api) {
  return;
}

const apiConf = config.get('api');
if (!config.isValid() || is.undef(apiConf) || is.empty(apiConf)) {
  throw new Error('Global config is not valid. Please use the \'config-tuya\' command first.');
}

api = new Cloud({

How to use is.nan:

24
25
26
27
28
29
30
31
32
33
        res = false;
        break;
    }
} else if (type === 'number') {
    value = Number(value);
    if (!IS.number(value) || IS.nan(value)) {
        res = false;
        break;
    }
} else if(type === 'reg'){

How to use is.valid:

96
97
98
99
100
101
102
103
104
105
is === is.a.an;
// true

```

### is.valid

Returns false if any registered Chain has any errors

### is.testCount

How to use is.errorMessages:

108
109
110
111
112
113
114
115
116
117

### is.errorCount

Returns the total number of errors of all registered Chains

### is.errorMessages

Returns an array of error messages from all registered Chains

### is.clear()

How to use is.errorCount:

104
105
106
107
108
109
110
111
112
113

### is.testCount

Returns the total number of tests of all registered Chains

### is.errorCount

Returns the total number of errors of all registered Chains

### is.errorMessages

How to use is.instance:

19
20
21
22
23
24
25
26
27
28
//TODO types: string of #FFF/#FFFFFF
function Pixel(fakeArgs) {
  var i;
  var args = slice(arguments);
  this.channels = [];
  if(args.length == 1 && is.instance(args[0], Pixel)) {
    this.channels = slice(args[0].channels);
  } else if(args.length == 1 && Buffer.isBuffer(args[0])) {
    for(i=0;i<args[0].length;i++) {
      this.channels.push(args[0][i]);

How to use is.boolean:

63
64
65
66
67
68
69
70
71
72
}

// Unsubscribe user with manual flag in context.Intercom
// https://developers.intercom.io/docs/create-or-update-user
// Comparing to `undefined` since they could send `false`
if (context.unsubscribedFromEmails != undefined && is.boolean(context.unsubscribedFromEmails)) {
  ret.unsubscribed_from_emails = context.unsubscribedFromEmails;
}

// Add company data

How to use is.a:

82
83
84
85
86
87
88
89
90
91
* val - The subject of the chain
* name - The name to be used in error messages

returns a new Chain instance

### is.a is.an

returns `is`

```javascript

How to use is.configure:

122
123
124
125
126
127
128
129
130
131

### is.throwErrors()

If `is.valid` is false, throw `is.errorMessages` as an Exception

### is.configure.addValidator(name, fn, [ options ])

Add a validator to `is` and the Chain prototype

* name - The name the validator may be accessed through

How to use is.null:

23
24
25
26
27
28
29
30
31
var is = require('is');
var isNumber = is.number;
var isObject = is.object;
var isString = is.string;
var isArray = is.array;
var isNull = is.null;
var isFunction = is.function;

function Fuzzer() { }

How to use is.hosted:

425
426
427
428
429
430
431
432
433
434

  return strictlyEqual;
};

/**
 * is.hosted
 * Test if `value` is hosted by `host`.
 *
 * @param {Mixed} value to test
 * @param {Mixed} host host to test with

How to use is.bool:

18
19
20
21
22
23
24
25
26
27
// Make sure our metadata inputs are valid, putting out a console error and aborting if not.
function areOptionsValid(options) {
  var validators = {
    isHjidValid:
      is.number(options.hjid) && !is.nan(options.hjid) && options.hjid !== 0, // Make sure that HJID is a number (and isn't NaN)
    isPlaceholderPolyfillValid: is.bool(options.hjPlaceholderPolyfill) // Make sure we received a boolean.
  };

  for (var validator in validators) {
    if (!validators[validator]) {

How to use is.int:

144
145
146
147
148
149
150
151
152
 */
function encode(value) {
  function preEncode(value) {
    var numberShouldBeStringified =
      !(value instanceof Float) &&
      is.int(value) ||
      value instanceof Int ||
      is.infinite(value) ||
      Number.isNaN(value);

How to use is.undefined:

5
6
7
8
9
10
11
12
13
14

module.exports = function git(module, env, next) {
  let isString = is.string,
    isFn = is.fn,
    isBool = is.bool,
    isUndefined = is.undefined
  let localLogger = (local, type) => (msg, end = false, cb = next) =>
    logger[type](msg, local, end, cb)
  let error = localLogger('git', 'error')
  let warning = localLogger('git', 'warning')

How to use is.infinite:

146
147
148
149
150
151
152
153
154
155
function preEncode(value) {
  var numberShouldBeStringified =
    !(value instanceof Float) &&
    is.int(value) ||
    value instanceof Int ||
    is.infinite(value) ||
    Number.isNaN(value);

  if (is.date(value)) {
    value = value.toJSON();

How to use is.nil:

41
42
43
44
45
46
47
48
49
50
  );

const createValidator = (fn, args, passIfEmpty) => {
  const validator = (val) => {
    const validatorArgs = [val].concat(args);
    if ((passIfEmpty && (is.empty(val) || is.nil(val))) || is.undef(val)) {
      return true;
    }
    return fn.apply(this, validatorArgs);
  };

How to use is.function:

24
25
26
27
28
29
30
31
32
33
var isNumber = is.number;
var isObject = is.object;
var isString = is.string;
var isArray = is.array;
var isNull = is.null;
var isFunction = is.function;

function Fuzzer() { }

Fuzzer.prototype.generate = {};

How to use is.number:

19
20
21
22
23
24
25
26
27
28
var indexOf = require('lodash.indexof');
var without = require('lodash.without');
var maxBy = require('lodash.maxby');
var random = require('lodash.random');
var is = require('is');
var isNumber = is.number;
var isObject = is.object;
var isString = is.string;
var isArray = is.array;
var isNull = is.null;

How to use is.object:

49
50
51
52
53
54
55
56
57
58

  return this.craftRequest('FortSearch', payload);
}

releasePokemon(pokemonOrId) {
  const id = is.object(pokemonOrId) ? pokemonOrId.id : pokemonOrId;
  console.log('Releasing pokemon', pokemonOrId)
  const payload = {
    pokemon_id: id,
  };

How to use is.hash:

84
85
86
87
88
89
90
91
92
93
if (deep && copy && (is.hash(copy) || (copyIsArray = is.array(copy)))) {
  if (copyIsArray) {
    copyIsArray = false;
    clone = src && is.array(src) ? src : [];
  } else {
    clone = src && is.hash(src) ? src : {};
  }

  // Never move original objects, clone them
  setProperty(target, name, extend(deep, clone, copy));

How to use is.fn:

162
163
164
165
166
167
168
169
170
171
 *
 * @return {Boolean}
 */

Kenshoo.prototype.loaded = function(){
  return is.fn(window.k_trackevent);
};

/**
 * Track.

How to use is.type:

137
138
139
140
141
142
143
144
145
146
/**
 * Test general.
 */

/**
 * is.type
 * Test if `value` is a type of `type`.
 *
 * @param {Mixed} value value to test
 * @param {String} type type

How to use is.equal:

191
192
193
194
195
196
197
198
199
200

  return !value;
};

/**
 * is.equal
 * Test if `value` is equal to `other`.
 *
 * @param {Mixed} value value to test
 * @param {Mixed} other value to compare with

How to use is.string:

221
222
223
224
225
226
227
228
229
230
 * });
 */
TransactionRequest.prototype.createReadStream = function(table, query) {
  var self = this;

  if (is.array(query) || is.string(query)) {
    query = {
      keys: query
    };
  }