1.0.2 • Published 1 year ago

@retrohack3r/cloze v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Usage

Takes a string containing anki style cloze notation and returns an array.

const cloze = require('@retrohack3r/cloze')

/* Returns:
[ { c: 1, answer: 'answer', hint: 'hint' } ]
*/
cloze('{{c1::answer::hint}}')

/* Returns:
[
  'foo ',
  { c: 2, answer: 'bar', hint: undefined },
  ' beep ',
  { c: 1, answer: 'fizz', hint: 'buzz' },
  'boop'
]
*/
cloze('foo {{c2::bar}} beep {{c1::fizz::buzz}}boop')

The returned array contains each "chunk" of the string, where a chunk is either a plaintext string or a cloze. You can reconstruct the original string from reading the array from left to right.

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago