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

TypeScript underscore.isEmpty函数代码示例

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

本文整理汇总了TypeScript中underscore.isEmpty函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isEmpty函数的具体用法?TypeScript isEmpty怎么用?TypeScript isEmpty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了isEmpty函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: async

  watcher.on(actions.checkForGameUpdates, async (store, action) => {
    reschedule(store);

    if (!store.getState().setup.done) {
      return;
    }

    store.dispatch(
      actions.gameUpdateCheckStatus({
        checking: true,
        progress: 0,
      })
    );

    try {
      store.dispatch(
        actions.gameUpdateCheckStatus({
          checking: true,
          progress: 0,
        })
      );

      const res = await mcall(messages.CheckUpdate, {}, convo => {
        hookLogging(convo, logger);

        convo.on(messages.GameUpdateAvailable, async ({ update }) => {
          store.dispatch(actions.gameUpdateAvailable({ update }));
        });

        convo.on(messages.Progress, async ({ progress }) => {
          store.dispatch(
            actions.gameUpdateCheckStatus({
              checking: true,
              progress,
            })
          );
        });
      });

      if (!isEmpty(res.updates)) {
        for (const update of res.updates) {
          store.dispatch(actions.gameUpdateAvailable({ update }));
        }
      }

      if (!isEmpty(res.warnings)) {
        logger.warn(`Got warnings when checking for updates: `);
        for (const w of res.warnings) {
          logger.warn(w);
        }
      }
    } finally {
      store.dispatch(
        actions.gameUpdateCheckStatus({
          checking: false,
          progress: -1,
        })
      );
    }
  });
开发者ID:itchio,项目名称:itch,代码行数:60,代码来源:updater.ts


示例2: dispatchUpdateNotification

function dispatchUpdateNotification(
  store: Store,
  cave: Cave,
  result: CheckUpdateResult
) {
  if (!result) {
    return;
  }

  if (!isEmpty(result.warnings)) {
    store.dispatch(
      actions.statusMessage({
        message: [
          "status.game_update.check_failed",
          { err: result.warnings[0] },
        ],
      })
    );
    return;
  }

  if (isEmpty(result.updates)) {
    store.dispatch(
      actions.statusMessage({
        message: ["status.game_update.not_found", { title: cave.game.title }],
      })
    );
  } else {
    store.dispatch(
      actions.statusMessage({
        message: ["status.game_update.found", { title: cave.game.title }],
      })
    );
  }
}
开发者ID:itchio,项目名称:itch,代码行数:35,代码来源:updater.ts


示例3: hasSearchResults

export function hasSearchResults(sr: ISearchResults): boolean {
  if (sr && sr.games && !isEmpty(sr.games.ids)) {
    return true;
  }
  if (sr && sr.users && !isEmpty(sr.users.ids)) {
    return true;
  }
  return false;
}
开发者ID:HorrerGames,项目名称:itch,代码行数:9,代码来源:search-helpers.ts


示例4: concatTemplates

export function concatTemplates(
  a: IMenuTemplate,
  b: IMenuTemplate
): IMenuTemplate {
  if (isEmpty(a)) {
    return b;
  }

  if (isEmpty(b)) {
    return a;
  }

  return [...a, { type: "separator" }, ...b];
}
开发者ID:HorrerGames,项目名称:itch,代码行数:14,代码来源:build-template.ts


示例5: getFromAdapters

async function getFromAdapters(): Promise<DimData | undefined> {
  for (const adapter of adapters.slice().reverse()) {
    if (adapter.enabled) {
        if ($featureFlags.debugSync) {
          console.log('getting from ', adapter.name);
        }
        try {
          const value = await adapter.get();

          if (value && !_.isEmpty(value)) {
            if ($featureFlags.debugSync) {
              console.log('got', value, 'from adapter ', adapter.name);
            }
            return value;
          }
        } catch (e) {
          console.error('Sync: Error loading from', adapter.name, e);
          reportException('Sync Load', e);
        }
    } else if ($featureFlags.debugSync) {
      console.log(adapter.name, 'is disabled');
    }
  }
  return undefined;
}
开发者ID:delphiactual,项目名称:DIM,代码行数:25,代码来源:sync.service.ts


