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

TypeScript ramda.concat函数代码示例

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

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



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

示例1: sendSubscriptions

    /**
     * Sends all subscribed values to the Reactotron app.
     *
     * @param node The tree to grab the state data from
     */
    function sendSubscriptions(state: any) {
      // this is unreadable
      const changes = pipe(
        map(when(isNil, always(""))) as any,
        filter(endsWith(".*")),
        map((key: string) => {
          const keyMinusWildcard = slice(0, -2, key)
          const value = dotPath(keyMinusWildcard, state)
          if (is(Object, value) && !isNilOrEmpty(value)) {
            return pipe(keys, map(key => `${keyMinusWildcard}.${key}`))(value)
          }
          return []
        }) as any,
        concat(map(when(isNil, always("")), subscriptions)),
        flatten,
        reject(endsWith(".*")) as any,
        uniq as any,
        sortBy(identity) as any,
        map((key: string) => ({
          path: key,
          value: isNilOrEmpty(key) ? state : dotPath(key, state),
        })),
      )(subscriptions)

      reactotron.stateValuesChange(changes)
    }
开发者ID:nick121212,项目名称:reactotron,代码行数:31,代码来源:reactotron-mst.ts


示例2: rowGenerator

export function rowGenerator(state: State, table: string, schema: RelationTree): Route[] {

  let history: History = R.clone(state.history || []);

  if (history.length >= state.options.relationLimit) {
    return [];
  }

  let last = R.last(history);

  let relation = schema[table].relations[last && last['table']];
  let identifier = `${schema[table].model}_id`;
  if (relation) {
    history.push({
      type: 'row',
      table: table,
      model: schema[table].model
    });
  }
  else {
    history[0] = {
      type: 'row',
      table: table,
      model: schema[table].model,
      identifier: identifier
    };
  }

  let identifierString = state.options.idFormat === 'colons' ?
    `:${identifier}` : `{${identifier}}`;

  let newPath = relation ?
    `${state.path}/${schema[table].model}` :  `${state.path}/${identifierString}`;

  let newState = {
    options: state.options,
    path: newPath,
    history: history
  };

  let tables = R.flatten(Object.keys(schema[table].relations).map((relation) => {
    if (schema[table].relations[relation] === 'one') {
      return rowGenerator(newState, relation, schema);
    }
    else {
      return tableGenerator(newState, relation, schema);
    }
  }));

  return R.concat(
    scopes.row.methods.map((method) => {
      return {
        path: newPath,
        method: method,
        history: history
      };
    }),
    tables
  );
};
开发者ID:repositive,项目名称:hapi-path-generator,代码行数:60,代码来源:pathGenerator.ts


示例3: deepMerge

function deepMerge(v1, v2) {
  if (Array.isArray(v1) && Array.isArray(v2)) {
    return R.uniq(R.concat(v1, v2));
  }
  else if (typeof v1 === 'object' && typeof v2 === 'object') {
    return R.mergeWith(deepMerge, v1, v2);
  }
  else {
    return v2;
  }
}
开发者ID:repositive,项目名称:hapi-path-generator,代码行数:11,代码来源:index.ts


示例4: reduce

  return reduce((files: string[], file: string) => {
    const abspath = join(directory, file);

    if (isFile(abspath))
      return append(file, files);

    if (isDirectory(abspath))
      return concat(files,
        getAllInDirectory(abspath).map((f: string) => join(relative(directory, abspath), f)));

    return files;
  }, [], fs.readdirSync(directory));
开发者ID:TylorS,项目名称:ts-lib,代码行数:12,代码来源:fs.ts


示例5: buildJoiSpec

 (acc, [method, spec]) =>
     Maybe.of(concat)
         .ap(parseSecuritySpec(spec))
         .ap(parseRouteSpec(spec, routeHandlers))
         .map(handler => [
             {
                 method,
                 path,
                 handler,
                 validate: buildJoiSpec(Joi, spec),
                 meta: pick(['summary', 'description'], spec)
             }
         ])
         .fold(always(acc), concat(acc)),
开发者ID:benjambles,项目名称:my-own-world,代码行数:14,代码来源:get-route-mapping.ts


示例6: sample

 ...map(letter => {
   const selectedSymbols: Figure[] = sample(
     concat(allTextSymbols, allIconSymbols),
     4
   );
   const symbols = sample(
     [...selectedSymbols, letter],
     selectedSymbols.length + 1
   );
   return this.createExercise(ExerciseTypes.DifferFromSymbol, {
     type: 'DifferFromSymbol',
     symbols,
     correctIndex: symbols.indexOf(letter)
   });
 }, letterSymbols)
