How to use the is-type-of.string 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 ali-sdk / ali-oss / lib / object.js View on Github external
proto.get = async function get(name, file, options) {
  let writeStream = null;
  let needDestroy = false;

  if (is.writableStream(file)) {
    writeStream = file;
  } else if (is.string(file)) {
    writeStream = fs.createWriteStream(file);
    needDestroy = true;
  } else {
    // get(name, options)
    options = file;
  }

  options = options || {};
  if (options.process) {
    options.subres = options.subres || {};
    options.subres['x-oss-process'] = options.process;
  }

  let result;
  try {
    const params = this._objectRequestParams('GET', name, options);
github eggjs / egg / lib / core / messenger / ipc.js View on Github external
_onMessage(message) {
    if (message && is.string(message.action)) {
      debug('[%s] got message %s with %j, receiverPid: %s',
        this.pid, message.action, message.data, message.receiverPid);
      this.emit(message.action, message.data);
    }
  }
github eggjs / egg / lib / core / messenger / local.js View on Github external
_onMessage(message) {
    if (message && is.string(message.action)) {
      debug('[%s] got message %s with %j', this.pid, message.action, message.data);
      this.emit(message.action, message.data);
    }
  }
github eggjs / egg-view-assets / lib / dev_server.js View on Github external
replacePort(str) {
    if (!is.string(str)) return str;
    return str.replace('{port}', this.app.config.assets.devServer.port);
  }
github eggjs / egg-router-plus / lib / router.js View on Github external
function addPrefix(prefix, path) {
  assert(is.string(path), `only support path with string, but got ${path}`);
  return prefix + path;
}
github ali-sdk / ali-oss / lib / multipart.js View on Github external
proto._getFileSize = function* _getFileSize(file) {
  if (is.buffer(file)) {
    return file.length;
  } else if (is.file(file)) {
    return file.size;
  } if (is.string(file)) {
    var stat = yield this._statFile(file);
    return stat.size;
  }

  throw new Error('_getFileSize requires Buffer/File/String.');
};
github ali-sdk / ali-oss / lib / browser / managed-upload.js View on Github external
proto._getFileSize = async function _getFileSize(file) {
  if (is.buffer(file)) {
    return file.length;
  } else if (is.blob(file) || is.file(file)) {
    return file.size;
  } if (is.string(file)) {
    const stat = await this._statFile(file);
    return stat.size;
  }

  throw new Error('_getFileSize requires Buffer/File/String.');
};
github ali-sdk / ali-oss / lib / browser / multipart.js View on Github external
proto._getFileSize = function* _getFileSize(file) {
  if (is.buffer(file)) {
    return file.length;
  } else if (is.file(file)) {
    return file.size;
  } if (is.string(file)) {
    var stat = yield this._statFile(file);
    return stat.size;
  }

  throw new Error('_getFileSize requires Buffer/File/String.');
};
github ali-sdk / ali-oss / lib / managed-upload.js View on Github external
proto._getFileSize = async function _getFileSize(file) {
  if (is.buffer(file)) {
    return file.length;
  } else if (is.file(file)) {
    return file.size;
  } if (is.string(file)) {
    const stat = await this._statFile(file);
    return stat.size;
  }

  throw new Error('_getFileSize requires Buffer/File/String.');
};

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