示例6: work

  async work(): Promise<void> {
    const installLocationId = this.space().firstPathElement();

    let call = withLogger(this.logger);

    const { caves, installLocationPath, installLocationSize } = await call(
      messages.FetchCavesByInstallLocationID,
      { installLocationId }
    );

    let games: Game[] = [];
    if (!isEmpty(caves)) {
      for (const c of caves) {
        games.push(c.game);
      }
      games = uniq(games, g => g.id);
    }

    this.pushUnfilteredGames(games, { disableFilters: true });
    this.push({
      location: {
        path: installLocationPath,
        size: installLocationSize,
      },
    });
  }
开发者ID:HorrerGames,项目名称:itch,代码行数:26,代码来源:location-fetcher.ts


示例7: countCurrencies

  /**
   * Calculates a count of how many of each type of currency you
   * have on all characters, limited to only currencies required to
   * buy items from the provided vendors.
   */
  function countCurrencies(stores: D1Store[], vendors: { [vendorHash: number]: Vendor }) {
    if (!stores || !vendors || !stores.length || _.isEmpty(vendors)) {
      return {};
    }

    const categories = flatMap(Object.values(vendors), (v) => v.categories);
    const saleItems = flatMap(categories, (c) => c.saleItems);
    const costs = flatMap(saleItems, (i: any) => i.costs);
    const currencies = costs.map((c: any) => c.currency.itemHash);

    const totalCoins: { [currencyHash: number]: number } = {};
    currencies.forEach((currencyHash) => {
      // Legendary marks and glimmer are special cases
      switch (currencyHash) {
        case 2534352370:
          totalCoins[currencyHash] = D1StoresService.getVault()!.legendaryMarks;
          break;
        case 3159615086:
          totalCoins[currencyHash] = D1StoresService.getVault()!.glimmer;
          break;
        case 2749350776:
          totalCoins[currencyHash] = D1StoresService.getVault()!.silver;
          break;
        default:
          totalCoins[currencyHash] = sum(stores, (store) => {
            return store.amountOfItem({ hash: currencyHash } as any);
          });
          break;
      }
    });
    return totalCoins;
  }
开发者ID:bhollis,项目名称:DIM,代码行数:37,代码来源:vendor.service.ts


示例8: validateRequest

    // res: Response where to send error HTTP message if the request is invalid
    // requestBody: req.body OR req.query
    // constraints: validate.js format
    // return true if the request is valid
    static validateRequest(res: Response,
                           requestBody: any,
                           constraints: any): boolean {
        console.log(requestBody);
        if (_.isEmpty(requestBody)) {
            APIHelper.sendEmptyRequestResponse(res);
            return false;
        }
        let validation = validate(requestBody, constraints);
        console.log(requestBody);
        if (_.keys(validation).length > 0) {
            let validationErrors = {};
            for (let prop in validation) {
                if (!validation.hasOwnProperty(prop)) {
                    continue;
                }
                validationErrors[prop] = validation[prop];
            }
            APIHelper.sendInvalidInputResponse(res, validationErrors);
            return false;
        } else {

            return true;
        }
    }
开发者ID:JohanBaskovec,项目名称:libraryBackEnd,代码行数:29,代码来源:apiHelper.ts


示例9: on

  on(actions.searchHighlightOffset, (state, action) => {
    const { offset, relative } = action.payload;
    let highlight = offset;
    if (relative) {
      highlight = state.highlight + offset;
    }

    let numGames = 0;
    if (
      state.results &&
      state.results.games &&
      !isEmpty(state.results.games.ids)
    ) {
      numGames = state.results.games.ids.length;
    }

    if (highlight < 0) {
      highlight = numGames - 1;
    }
    if (highlight >= numGames) {
      highlight = 0;
    }

    return {
      ...state,
      highlight,
    };
  });
开发者ID:HorrerGames,项目名称:itch,代码行数:28,代码来源:search.ts



注:本文中的underscore.isEmpty函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript underscore.isEqual函数代码示例发布时间:2022-05-25
下一篇:
TypeScript underscore.isDate函数代码示例发布时间: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