• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript lodash.isBoolean函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript lodash.isDate函数代码示例发布时间:2022-05-25
下一篇:
TypeScript lodash.isArray函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap