# @retrohack3r/cloze

> Parse strings containing anki-style cloze notation

Latest version **1.0.2** (published 2022-11-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @retrohack3r/cloze
pnpm add @retrohack3r/cloze
yarn add @retrohack3r/cloze
bun add @retrohack3r/cloze
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-11-11 |
| First published | 2022-11-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | William Blankenship |
| Maintainers | retrohack3r |
| Keywords | cloze, anki, srs |

## Links

- npm: https://www.npmjs.com/package/@retrohack3r/cloze
- Repository: https://github.com/retrohacker/cloze
- Homepage: https://github.com/retrohacker/cloze#readme
- Issues: https://github.com/retrohacker/cloze/issues
- npm.io page: https://npm.io/package/@retrohack3r/cloze

## Recent versions

- 1.0.2 (latest) — 2022-11-11
- 1.0.1 — 2022-11-11
- 1.0.0 — 2022-11-11

## README

# Usage

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

```js
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.

---
_Source: https://npm.io/package/@retrohack3r/cloze · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
