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


TypeScript ramda.concat函数代码示例

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