当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript forEach.default函数代码示例

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


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

示例1: refresh

  /**
   * Refresh the list of zazus from the storage.
   */
  refresh () {
    const data = JSON.parse(this.storage.getItem(this.db));

    this.zazus = [];
    _forEach(data, (zazuData) => {
      this.zazus.push(new Zazu(zazuData));
    });
  }
开发者ID:spirosikmd,项目名称:zazu,代码行数:11,代码来源:storage.service.ts

示例2: flattenBool

function flattenBool(operator, arr) {
  // Flatten bool.must
  var newArr = []
  forEach(arr, node => {
    if (isBoolOp(operator, node)) {
      newArr.push(...node.bool[operator])
    } else {
      newArr.push(node)
    }
  })
  return newArr
}
开发者ID:BenJamesbabala,项目名称:searchkit,代码行数:12,代码来源:BoolQueries.ts

示例3: buildSharedQuery

  buildSharedQuery(query){
    let queryStr = this.state.getValue()
    if(queryStr){
      let queryBuilder  = this.options.queryBuilder || SimpleQueryString
      let simpleQuery = queryBuilder(
        queryStr, assign(
          {fields:this.options.queryFields},
          this.options.queryOptions
        )
      )

      let queries:Array<any> = [simpleQuery]

      if (this.options.prefixQueryFields) {
        let terms = String(queryStr).match(/\S+/g)
        let prefixQueries:Array<any> = [MultiMatchQuery(terms.pop(), assign(
          this.options.prefixQueryOptions, {
            type:"phrase_prefix",
            fields:this.options.prefixQueryFields,
          })
        )]
        forEach(terms, function(q) {
          prefixQueries.push(MultiMatchQuery(q, assign(
            this.options.prefixQueryOptions, {
              type:"phrase",
              fields:this.options.prefixQueryFields,
            })
          )) 
        }.bind(this))
        queries.push(BoolMust(prefixQueries))
      }
      query = query.addQuery(BoolShould(queries))

      if (this.options.addToFilters){
        query = query.addSelectedFilter({
          name: this.options.title,
          value: queryStr,
          id: this.key,
          remove: () => this.state = this.state.clear()
        })
      } else {
        query = query.setQueryString(queryStr)
      }

      return query
    }
    return query

  }
开发者ID:teisman,项目名称:searchkit,代码行数:49,代码来源:QueryAccessor.ts

示例4: function

    return function () {
      let blueprintPath = path.join(root, dir, 'files');
      let expected = walkSync(blueprintPath);
      let actual = walkSync('.').sort();
      let directory = path.basename(process.cwd());

      forEach(Blueprint.renamedFiles, function (destFile, srcFile) {
        expected[expected.indexOf(srcFile)] = destFile;
      });

      expected.forEach(function (file, index) {
        expected[index] = file.replace(/__name__/g, 'angular-cli');
      });

      expected.sort();

      expect(directory).to.equal('foo');
      expect(expected).to.deep.equal(
        actual,
        EOL + ' expected: ' + util.inspect(expected) + EOL + ' but got: ' + util.inspect(actual));

    };
开发者ID:jeremymwells,项目名称:angular-cli,代码行数:22,代码来源:new.spec.ts


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