當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。