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

TypeScript ramda.join函数代码示例

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

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



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

示例1: migrations

export default function migrations(config: Config) {
  let command = config.commands.migrations;

  return listMigrations(config.files.directory)
    .then(migrations =>
      command.id
      ? R.filter(m => m.id === command.id, migrations)
      : migrations
    )
    .map(command.long ? formatMigrationLong : formatMigration)
    .then(R.join(''));
}
开发者ID:programble,项目名称:careen,代码行数:12,代码来源:migrations.ts


示例2: journal

export default function journal(config: Config) {
  let client = config.client;
  let command = config.commands.journal;

  return readJournal(client.name, client.config, client.journalTable)
    .then(entries =>
      command.id
      ? R.filter(e => e.migrationID === command.id, entries)
      : entries
    )
    .map(formatJournalEntry)
    .then(R.join(''));
}
开发者ID:programble,项目名称:careen,代码行数:13,代码来源:journal.ts


示例3: status

export default function status(config: Config) {
  let client = config.client;
  let command = config.commands.status;

  let list = listMigrations(config.files.directory);
  let read = readJournal(client.name, client.config, client.journalTable);

  return Promise.join(list, read, getMigrationStates)
    .then(states =>
      command.id
      ? R.filter(s => s.migrationID === command.id, states)
      : states
    )
    .map(formatMigrationState)
    .then(R.join(''));
}
开发者ID:programble,项目名称:careen,代码行数:16,代码来源:status.ts


示例4: apply

export default function apply(config: Config) {
  let client = config.client;
  let command = config.commands.apply;

  let migrations = listMigrations(config.files.directory);
  let journal = readJournal(client.name, client.config, client.journalTable);
  let states = Promise.join(migrations, journal, getMigrationStates)

  let applicableIDs = states
    .then(R.filter(isApplicable))
    .then(ss => R.map(s => s.migrationID, ss));
  let toApplyIDs: Promise<string[]>;

  if (command.pending) {
    toApplyIDs = applicableIDs;
  } else if (command.id) {
    toApplyIDs = applicableIDs.then(R.filter(id => id === command.id));
  } else if (command.to) {
    toApplyIDs = applicableIDs.then(R.filter(id => id <= command.to));
  } else if (command.number) {
    toApplyIDs = applicableIDs.then(R.take(command.number));
  } else {
    toApplyIDs = Promise.resolve([]);
  }

  let toApply = Promise.join(migrations, toApplyIDs, (ms, ids) =>
    R.filter(m => R.contains(m.id, ids), ms)
  );

  let apply = toApply.then(ms =>
    applyFunction(command.method)(
      client.name, client.config, client.journalTable, ms
    )
  );

  let previousEntry = journal.then(es => R.last(es));
  let newEntries = Promise.join(previousEntry, apply, (prev, es) =>
    prev ? R.filter(e => e.timestamp > prev.timestamp, es) : apply
  );

  return newEntries
    .then(R.map(formatJournalEntry))
    .then(R.join(''));
}
开发者ID:programble,项目名称:careen,代码行数:44,代码来源:apply.ts


示例5: revert

export default function revert(config: Config) {
  let client = config.client;
  let command = config.commands.revert;

  let migrations = listMigrations(config.files.directory);
  let journal = readJournal(client.name, client.config, client.journalTable);
  let states = Promise.join(migrations, journal, getMigrationStates);

  let revertableIDs = states
    .then(R.filter(isRevertable))
    .then(ss => R.map(s => s.migrationID, ss));
  let toRevertIDs: Promise<string[]>;

  if (command.id) {
    toRevertIDs = revertableIDs.then(R.filter(id => id === command.id));
  } else if (command.to) {
    toRevertIDs = revertableIDs.then(R.filter(id => id > command.to));
  } else if (command.number) {
    toRevertIDs = revertableIDs.then(R.reverse).then(R.take(command.number));
  } else {
    toRevertIDs = Promise.resolve([]);
  }

  let toRevert = Promise.join(migrations, toRevertIDs, (ms, ids) =>
    R.filter(m => R.contains(m.id, ids), R.reverse(ms))
  );

  let revert = toRevert.then(ms =>
    revertFunction(command.method)(
      client.name, client.config, client.journalTable, ms
    )
  );

  let previousEntry = journal.then(es => R.last(es));
  let newEntries = Promise.join(previousEntry, revert, (prev, es) =>
    R.filter(e => e.timestamp > prev.timestamp, es)
  );

  return newEntries
    .then(R.map(formatJournalEntry))
    .then(R.join(''));
}
开发者ID:programble,项目名称:careen,代码行数:42,代码来源:revert.ts


示例6: saveBase64Image

  static async saveBase64Image(base64: string): Promise<string> {
    const imageURLData = base64.replace(/^data:image\/\w+;base64,/, '');
    const hash = md5(imageURLData + Date.now()).substring(0, 20);
    const filename = R.compose(
      R.join('-'),
      R.splitEvery(5)
    )(hash);

    const storagePath: string = configure.get('TASK_COVER_STORAGE_PATH');

    await new Promise((resolve, reject) => {
      fs.writeFile(path.join(storagePath, filename), imageURLData, 'base64', error => {
        if (error) {
          return reject(error);
        }
        return resolve();
      });
    });
    return filename;
  }
开发者ID:A-Horse,项目名称:bblist-backend,代码行数:20,代码来源:file.service.ts


示例7: it

import * as R from 'ramda'
import makeCard from './makeCard'

const example = 'example'
const situation = 'situation'
const geography = 'geography'
const form = 'form'
const pronunciation = 'pronunciation'
const definition = 'definition'
const synonym = 'synonym'
const antonym = 'antonym'
const headword = "doesn't matter"
const frequency = "doesn't matter"

const join = R.join('')

describe('makeCard', () => {
    it('make correct card if example passed (minimum card parts)', () => {
        expect(
            makeCard({
                example,
                definition,
                form,
                situation: '',
                geography: '',
                synonym: '',
                antonym: '',
                pronunciation: '',
                headword,
                frequency
            })
开发者ID:yakhinvadim,项目名称:longman-to-anki,代码行数:31,代码来源:makeCard.test.ts


示例8: compose

  compose,
  map
} from 'pointfree-fantasy';
import listen from 'utils/listen';
import getDom from 'utils/get-dom';
import logEventValue from 'utils/log-event-value';
import setHtml from 'utils/set-html';
import getJson from 'utils/get-json';
import log from 'utils/log';

const apiEndpoint: string = 'http://jsonplaceholder.typicode.com/posts';

// templatePost :: String -> String
const templatePost = (title: string) => `<li>${title}</li>`;

// getPostHtml :: Post -> String
const getPostHtml = compose(templatePost, _.prop('title'));

// getPostsHtml :: [Post] -> String
const getPostsHtml = compose(_.join(''), map(getPostHtml));

const displayPosts = compose(setHtml('.posts'), getPostsHtml);

getJson(apiEndpoint)
  .fork(log, displayPosts);

getDom('input')
  .map(listen('keyup'))
  .runIO()
  .subscribe(logEventValue, log);
开发者ID:markj-,项目名称:hardcore-functional,代码行数:30,代码来源:main.ts


示例9: RegExp

 replacement =>
   syllable.replace(
     new RegExp(`(${join('|', replacementSet)})`, 'g'),
     replacement
   ),
开发者ID:serlo-org,项目名称:serlo-abc,代码行数:5,代码来源:connect-syllables.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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