ruit

WebJar for ruit

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

ruit
Последняя версия

Последняя версия

1.0.4
Дата

Дата

Тип

Тип

jar
Описание

Описание

ruit
WebJar for ruit
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/gianlucaguarini/ruit

Скачать ruit

Имя Файла Размер
ruit-1.0.4.pom
ruit-1.0.4.jar 7 KB
ruit-1.0.4-sources.jar 22 bytes
ruit-1.0.4-javadoc.jar 22 bytes
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/ruit/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>ruit</artifactId>
    <version>1.0.4</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/ruit/
implementation 'org.webjars.npm:ruit:1.0.4'
// https://jarcasting.com/artifacts/org.webjars.npm/ruit/
implementation ("org.webjars.npm:ruit:1.0.4")
'org.webjars.npm:ruit:jar:1.0.4'
<dependency org="org.webjars.npm" name="ruit" rev="1.0.4">
  <artifact name="ruit" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='ruit', version='1.0.4')
)
libraryDependencies += "org.webjars.npm" % "ruit" % "1.0.4"
[org.webjars.npm/ruit "1.0.4"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

Functional tasks serialization mini script (0.3kb)

Build Status

NPM version NPM downloads MIT License

Installation

import ruit from 'ruit'

API

ruit

Serialize a list of sync and async tasks from left to right

Parameters

  • tasks any list of tasks to process sequentially

Examples

const curry = f => a => b => f(a, b)
const add = (a, b) => a + b

const addOne = curry(add)(1)

const squareAsync = (num) => {
  return new Promise(r => {
    setTimeout(r, 500, num * 2)
  })
}

// a -> a + a -> a * 2
// basically from left to right: 1 => 1 + 1 => 2 * 2
ruit(1, addOne, squareAsync).then(result => console.log(result)) // 4

Returns Promise a promise containing the result of the whole chain

cancel

Helper that can be returned by ruit function to cancel the tasks chain

Examples

ruit(
  100,
  num => Math.random() * num
  num => num > 50 ? ruit.cancel() : num
  num => num - 2
).then(result => {
  console.log(result) // here we will get only number lower than 50
})

Returns Symbol internal private constant

compose

The same as ruit() but with the arguments inverted from right to left

Parameters

  • tasks any list of tasks to process sequentially

Examples

const curry = f => a => b => f(a, b)
const add = (a, b) => a + b

const addOne = curry(add)(1)

const squareAsync = (num) => {
  return new Promise(r => {
    setTimeout(r, 500, num * 2)
  })
}

// a -> a + a -> a * 2
// basically from right to left: 1 => 1 + 1 => 2 * 2
ruit.compose(squareAsync, addOne, 1).then(result => console.log(result)) // 4

Returns Promise a promise containing the result of the whole chain

Ruit meaning

ruit comes from the ruere latin verb that means It falls, It expresses properly the essence of this script and sounds also similar to run it

Версии библиотеки

Версия
1.0.4