How to use the util.isUndefined function in util

To help you get started, we’ve selected a few util 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 kpi-wdc / dj / dj-libs / script / impl / dps / return.js View on Github external
var result = undefined;
                jp.apply(d, path, function(value) {
                    if (util.isUndefined(result)) {
                        result = value;
                    } else {
                        if (!util.isArray(result)) {
                            result = [result]
                        }
                        result.push(value)
                    }
                    return value
                })
                return result
            }

            if (util.isUndefined(command.settings) || util.isUndefined(command.settings.path) || command.settings.path == "" || command.settings.path == "$") {

                // state.head = {
                //     data: state.head.data,
                //     type: command.settings.as || "json"
                // }
                // if (util.isFunction(state.head.data)) state.head.type = 'function'
                return state;
            }
            // if (command.settings.path.indexOf("_")==0){
            //    var res = state.storage._[command.settings.path.substring(2,command.settings.path.length)];
            //    state.head={
            //     data: res,
            //     type: typeof res
            //   }
            // }else{
            state.head = {
github nodekit-io / nodekit-darwin / src / nodekit / NKCore / lib-core / node / net.js View on Github external
function Socket(options) {
  if (!(this instanceof Socket)) return new Socket(options);

  this._connecting = false;
  this._hadError = false;
  this._handle = null;
  this._parent = null;
  this._host = null;

  if (util.isNumber(options))
    options = { fd: options }; // Legacy interface.
  else if (util.isUndefined(options))
    options = {};

  stream.Duplex.call(this, options);

  if (options.handle) {
    this._handle = options.handle; // private
  } else if (!util.isUndefined(options.fd)) {
    this._handle = createHandle(options.fd);
    this._handle.open(options.fd);
    // this._handle.open() puts the file descriptor in non-blocking
    // mode but it must be synchronous for backwards compatibility.
    if ((options.fd == 1 || options.fd == 2) && this._handle instanceof Pipe) {
      // Make stdout and stderr blocking on Windows
      var err = this._handle.setBlocking(true);
      if (err)
        throw errnoException(err, 'setBlocking');
github repetere / periodicjs / public / extensions / periodicjs.ext.admin / javascripts / item.js View on Github external
if (type === 'error') {
    if (!this._events.error ||
        (util.isObject(this._events.error) && !this._events.error.length)) {
      er = arguments[1];
      if (er instanceof Error) {
        throw er; // Unhandled 'error' event
      } else {
        throw TypeError('Uncaught, unspecified "error" event.');
      }
      return false;
    }
  }

  handler = this._events[type];

  if (util.isUndefined(handler))
    return false;

  if (util.isFunction(handler)) {
    switch (arguments.length) {
      // fast cases
      case 1:
        handler.call(this);
        break;
      case 2:
        handler.call(this, arguments[1]);
        break;
      case 3:
        handler.call(this, arguments[1], arguments[2]);
        break;
      // slower
      default:
github metatron-app / metatron-discovery / discovery-frontend / src / app / meta-data-management / metadata / metadata.component.ts View on Github external
private _getMetadataParams(): any {

    const params = {
      page: this.page.page,
      size: this.page.size,
      sort: this.selectedSort.value,
      pseudoParam : (new Date()).getTime()
    };

    // 검색어
    if (!isUndefined(this.listSearchText) && this.listSearchText.trim() !== '') {
      params['nameContains'] = this.listSearchText.trim();
    }

    // 데이터타입
    if (!isUndefined(this.sourceType) && this.sourceType.trim() !== '') {
      params['sourceType'] = this.sourceType.trim();
    }

    // 태그
    if (!isUndefined(this.tag) && this.tag.trim() !== '') {
      params['tag'] = this.tag.trim();
    }

    return params;
  }
github metatron-app / metatron-discovery / discovery-frontend / src / app / meta-data-management / code-table / code-table.component.ts View on Github external
private _getCodeTableListParams(): object {
    const params = {
      size: this.pageResult.size,
      page: this.pageResult.number,
      sort: this.selectedContentSort.key + ',' + this.selectedContentSort.sort
    };
    // 검색어
    if (!isUndefined(this.searchText) && this.searchText.trim() !== '') {
      params['nameContains'] = this.searchText.trim();
    }
    // date
    if (this._selectedDate && this._selectedDate.type !== 'ALL') {
      params['searchDateBy'] = 'CREATED';
      if (this._selectedDate.startDateStr) {
        params['from'] = moment(this._selectedDate.startDateStr).format('YYYY-MM-DDTHH:mm:ss.SSSZ');
      }
      if (this._selectedDate.endDateStr) {
        params['to'] = moment(this._selectedDate.endDateStr).format('YYYY-MM-DDTHH:mm:ss.SSSZ');
      }
    }
    return params;
  }
}
github cli-kit / cli-input / lib / patch / readline.js View on Github external
function emitKeys(stream, s) {
  if (util.isBuffer(s)) {
    if (s[0] > 127 && util.isUndefined(s[1])) {
      s[0] -= 128;
      s = '\x1b' + s.toString(stream.encoding || 'utf-8');
    } else {
      s = s.toString(stream.encoding || 'utf-8');
    }
  }

  var buffer = [];
  var match;
  while (match = escapeCodeReAnywhere.exec(s)) {
    buffer = buffer.concat(s.slice(0, match.index).split(''));
    buffer.push(match[0]);
    s = s.slice(match.index + match[0].length);
  }
  buffer = buffer.concat(s.split(''));
github nodekit-io / nodekit-darwin / src / nodekit / NKCore / lib-core / node / buffer.js View on Github external
throw new Error(writeMsg);
      else if (process.traceDeprecation)
        console.trace(writeMsg);
      else
        console.error(writeMsg);
      writeWarned = true;
    }

    var swap = encoding;
    encoding = offset;
    offset = length >>> 0;
    length = swap;
  }

  var remaining = this.length - offset;
  if (util.isUndefined(length) || length > remaining)
    length = remaining;

  encoding = !!encoding ? (encoding + '').toLowerCase() : 'utf8';

  if (string.length > 0 && (length < 0 || offset < 0))
    throw new RangeError('attempt to write outside buffer bounds');

  var ret;
  switch (encoding) {
    case 'hex':
      ret = this.hexWrite(string, offset, length);
      break;

    case 'utf8':
    case 'utf-8':
      ret = this.utf8Write(string, offset, length);
github Caleydo / lineage / src / genealogyTree.ts View on Github external
familyNodes.forEach((n: Node) => {
      const familyPos = this.getFamilyPos(n);
      if (!isUndefined(familyPos)) {
        couplesData.push(familyPos);
      }
    });
github tlivings / enjoi / lib / resolver.js View on Github external
regularString(schema, joischema) {
        schema.pattern && (joischema = joischema.regex(new RegExp(schema.pattern)));
    
        if (Util.isUndefined(schema.minLength)) {
            schema.minLength = 0;
        }
    
        if (schema.minLength === 0) {
            joischema = joischema.allow('');
        }
        Util.isNumber(schema.minLength) && (joischema = joischema.min(schema.minLength));
        Util.isNumber(schema.maxLength) && (joischema = joischema.max(schema.maxLength));
        return joischema;
    }
github kpi-wdc / dj / dj-libs / script / impl / dps / return.js View on Github external
jp.apply(d, path, function(value) {
                    if (util.isUndefined(result)) {
                        result = value;
                    } else {
                        if (!util.isArray(result)) {
                            result = [result]
                        }
                        result.push(value)
                    }
                    return value
                })
                return result