开发者ID:serlo-org,项目名称:serlo-abc,代码行数:15,代码来源:differ-from-symbol.ts


示例7: getVocabulary

  public getVocabulary(id: string): string[] {
    if (this.getId() === id) {
      return this.getNewVocabulary();
    }

    const nodesUntilId = takeWhile(
      found => !found,
      map(child => child.findEntity(id), this.getChildren())
    );
    const previousChildren = take(nodesUntilId.length + 1, this.getChildren());

    return concat(
      flatten<string>(map(node => node.getVocabulary(id), previousChildren)),
      this.getNewVocabulary()
    );
  }
开发者ID:serlo-org,项目名称:serlo-abc,代码行数:16,代码来源:InternalNode.ts


示例8: getLetters

  public getLetters(id: string): string[] {
    const newLetterArr: string[] = this.getNewLetter()
      ? ([this.getNewLetter()] as string[])
      : [];
    if (this.getId() === id) {
      return newLetterArr;
    }

    const nodesUntilId = takeWhile(
      found => !found,
      map(child => child.findEntity(id), this.getChildren())
    );
    const previousChildren = take(nodesUntilId.length + 1, this.getChildren());

    return concat(
      flatten<string>(map(node => node.getLetters(id), previousChildren)),
      newLetterArr
    );
  }
开发者ID:serlo-org,项目名称:serlo-abc,代码行数:19,代码来源:InternalNode.ts


示例9: tableGenerator

export function tableGenerator(state: State, table: string, schema: RelationTree): Route[] {

  let history = R.clone(state.history || []);

  if (history.length >= state.options.relationLimit || (state.path || '').indexOf(table) !== -1) {
    return [];
  }
  else {
    let useRoot = history.length > 0 ? 'methods' : 'rootMethods';

    history.push({
      type: 'table',
      table: table,
      model: schema[table].model
    });
    let newPath = `${state.path || state.options.prefix}/${table}`;
    let newState = {
      options: state.options,
      path: newPath,
      history: history
    };

    let rows = rowGenerator(newState, table, schema);

    return R.concat(
      scopes.table[useRoot].map((method: string) => {
        return {
          path: newPath,
          method: method,
          history: history
        };
      }),
      rows
    );
  }
};
开发者ID:repositive,项目名称:hapi-path-generator,代码行数:36,代码来源:pathGenerator.ts


示例10: generator

const generator = module.exports.generator = function generator(sequelize, history, context, queryAcc?) {

  let first = history.shift();
  // throw first;
  let q = {
    model: sequelize.models[first.model]
  };

  if (queryAcc) {
    if (context.query.embed && context.query.embed[queryAcc.model.name]) {
      delete context.query.embed[queryAcc.model.name];
    }
    else {
      queryAcc.attributes = [];
    }
    q['include'] = [queryAcc];
  }

  let where = {};

  if (context.identifiers && context.identifiers[first.identifier]) {

    let modelIds: IdentifierMap = identifiers(sequelize.models[first.model]);

    Object.keys(modelIds).forEach((id) => {
      let _id = context.identifiers[first.identifier];
      if (modelIds[id] === 'INTEGER' && validator.isInt(String(_id))) {
        modelIds[id] = Number(_id);
      }
      else if (modelIds[id] === 'UUID' && validator.isUUID(String(_id))) {
        modelIds[id] = _id;
      }
      else if (modelIds[id] !== 'INTEGER' && modelIds[id] !== 'UUID') {
        modelIds[id] = String(_id);
      }
      else {
        delete modelIds[id];
      }
    });

    if (Object.keys(modelIds).length === 1) {
      where = modelIds;
    }
    else {
      where['$or'] = modelIds;
    }
  }

  if (Object.keys(where).length !== 0) {
    q['where'] = where;
  }

  if (history.length === 0) {

    if (context.query.embed && Object.keys(context.query.embed).length > 0) {
      let remainingToEmbed = [];

      Object.keys(context.query.embed).forEach((model) => {
        remainingToEmbed.push({
          model: sequelize.models[model]
        });
      });
      q['include'] = R.concat(q['include'] || [], remainingToEmbed);
    }

    if (context.query.attributes) {
      q['where'] = R.merge(context.query.attributes, q['where']);
    }

    if (context.query.pagination) {
      q = R.merge(context.query.pagination, q);
    }

    if (context.method === 'put' || context.method === 'post') {
      q['returning'] = true;
    }
    
    if (context.method === 'put' || context.method === 'delete') {
      q['individualHooks'] = true;
    }

    return q;
  }
  else {
    return generator(sequelize, history, context, q);
  }

};
开发者ID:repositive,项目名称:hapi-path-generator,代码行数:88,代码来源:queryGenerator.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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