How to use the fn function from is

Find comprehensive JavaScript is.fn code examples handpicked from public code repositorys.

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

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

/**
 * Track.
fork icon770
star icon0
watch icon2

170
171
172
173
174
175
176
177
178
179
  value = value.value;
} else if (Buffer.isBuffer(value)) {
  value = value.toString('base64');
} else if (is.array(value)) {
  value = value.map(preEncode);
} else if (is.object(value) && is.fn(value.hasOwnProperty)) {
  for (var prop in value) {
    if (value.hasOwnProperty(prop)) {
      value[prop] = preEncode(value[prop]);
    }
fork icon87
star icon0
watch icon1

14
15
16
17
18
19
20
21
22
23
 * @param  {Boolean} end Whether to stop the process when the warning way, the default is false
 */
exports.warning = function(msg, local = 'undefined', end = false, cb) {
  console.log(`${chalk.yellow(prefixTemp('warning'))}[${local}]`, msg)
  end && process.exit(1)
  if (cb && is.fn(cb)) return cb(msg)
}

/**
 * The error log
fork icon10
star icon126
watch icon3

+ 27 other calls in file

14
15
16
17
18
19
20
21
22
 */

'use strict';
var is = require('is');
var isObject = is.object;
var isFunction = is.fn;
var ErrorMessage = require('../classes/error-message.js');
var hapiRequestInformationExtractor = require('../request-extractors/hapi.js');
var errorHandlerRouter = require('../error-router.js');
fork icon558
star icon1
watch icon2

+ 3 other calls in file

34
35
36
37
38
39
40
41
42
43
    return validator.forceValidation;
});
if (!forceValidation && (raw_data === '' || raw_data === null || typeof raw_data === 'undefined')) {
    // don't validate empty fields, but check if required
    if (b.required) {
        var validator = is.fn(b.required) ? b.required : validators.required();
        validator(form, b, function (v_err) {
            b.error = v_err ? String(v_err) : null;
            callback(v_err, b);
        });
fork icon170
star icon0
watch icon29

+ 13 other calls in file

55
56
57
58
59
60
61
62
63
64

apply(values, querierMethod = null) {
  const args = [this.querier.builder, values]

  this.querier.builder =
    querierMethod && is.fn(this.querier[querierMethod])
      ? this.querier[querierMethod](...args)
      : this.querier.adapter[this.queryKey](...args)

  return this.querier.builder
fork icon11
star icon103
watch icon4

21
22
23
24
25
26
27
28
29
30
 * @return {Boolean}
 */
WidgetSpec.prototype.isInline = function(node) {
    var isInline = this.get('inline');

    return is.fn(isInline)? isInline(node) : isInline;
};

WidgetSpec.prototype.getComponent = function() {
    return this.get('component');
fork icon2
star icon15
watch icon3