當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript lodash.isBoolean函數代碼示例

本文整理匯總了TypeScript中lodash.isBoolean函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript isBoolean函數的具體用法?TypeScript isBoolean怎麽用?TypeScript isBoolean使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了isBoolean函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: deepDiff

 deepDiff(one: Object, two: Object, path: string = ''): IDeepDiff[] {
     let result: IDeepDiff[] = [];
     for (var key of _.keys(one)) {
         let concatPath: string = path ? path + '.' + key : key;
         if (_.isPlainObject(one[key])) {
             if (!_.has(two, key)) {
                 result.push(new DeepDiff('deleted', concatPath, one[key], null));
             } else {
                 result = _.concat(result, this.deepDiff(one[key], two[key], path ? path + '.' + key : key));
             }
         } else if (_.isBoolean(one[key]) || _.isDate(one[key]) || _.isNumber(one[key])
             || _.isNull(one[key]) || _.isRegExp(one[key]) || _.isString(one[key])) {
             if (!_.has(two, key)) {
                 result.push(new DeepDiff('deleted', concatPath, one[key], null));
             } else if (_.get(one, key) !== _.get(two, key)) {
                 result.push(new DeepDiff('edited', concatPath, one[key], two[key]));
             }
         } else if (_.isArray(one[key]) && _.isArray(two[key]) && !_.isEqual(one[key], two[key])) {
             result.push(new DeepDiff('array', concatPath, one[key], two[key]));
         } else if (!_.has(two, key)) {
             result.push(new DeepDiff('deleted', concatPath, one[key], null));
         }
     }
     for (var key of _.keys(two)) {
         let concatPath: string = path ? path + '.' + key : key;
         if (!_.has(one, key)) {
             if (_.isPlainObject(two[key]) || _.isBoolean(two[key]) || _.isDate(two[key]) || _.isNumber(two[key])
                 || _.isNull(two[key]) || _.isRegExp(two[key]) || _.isString(two[key]) || _.isArray(two[key])) {
                 result.push(new DeepDiff('created', concatPath, null, two[key]));
             }
         }
     }
     return result;
 }
開發者ID:fyyyyy,項目名稱:chrobject,代碼行數:34,代碼來源:EntryAppService.ts

示例2:

 return _.filter(configurations, (config) => {
     const validActiveLow = _.has(config, 'activeLow') ? _.isBoolean(config.activeLow) : true;
     const validDescription = _.has(config, 'description') ? _.isString(config.description) : true;
     const validApiPathAlias = _.has(config, 'apiPathAlias') ? _.isString(config.apiPathAlias) : true;
     const validGpioConfig = (_.isNumber(config.bcmPinNumber) && _.isBoolean(config.state));
     return validActiveLow && validDescription && validApiPathAlias && validGpioConfig;
 });
開發者ID:kaga,項目名稱:Home-Sensor,代碼行數:7,代碼來源:gpioController.ts

示例3: user_to_ldap_filter

const _convert_simple_acl_search = ({ user_to_subv, ...other } : simple_acl_search): acl_search => ({
    ...other,
    async user_to_ldap_filter(user) {
        const or_subv = _normalize__or_subv(await user_to_subv(user));
        return _.isBoolean(or_subv) ? or_subv : filters.or(or_subv.map(l => filters.and(search_ldap.subv_to_eq_filters(l))));
    },
    async user_to_mongo_filter(user) {
        const or_subv = _normalize__or_subv(await user_to_subv(user));
        return _.isBoolean(or_subv) ? or_subv : db.or(or_subv.map(subv => _.mapKeys(subv, (_,k) => "v." + k)));
    },
})
開發者ID:prigaux,項目名稱:compte-externe,代碼行數:11,代碼來源:acl.ts

示例4: function

Wallets.prototype.list = function(params, callback) {
  params = params || {};
  common.validateParams(params, [], [], callback);

  const queryObject: any = {};

  if (params.skip && params.prevId) {
    throw new Error('cannot specify both skip and prevId');
  }

  if (params.getbalances) {
    if (!_.isBoolean(params.getbalances)) {
      throw new Error('invalid getbalances argument, expecting boolean');
    }
    queryObject.getbalances = params.getbalances;
  }
  if (params.prevId) {
    if (!_.isString(params.prevId)) {
      throw new Error('invalid prevId argument, expecting string');
    }
    queryObject.prevId = params.prevId;
  }
  if (params.limit) {
    if (!_.isNumber(params.limit)) {
      throw new Error('invalid limit argument, expecting number');
    }
    queryObject.limit = params.limit;
  }

  if (params.allTokens) {
    if (!_.isBoolean(params.allTokens)) {
      throw new Error('invalid allTokens argument, expecting boolean');
    }
    queryObject.allTokens = params.allTokens;
  }

  const self = this;
  return this.bitgo.get(this.baseCoin.url('/wallet'))
  .query(queryObject)
  .result()
  .then(function(body) {
    body.wallets = body.wallets.map(function(w) {
      return new self.coinWallet(self.bitgo, self.baseCoin, w);
    });
    return body;
  })
  .nodeify(callback);
};
開發者ID:BitGo,項目名稱:BitGoJS,代碼行數:48,代碼來源:wallets.ts

示例5: boolean

        return _.some(values, v => {
          if (!_.isBoolean(v)) {
            bp.logger.warn('Filter returned something other ' + 'than a boolean (or a Promise of a boolean)')
          }

          return typeof v !== 'undefined' && v !== null && v !== true
        })
開發者ID:alexsandrocruz,項目名稱:botpress,代碼行數:7,代碼來源:daemon.ts

示例6:

      panelUpgrades.push(function(panel) {
        // rename panel type
        if (panel.type === 'graphite') {
          panel.type = 'graph';
        }

        if (panel.type !== 'graph') {
          return;
        }

        if (_.isBoolean(panel.legend)) { panel.legend = { show: panel.legend }; }

        if (panel.grid) {
          if (panel.grid.min) {
            panel.grid.leftMin = panel.grid.min;
            delete panel.grid.min;
          }

          if (panel.grid.max) {
            panel.grid.leftMax = panel.grid.max;
            delete panel.grid.max;
          }
        }

        if (panel.y_format) {
          panel.y_formats[0] = panel.y_format;
          delete panel.y_format;
        }

        if (panel.y2_format) {
          panel.y_formats[1] = panel.y2_format;
          delete panel.y2_format;
        }
      });
開發者ID:sis-labs,項目名稱:grafana,代碼行數:34,代碼來源:dashboard_srv.ts

示例7: function

Keychains.prototype.add = function(params, callback) {
  params = params || {};
  common.validateParams(params, [], ['pub', 'encryptedPrv', 'type', 'source', 'originalPasscodeEncryptionCode', 'enterprise', 'derivedFromParentWithSeed'], callback);

  if (!_.isUndefined(params.disableKRSEmail)) {
    if (!_.isBoolean(params.disableKRSEmail)) {
      throw new Error('invalid disableKRSEmail argument, expecting boolean');
    }
  }

  if (params.reqId) {
    this.bitgo._reqId = params.reqId;
  }
  return this.bitgo.post(this.baseCoin.url('/key'))
  .send({
    pub: params.pub,
    encryptedPrv: params.encryptedPrv,
    type: params.type,
    source: params.source,
    provider: params.provider,
    originalPasscodeEncryptionCode: params.originalPasscodeEncryptionCode,
    enterprise: params.enterprise,
    derivedFromParentWithSeed: params.derivedFromParentWithSeed,
    disableKRSEmail: params.disableKRSEmail,
    krsSpecific: params.krsSpecific
  })
  .result()
  .nodeify(callback);
};
開發者ID:BitGo,項目名稱:BitGoJS,代碼行數:29,代碼來源:keychains.ts

示例8: setValue

 public async setValue(opts: CommandOptions) {
   // get value so we have a type
   const splitted = opts.parameters.split(' ');
   const pointer = splitted.shift();
   let newValue = splitted.join(' ');
   if (!pointer) {
     return sendMessage(`$sender, settings does not exists`, opts.sender);
   }
   const currentValue = await get(global, pointer, undefined);
   if (typeof currentValue !== 'undefined') {
     if (isBoolean(currentValue)) {
       newValue = newValue.toLowerCase().trim();
       if (['true', 'false'].includes(newValue)) {
         set(global, pointer, newValue === 'true');
         sendMessage(`$sender, ${pointer} set to ${newValue}`, opts.sender);
       } else {
         sendMessage('$sender, !set error: bool is expected', opts.sender);
       }
     } else if (isNumber(currentValue)) {
       if (isFinite(Number(newValue))) {
         set(global, pointer, Number(newValue));
         sendMessage(`$sender, ${pointer} set to ${newValue}`, opts.sender);
       } else {
         sendMessage('$sender, !set error: number is expected', opts.sender);
       }
     } else if (isString(currentValue)) {
       set(global, pointer, newValue);
       sendMessage(`$sender, ${pointer} set to '${newValue}'`, opts.sender);
     } else {
       sendMessage(`$sender, ${pointer} is not supported settings to change`, opts.sender);
     }
   } else {
     sendMessage(`$sender, ${pointer} settings not exists`, opts.sender);
   }
 }
開發者ID:sogehige,項目名稱:SogeBot,代碼行數:35,代碼來源:general.ts

示例9: function

PendingApproval.prototype.constructApprovalTx = function(params, callback) {
  params = params || {};
  common.validateParams(params, [], ['walletPassphrase'], callback);

  if (this.type() === 'transactionRequest' && !(params.walletPassphrase || params.xprv)) {
    throw new Error('wallet passphrase or xprv required to approve a transactionRequest');
  }

  if (params.useOriginalFee) {
    if (!_.isBoolean(params.useOriginalFee)) {
      throw new Error('invalid type for useOriginalFeeRate');
    }
    if (params.fee || params.feeRate || params.feeTxConfirmTarget) {
      throw new Error('cannot specify a fee/feerate/feeTxConfirmTarget as well as useOriginalFee');
    }
  }

  const self = this;
  return Promise.try(function() {
    if (self.type() === 'transactionRequest') {
      const extendParams: any = { txHex: self.info().transactionRequest.transaction };
      if (params.useOriginalFee) {
        extendParams.fee = self.info().transactionRequest.fee;
      }
      return self.populateWallet()
      .then(function() {
        return self.recreateAndSignTransaction(_.extend(params, extendParams));
      });
    }
  });
};
開發者ID:BitGo,項目名稱:BitGoJS,代碼行數:31,代碼來源:pendingapproval.ts


注:本文中的lodash.isBoolean函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。