How to use the is-type-of.function function in is-type-of

To help you get started, we’ve selected a few is-type-of 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 eggjs / egg-core / lib / loader / file_loader.js View on Github external
function getProperties(filepath, { caseStyle }) {
  // if caseStyle is function, return the result of function
  if (is.function(caseStyle)) {
    const result = caseStyle(filepath);
    assert(is.array(result), `caseStyle expect an array, but got ${result}`);
    return result;
  }
  // use default camelize
  return defaultCamelize(filepath, caseStyle);
}
github avetjs / avet / packages / avet-core / lib / loader / avet_loader.js View on Github external
loadFile(filepath, ...inject) {
    if (!fs.existsSync(filepath)) {
      return null;
    }
    const ret = utils.loadFile(filepath);
    if (inject.length === 0) inject = [ this.app ];
    return isFunction(ret) ? ret(...inject) : ret;
  }
github node-modules / cluster-client / lib / api_client.js View on Github external
close() {
    if (is.function(this._client.close)) {
      return this._client.close();
    }
    return cluster.close(this._client);
  }
github ali-sdk / ali-ons / lib / protocol / command / remoting_command.js View on Github external
makeCustomHeaderToNet() {
    const customHeader = this.customHeader;
    if (!customHeader) {
      return;
    }

    this.extFields = this.extFields || {};
    for (const key in customHeader) {
      const field = customHeader[key];
      if (is.nullOrUndefined(field) || is.function(field)) {
        continue;
      }
      this.extFields[key] = field;
    }
  }
github midwayjs / midway / packages / midway-core / src / container.ts View on Github external
bindClass(exports) {
    if (is.class(exports) || is.function(exports)) {
      this.bindModule(exports);
    } else {
      for (const m in exports) {
        const module = exports[m];
        if (is.class(module) || is.function(module)) {
          this.bindModule(module);
        }
      }
    }
  }
github SalakJS / salak / lib / salak.js View on Github external
beforeClose (fn) {
    if (fn) {
      assert(is.function(fn), 'fn in salak.beforeClose must be a function.')
      this[CLOSE_PROMISES].add(fn)
    }
  }
github eggjs / egg-core / lib / lifecycle.js View on Github external
registerBeforeClose(fn) {
    assert(is.function(fn), 'argument should be function');
    assert(this[IS_CLOSED] === false, 'app has been closed');
    this[CLOSE_SET].add(fn);
  }
github eggjs / egg-core / lib / egg.js View on Github external
use(fn) {
    assert(is.function(fn), 'app.use() requires a function');
    debug('use %s', fn._name || fn.name || '-');
    this.middleware.push(utils.middleware(fn));
    return this;
  }
github avetjs / avet / packages / avet-core / lib / avet.js View on Github external
use(fn) {
    assert(is.function(fn), 'app.use() requires a function');
    debug('use %s', fn._name || fn.name || '-');
    this.middleware.push(utils.middleware(fn));
    return this;
  }

is-type-of

complete type checking for node

MIT
Latest version published 5 months ago

Package Health Score

73 / 100
Full package analysis

Popular is-type-of functions