0.2.13 • Published 3 years ago

@mdo-org/mdo-plugin-repeat v0.2.13

Weekly downloads
1
License
SEE LICENSE IN .....
Repository
github
Last release
3 years ago

"Repeat" Plugin

The repeat plugin allows you to re-schedule completed to-dos so they show up again in a future date.

It works by calculating a new @start value based on the @repeat tag's information.

Installation

npm install --save @mdo-org/mdo-plugin-repeat

Usage

const repeat = require('@mdo-org/mdo-plugin-repeat');

const time = "2019-04-01T00:00-05:00";
const timezone = "America/Panama";

mdoStream
  .pipe((repeat.parse({ time, timezone })));
  .pipe((repeat.process({ time, timezone })));
  .pipe((repeat.stringify({ time, timezone })));

Overview

parse

Converts the .repeat value from a string to an object with the following fields: string, n, period, type.

The allowed formats are specified here.

Example:

given the following block object:

{ repeat: "every 10 days from complete" }

after parse:

{
    repeat: {
      string: 'every 10 days from complete',
      n: 10,
      period: 'DAYS',
      type: 'COMPLETE', // another possible value is 'START'
    }
}

process

For every Block that has both type COMPLETE and a .repeat property:

  • set the Block's type to INCOMPLETE
  • calculate the next .start value using these rules:

    if .repeat.type === "START":
      .start = .start + <n period>
    
    if .repeat.type === "COMPLETE":
      .start = <now> + <n period>`

stringify

Converts the .repeat value from an object back into a string.

Example:

given the following block object:

{
    repeat: {
      string: 'every 10 days from complete',
      n: 10,
      period: 'DAYS',
      type: 'COMPLETE',
    }
}

after stringify:

{ repeat: 'every 10 days from complete' }
0.2.13

3 years ago

0.2.12

5 years ago

0.2.11

5 years ago

0.2.10

5 years ago

0.2.9

5 years ago

0.2.8

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.3

5 years ago

0.2.1

5 years ago